From 42f5f2c89c28b40aea665e088099b9edc7149c2f Mon Sep 17 00:00:00 2001 From: Dongdong Tian Date: Tue, 2 Jan 2024 15:02:06 +0800 Subject: [PATCH 1/4] CI: Trigger workflows based on changed files --- .github/workflows/benchmarks.yml | 2 -- .github/workflows/cache_data.yaml | 4 ++-- .github/workflows/ci_docs.yml | 19 ++++++++++++++----- .github/workflows/ci_tests.yaml | 13 ++++++------- .github/workflows/ci_tests_dev.yaml | 10 +++------- .github/workflows/ci_tests_legacy.yaml | 10 +++------- .github/workflows/type_checks.yml | 6 ++++++ 7 files changed, 34 insertions(+), 30 deletions(-) diff --git a/.github/workflows/benchmarks.yml b/.github/workflows/benchmarks.yml index da451553c82..884b9b4416d 100644 --- a/.github/workflows/benchmarks.yml +++ b/.github/workflows/benchmarks.yml @@ -11,12 +11,10 @@ on: branches: [ main ] paths: - 'pygmt/**/*.py' - - '!pygmt/tests/**' - '.github/workflows/benchmarks.yml' pull_request: paths: - 'pygmt/**/*.py' - - '!pygmt/tests/**' - '.github/workflows/benchmarks.yml' # `workflow_dispatch` allows CodSpeed to trigger backtest # performance analysis in order to generate initial data. diff --git a/.github/workflows/cache_data.yaml b/.github/workflows/cache_data.yaml index 3a4a43852c3..2b343085382 100644 --- a/.github/workflows/cache_data.yaml +++ b/.github/workflows/cache_data.yaml @@ -5,14 +5,14 @@ # by other GitHub Actions workflows. # # It is scheduled to run every Sunday at 12:00 (UTC). If new remote files are -# needed urgently, maintainers can update the workflow file or +# needed urgently, maintainers can update the workflow file or the # 'pygmt/helpers/caching.py' file to refresh the cache. # name: Cache data on: pull_request: - # Make any changes to the following files to refresh the cache + # Make any changes to the following files to refresh the cache in PRs paths: - 'pygmt/helpers/caching.py' - '.github/workflows/cache_data.yaml' diff --git a/.github/workflows/ci_docs.yml b/.github/workflows/ci_docs.yml index 759410a763d..9705378f062 100644 --- a/.github/workflows/ci_docs.yml +++ b/.github/workflows/ci_docs.yml @@ -18,13 +18,22 @@ name: Docs on: push: branches: [ main ] + paths: + - 'pygmt/**/*.py' + - '!pygmt/tests/**' + - 'doc/**' + - 'examples/**' + - 'README.rst' + - '.github/workflows/ci_docs.yml' pull_request: types: [opened, reopened, synchronize, ready_for_review] - paths-ignore: - - 'pygmt/tests/**' - - '*.md' - - 'LICENSE.txt' - - '.gitignore' + paths: + - 'pygmt/**/*.py' + - '!pygmt/tests/**' + - 'doc/**' + - 'examples/**' + - 'README.rst' + - '.github/workflows/ci_docs.yml' release: types: - published diff --git a/.github/workflows/ci_tests.yaml b/.github/workflows/ci_tests.yaml index f68d4d355b3..7634a598e9a 100644 --- a/.github/workflows/ci_tests.yaml +++ b/.github/workflows/ci_tests.yaml @@ -25,15 +25,14 @@ name: Tests on: push: branches: [ main ] + paths: + - 'pygmt/**/*.py' + - '.github/workflows/ci_tests.yaml' pull_request: types: [opened, reopened, synchronize, ready_for_review] - paths-ignore: - - 'doc/**' - - 'examples/**' - - '*.md' - - 'README.rst' - - 'LICENSE.txt' - - '.gitignore' + paths: + - 'pygmt/**/*.py' + - '.github/workflows/ci_tests.yaml' release: types: - published diff --git a/.github/workflows/ci_tests_dev.yaml b/.github/workflows/ci_tests_dev.yaml index b518eb90acd..6f92a84b5f9 100644 --- a/.github/workflows/ci_tests_dev.yaml +++ b/.github/workflows/ci_tests_dev.yaml @@ -17,13 +17,9 @@ on: # branches: [ main ] pull_request: types: [ready_for_review] - paths-ignore: - - 'doc/**' - - 'examples/**' - - '*.md' - - 'README.rst' - - 'LICENSE.txt' - - '.gitignore' + paths: + - 'pygmt/**/*.py' + - '.github/workflows/ci_tests_dev.yaml' repository_dispatch: types: [test-gmt-dev-command] # Schedule tests on Monday/Wednesday/Friday diff --git a/.github/workflows/ci_tests_legacy.yaml b/.github/workflows/ci_tests_legacy.yaml index ac1361c8baf..4329d06e20a 100644 --- a/.github/workflows/ci_tests_legacy.yaml +++ b/.github/workflows/ci_tests_legacy.yaml @@ -13,13 +13,9 @@ on: # branches: [ main ] # pull_request: # types: [ready_for_review] - # paths-ignore: - # - 'doc/**' - # - 'examples/**' - # - '*.md' - # - 'README.rst' - # - 'LICENSE.txt' - # - '.gitignore' + # paths: + # - 'pygmt/**/*.py' + # - '.github/workflows/ci_tests_legacy.yaml' # Schedule tests on Tuesday schedule: - cron: '0 0 * * 2' diff --git a/.github/workflows/type_checks.yml b/.github/workflows/type_checks.yml index 25c5ff42d87..7ecefe04277 100644 --- a/.github/workflows/type_checks.yml +++ b/.github/workflows/type_checks.yml @@ -10,7 +10,13 @@ name: Static Type Checks on: push: branches: [ main ] + paths: + - 'pygmt/**/*.py' + - '.github/workflows/type_checks.yml' pull_request: + paths: + - 'pygmt/**/*.py' + - '.github/workflows/type_checks.yml' # Schedule daily tests schedule: - cron: '0 0 * * *' From 588e997e121c676f8068036c85a10be7cee9fc6d Mon Sep 17 00:00:00 2001 From: Dongdong Tian Date: Fri, 5 Jan 2024 21:34:40 +0800 Subject: [PATCH 2/4] Update more --- .github/workflows/ci_tests.yaml | 4 ++-- .github/workflows/ci_tests_dev.yaml | 2 +- .github/workflows/ci_tests_legacy.yaml | 2 +- .github/workflows/publish-to-pypi.yml | 10 ++++++++-- .github/workflows/release-drafter.yml | 1 - 5 files changed, 12 insertions(+), 7 deletions(-) diff --git a/.github/workflows/ci_tests.yaml b/.github/workflows/ci_tests.yaml index 7634a598e9a..f6cb2821f48 100644 --- a/.github/workflows/ci_tests.yaml +++ b/.github/workflows/ci_tests.yaml @@ -26,12 +26,12 @@ on: push: branches: [ main ] paths: - - 'pygmt/**/*.py' + - 'pygmt/**' - '.github/workflows/ci_tests.yaml' pull_request: types: [opened, reopened, synchronize, ready_for_review] paths: - - 'pygmt/**/*.py' + - 'pygmt/**' - '.github/workflows/ci_tests.yaml' release: types: diff --git a/.github/workflows/ci_tests_dev.yaml b/.github/workflows/ci_tests_dev.yaml index 6f92a84b5f9..22e9911a6b4 100644 --- a/.github/workflows/ci_tests_dev.yaml +++ b/.github/workflows/ci_tests_dev.yaml @@ -18,7 +18,7 @@ on: pull_request: types: [ready_for_review] paths: - - 'pygmt/**/*.py' + - 'pygmt/**' - '.github/workflows/ci_tests_dev.yaml' repository_dispatch: types: [test-gmt-dev-command] diff --git a/.github/workflows/ci_tests_legacy.yaml b/.github/workflows/ci_tests_legacy.yaml index 8990c140b1d..584ff30fdf8 100644 --- a/.github/workflows/ci_tests_legacy.yaml +++ b/.github/workflows/ci_tests_legacy.yaml @@ -14,7 +14,7 @@ on: # pull_request: # types: [ready_for_review] # paths: - # - 'pygmt/**/*.py' + # - 'pygmt/**' # - '.github/workflows/ci_tests_legacy.yaml' # Schedule tests on Tuesday schedule: diff --git a/.github/workflows/publish-to-pypi.yml b/.github/workflows/publish-to-pypi.yml index fbd69fe1e32..2fb1adde473 100644 --- a/.github/workflows/publish-to-pypi.yml +++ b/.github/workflows/publish-to-pypi.yml @@ -17,8 +17,14 @@ name: Publish to PyPI # Only run for pushes to the main branch and releases. on: push: - branches: - - main + branches: [ main ] + paths: + - 'pygmt/**' + - 'Makefile' + - 'MANIFEST.in' + - 'pyproject.toml' + - 'README.rst' + - '.github/workflows/publish-to-pypi.yml' release: types: - published diff --git a/.github/workflows/release-drafter.yml b/.github/workflows/release-drafter.yml index 58efce03d7a..3a83758c4ba 100644 --- a/.github/workflows/release-drafter.yml +++ b/.github/workflows/release-drafter.yml @@ -8,7 +8,6 @@ name: Release Drafter on: push: - # branches to consider in the event; optional, defaults to all branches: - main From b1e5fa81bf4e7d097ebcd2f76311128f62ec60ae Mon Sep 17 00:00:00 2001 From: Dongdong Tian Date: Sat, 6 Jan 2024 15:37:50 +0800 Subject: [PATCH 3/4] Disable benchmarks in PRs --- .github/workflows/benchmarks.yml | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/.github/workflows/benchmarks.yml b/.github/workflows/benchmarks.yml index c1d50c2343b..43e58933edd 100644 --- a/.github/workflows/benchmarks.yml +++ b/.github/workflows/benchmarks.yml @@ -12,10 +12,7 @@ on: paths: - 'pygmt/**/*.py' - '.github/workflows/benchmarks.yml' - pull_request: - paths: - - 'pygmt/**/*.py' - - '.github/workflows/benchmarks.yml' + # pull_request: # `workflow_dispatch` allows CodSpeed to trigger backtest # performance analysis in order to generate initial data. workflow_dispatch: From afeb94f31be33d6c01829a5e784ad9e0c0cca1ff Mon Sep 17 00:00:00 2001 From: Dongdong Tian Date: Sat, 6 Jan 2024 16:35:15 +0800 Subject: [PATCH 4/4] Apply suggestions from code review Co-authored-by: Wei Ji <23487320+weiji14@users.noreply.github.com> --- .github/workflows/benchmarks.yml | 1 + .github/workflows/ci_tests_legacy.yaml | 1 + .github/workflows/publish-to-pypi.yml | 1 + 3 files changed, 3 insertions(+) diff --git a/.github/workflows/benchmarks.yml b/.github/workflows/benchmarks.yml index 43e58933edd..ae900ac31d5 100644 --- a/.github/workflows/benchmarks.yml +++ b/.github/workflows/benchmarks.yml @@ -12,6 +12,7 @@ on: paths: - 'pygmt/**/*.py' - '.github/workflows/benchmarks.yml' + # Uncomment the 'pull_request' line below to trigger the workflow in PR # pull_request: # `workflow_dispatch` allows CodSpeed to trigger backtest # performance analysis in order to generate initial data. diff --git a/.github/workflows/ci_tests_legacy.yaml b/.github/workflows/ci_tests_legacy.yaml index 584ff30fdf8..f36355dba65 100644 --- a/.github/workflows/ci_tests_legacy.yaml +++ b/.github/workflows/ci_tests_legacy.yaml @@ -11,6 +11,7 @@ name: GMT Legacy Tests on: # push: # branches: [ main ] + # Uncomment the 'pull_request' line below to trigger the workflow in PR # pull_request: # types: [ready_for_review] # paths: diff --git a/.github/workflows/publish-to-pypi.yml b/.github/workflows/publish-to-pypi.yml index 2fb1adde473..6b1a52661ea 100644 --- a/.github/workflows/publish-to-pypi.yml +++ b/.github/workflows/publish-to-pypi.yml @@ -20,6 +20,7 @@ on: branches: [ main ] paths: - 'pygmt/**' + - '!pygmt/tests/**' - 'Makefile' - 'MANIFEST.in' - 'pyproject.toml'