Skip to content

Commit

Permalink
CI: Trigger workflows based on changed files (#2952)
Browse files Browse the repository at this point in the history
Co-authored-by: Wei Ji <23487320+weiji14@users.noreply.github.com>
  • Loading branch information
seisman and weiji14 authored Jan 6, 2024
1 parent 5696542 commit 98e0074
Show file tree
Hide file tree
Showing 9 changed files with 46 additions and 37 deletions.
8 changes: 2 additions & 6 deletions .github/workflows/benchmarks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,9 @@ on:
branches: [ main ]
paths:
- 'pygmt/**/*.py'
- '!pygmt/tests/**'
- '.github/workflows/benchmarks.yml'
pull_request:
paths:
- 'pygmt/**/*.py'
- '!pygmt/tests/**'
- '.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.
workflow_dispatch:
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/cache_data.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down
19 changes: 14 additions & 5 deletions .github/workflows/ci_docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
13 changes: 6 additions & 7 deletions .github/workflows/ci_tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,14 @@ name: Tests
on:
push:
branches: [ main ]
paths:
- 'pygmt/**'
- '.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/**'
- '.github/workflows/ci_tests.yaml'
release:
types:
- published
Expand Down
10 changes: 3 additions & 7 deletions .github/workflows/ci_tests_dev.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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/**'
- '.github/workflows/ci_tests_dev.yaml'
repository_dispatch:
types: [test-gmt-dev-command]
# Schedule tests on Monday/Wednesday/Friday
Expand Down
11 changes: 4 additions & 7 deletions .github/workflows/ci_tests_legacy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,12 @@ 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-ignore:
# - 'doc/**'
# - 'examples/**'
# - '*.md'
# - 'README.rst'
# - 'LICENSE.txt'
# - '.gitignore'
# paths:
# - 'pygmt/**'
# - '.github/workflows/ci_tests_legacy.yaml'
# Schedule tests on Tuesday
schedule:
- cron: '0 0 * * 2'
Expand Down
11 changes: 9 additions & 2 deletions .github/workflows/publish-to-pypi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,15 @@ name: Publish to PyPI
# Only run for pushes to the main branch and releases.
on:
push:
branches:
- main
branches: [ main ]
paths:
- 'pygmt/**'
- '!pygmt/tests/**'
- 'Makefile'
- 'MANIFEST.in'
- 'pyproject.toml'
- 'README.rst'
- '.github/workflows/publish-to-pypi.yml'
release:
types:
- published
Expand Down
1 change: 0 additions & 1 deletion .github/workflows/release-drafter.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ name: Release Drafter

on:
push:
# branches to consider in the event; optional, defaults to all
branches:
- main

Expand Down
6 changes: 6 additions & 0 deletions .github/workflows/type_checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 * * *'
Expand Down

0 comments on commit 98e0074

Please sign in to comment.