-
Notifications
You must be signed in to change notification settings - Fork 3.5k
ci: only run jobs when relevant files have been changed #12006
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
terrytangyuan
merged 25 commits into
argoproj:master
from
agilgur5:ci-skip-steps-changed-files
Oct 18, 2023
Merged
Changes from all commits
Commits
Show all changes
25 commits
Select commit
Hold shift + click to select a range
9a4ac6c
ci: only run jobs when relevant files have been changed
agilgur5 aafd917
try checking `== 'true'`?
agilgur5 2b36c20
add workaround for status checks
agilgur5 21682cf
skip unit tests as well
agilgur5 9dce4cb
add some more relevant files to the lists
agilgur5 d278e8b
full lint checks
agilgur5 dbe0b79
add empty line in UI to test that UI check runs
agilgur5 b17c223
fix to use files_yaml?
agilgur5 4536f54
yaml nots need quoting?
agilgur5 c6de853
dry up config a bit
agilgur5 3086e78
add empty line to test lint
agilgur5 7ebd7d7
try removing the nots?
agilgur5 188b6d4
change the DRY mechanism?
agilgur5 9aa097e
fix `needs` for `lint` and `codegen`
agilgur5 6b506ea
revert ui test change
agilgur5 3c7d127
revert lint test change
agilgur5 34671d7
add empty line to test Codegen
agilgur5 c50d621
revert codegen test change
agilgur5 98e80c1
add empty line to test E2E
agilgur5 e183ca9
revert E2E test change
agilgur5 22b9216
add empty line to test units, e2e, lint
agilgur5 3940d44
revert unit test et al change
agilgur5 a51064c
run all jobs when ci-build.yaml is changed
agilgur5 13e0c02
add Makefile + tasks.yaml as well
agilgur5 01aa788
fix typo in list
agilgur5 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -17,8 +17,99 @@ permissions: | |
| contents: read | ||
|
|
||
| jobs: | ||
| changed-files: | ||
| name: Get changed files | ||
| outputs: | ||
| # reference: https://github.com/tj-actions/changed-files#outputs- | ||
| tests: ${{ steps.changed-files.outputs.tests_any_modified == 'true' }} | ||
| e2e-tests: ${{ steps.changed-files.outputs.e2e-tests_any_modified == 'true' }} | ||
| codegen: ${{ steps.changed-files.outputs.codegen_any_modified == 'true' }} | ||
| lint: ${{ steps.changed-files.outputs.lint_any_modified == 'true' }} | ||
| ui: ${{ steps.changed-files.outputs.ui_any_modified == 'true' }} | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
| with: | ||
| fetch-depth: 50 # assume PRs are less than 50 commits | ||
| - name: Get relevant files changed per group | ||
| id: changed-files | ||
| uses: tj-actions/changed-files@v39 | ||
| with: | ||
| files_yaml: | | ||
| common: &common | ||
| - .github/workflows/ci-build.yaml | ||
|
agilgur5 marked this conversation as resolved.
|
||
| - Makefile | ||
| - tasks.yaml | ||
| tests: &tests | ||
| - *common | ||
|
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. as mentioned in the PR description, |
||
| - cmd/** | ||
| - config/** | ||
| - errors/** | ||
| - persist/** | ||
| - pkg/** | ||
| - server/** | ||
| - test/** | ||
| - util/** | ||
| - workflow/** | ||
| - go.mod | ||
| - go.sum | ||
| e2e-tests: | ||
| - *tests | ||
| # plus manifests and SDKs that are used in E2E tests | ||
| - manifests/** | ||
| - sdks/** | ||
| codegen: | ||
| - *common | ||
| # generated files | ||
| - api/** | ||
| - docs/fields.md | ||
| - docs/executor_swagger.md | ||
| - docs/cli/** | ||
| - pkg/** | ||
| - sdks/java/** | ||
| - sdks/python/** | ||
| # files that generation is based off | ||
| - pkg/** | ||
| - cmd/** | ||
| - examples/** # examples are used within the fields lists | ||
| # generation scripts | ||
| - hack/cli/** | ||
| - hack/jsonschema/** | ||
| - hack/swagger/** | ||
| - hack/auto-gen-msg.sh | ||
| - hack/crdgen.sh | ||
| - hack/crds.go | ||
| - hack/docgen.go | ||
| - hack/parse_examples.go | ||
| - hack/swaggify.sh | ||
| - .clang-format | ||
| lint: | ||
| - *tests | ||
| # plus lint config | ||
| - .golangci.yml | ||
| # docs files below | ||
| - docs/** | ||
| # generated files are covered by codegen | ||
| - '!docs/fields.md' | ||
| - '!docs/executor_swagger.md' | ||
| - '!docs/cli/**' | ||
| # proposals live only on GH as pure markdown | ||
| - '!docs/proposals/**' | ||
| # docs scripts & tools from `make docs` | ||
| - hack/check-mkdocs.sh | ||
| - hack/check-env-doc.sh | ||
| - .markdownlint.yaml | ||
| - .mlc_config.json | ||
| - .spelling | ||
| - mkdocs.yml | ||
| ui: | ||
| - *common | ||
| - ui/** | ||
|
|
||
| tests: | ||
| name: Unit Tests | ||
| needs: [ changed-files ] | ||
| if: ${{ needs.changed-files.outputs.tests == 'true' }} | ||
| runs-on: ubuntu-latest | ||
| timeout-minutes: 10 | ||
| steps: | ||
|
|
@@ -59,7 +150,8 @@ jobs: | |
|
|
||
| e2e-tests: | ||
| name: E2E Tests | ||
| needs: [ argoexec-image ] | ||
| needs: [ changed-files, argoexec-image ] | ||
| if: ${{ needs.changed-files.outputs.e2e-tests == 'true' }} | ||
| runs-on: ubuntu-latest | ||
| timeout-minutes: 30 | ||
| env: | ||
|
|
@@ -198,9 +290,28 @@ jobs: | |
| if: ${{ failure() }} | ||
| run: kubectl logs -c wait -l workflows.argoproj.io/workflow --prefix | ||
|
|
||
| # workaround for status checks -- check this one job instead of each individual E2E job in the matrix | ||
| # this allows us to skip the entire matrix when it doesn't need to run while still having accurate status checks | ||
| # see https://github.com/orgs/community/discussions/9141#discussioncomment-2296809 and https://github.com/orgs/community/discussions/26822#discussioncomment-3305794 | ||
| e2e-tests-composite-result: | ||
|
agilgur5 marked this conversation as resolved.
|
||
| name: E2E Tests - Composite result | ||
| needs: [ e2e-tests ] | ||
| if: ${{ always() }} | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - run: | | ||
| result="${{ needs.e2e-tests.result }}" | ||
| # mark as successful even if skipped | ||
| if [[ $result == "success" || $result == "skipped" ]]; then | ||
| exit 0 | ||
| else | ||
| exit 1 | ||
| fi | ||
|
|
||
| codegen: | ||
| name: Codegen | ||
| needs: [ tests ] | ||
| needs: [ changed-files ] | ||
|
agilgur5 marked this conversation as resolved.
|
||
| if: ${{ needs.changed-files.outputs.codegen == 'true' }} | ||
| runs-on: ubuntu-latest | ||
| timeout-minutes: 20 | ||
| env: | ||
|
|
@@ -236,9 +347,10 @@ jobs: | |
|
|
||
| lint: | ||
| name: Lint | ||
| needs: [ tests, codegen ] | ||
| needs: [ changed-files ] | ||
| if: ${{ needs.changed-files.outputs.lint == 'true' }} | ||
| runs-on: ubuntu-latest | ||
| timeout-minutes: 15 # must be strictly greater than the timeout in .golancgi.yml | ||
| timeout-minutes: 15 # must be strictly greater than the timeout in .golangci.yml | ||
| env: | ||
| GOPATH: /home/runner/go | ||
| steps: | ||
|
|
@@ -254,6 +366,8 @@ jobs: | |
|
|
||
| ui: | ||
| name: UI | ||
| needs: [ changed-files ] | ||
| if: ${{ needs.changed-files.outputs.ui == 'true' }} | ||
| runs-on: ubuntu-latest | ||
| timeout-minutes: 6 | ||
| env: | ||
|
|
||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.