-
Notifications
You must be signed in to change notification settings - Fork 559
ci: Split long-running tests to avoid running on irrelevant changes #2691
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
Open
another-rex
wants to merge
8
commits into
main
Choose a base branch
from
ci/split-tests-workflow-8490806669227208146
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
0c8192c
ci: split tests into separate workflow to avoid running on irrelevant…
google-labs-jules[bot] c6866cd
ci: split tests into separate workflow to avoid running on irrelevant…
google-labs-jules[bot] 59dce7c
ci: split tests into separate workflow to avoid running on irrelevant…
google-labs-jules[bot] 1c46134
ci: split tests into separate workflow to avoid running on irrelevant…
google-labs-jules[bot] cb13cbd
ci: split tests into separate workflow to avoid running on irrelevant…
google-labs-jules[bot] 730e193
ci: split tests into separate workflow to avoid running on irrelevant…
google-labs-jules[bot] c02fe52
Apply suggestion from @another-rex
another-rex e401e69
ci: split tests into separate workflow to avoid running on irrelevant…
google-labs-jules[bot] 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
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 |
|---|---|---|
| @@ -0,0 +1,138 @@ | ||
| # Copyright 2021 Google LLC | ||
| # | ||
| # Licensed under the Apache License, Version 2.0 (the "License"); | ||
| # you may not use this file except in compliance with the License. | ||
| # You may obtain a copy of the License at | ||
| # | ||
| # http://www.apache.org/licenses/LICENSE-2.0 | ||
| # | ||
| # Unless required by applicable law or agreed to in writing, software | ||
| # distributed under the License is distributed on an "AS IS" BASIS, | ||
| # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| # See the License for the specific language governing permissions and | ||
| # limitations under the License. | ||
|
|
||
| name: Tests | ||
|
|
||
| on: | ||
| push: | ||
| branches: ["main", "v1", "mcp"] | ||
| paths-ignore: | ||
| - "**/*.md" | ||
| - "docs/**" | ||
| - ".github/workflows/*" | ||
| - "!.github/workflows/tests.yml" | ||
| - "!.github/workflows/test-action/**" | ||
| pull_request: | ||
| # The branches below must be a subset of the branches above | ||
| branches: ["main", "v1", "mcp"] | ||
| paths-ignore: | ||
| - "**/*.md" | ||
| - "docs/**" | ||
| - ".github/workflows/*" | ||
| - "!.github/workflows/tests.yml" | ||
| - "!.github/workflows/test-action/**" | ||
| workflow_dispatch: | ||
|
|
||
| concurrency: | ||
| # Pushing new changes to a branch will cancel any in-progress CI runs | ||
| group: ${{ github.workflow }}-${{ github.ref }} | ||
| cancel-in-progress: true | ||
|
|
||
| # Restrict jobs in this workflow to have no permissions by default; permissions | ||
| # should be granted per job as needed using a dedicated `permissions` block | ||
| permissions: {} | ||
|
|
||
| jobs: | ||
| prepare_test_image_testdata: | ||
| permissions: | ||
| contents: read # to fetch code (actions/checkout) | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - name: Check out code | ||
| uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | ||
| with: | ||
| persist-credentials: false | ||
| - run: scripts/build_test_images.sh | ||
| - uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7.0.0 | ||
| with: | ||
| name: image-testdata-${{ github.run_number }}-${{ github.run_attempt }} | ||
| path: cmd/osv-scanner/scan/image/testdata/*.tar | ||
| retention-days: 1 | ||
| tests: | ||
| permissions: | ||
| contents: read # to fetch code (actions/checkout) | ||
| needs: | ||
| - prepare_test_image_testdata | ||
| name: Run unit tests | ||
| strategy: | ||
| fail-fast: false | ||
| matrix: | ||
| os: [ubuntu-latest, macos-latest, windows-latest] | ||
| runs-on: ${{ matrix.os }} | ||
| steps: | ||
| - name: Check out code | ||
| uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | ||
| with: | ||
| persist-credentials: false | ||
| - uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1 | ||
| with: | ||
| pattern: image-testdata-${{ github.run_number }}-* | ||
| path: cmd/osv-scanner/scan/image/testdata/ | ||
another-rex marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| - name: Set up Go | ||
| uses: actions/setup-go@4b73464bb391d4059bd26b0524d20df3927bd417 # v6.3.0 | ||
| with: | ||
| go-version-file: "go.mod" | ||
| check-latest: true | ||
| - name: Run test action | ||
| uses: ./.github/workflows/test-action | ||
| with: | ||
| codecov_token: ${{ secrets.CODECOV_TOKEN }} | ||
Check warningCode scanning / zizmor secrets referenced without a dedicated environment Warning test
secrets referenced without a dedicated environment
|
||
| docker: | ||
| permissions: | ||
| contents: read # to fetch code (actions/checkout) | ||
| runs-on: ubuntu-latest | ||
| env: | ||
| # Required for buildx on docker 19.x | ||
| DOCKER_CLI_EXPERIMENTAL: "enabled" | ||
| steps: | ||
| - name: Checkout | ||
| uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | ||
| with: | ||
| fetch-depth: 0 | ||
|
||
| persist-credentials: false | ||
| - name: Set up Go | ||
| uses: actions/setup-go@4b73464bb391d4059bd26b0524d20df3927bd417 # v6.3.0 | ||
|
||
| with: | ||
| go-version-file: "go.mod" | ||
| check-latest: true | ||
| cache: false | ||
| - uses: docker/setup-qemu-action@ce360397dd3f832beb865e1373c09c0e9f86d70a # v4.0.0 | ||
| - uses: docker/setup-buildx-action@4d04d5d9486b7bd6fa91e7baf45bbb4f8b9deedd # v4.0.0 | ||
| - name: Run GoReleaser | ||
| id: run-goreleaser | ||
| uses: goreleaser/goreleaser-action@ec59f474b9834571250b370d4735c50f8e2d1e29 # v7.0.0 | ||
| with: | ||
| distribution: goreleaser | ||
| version: "~> v2" | ||
| args: release --clean --snapshot | ||
| - env: | ||
| ARTIFACTS: ${{ steps.run-goreleaser.outputs.artifacts }} | ||
| run: | | ||
| echo "$ARTIFACTS" > output.json | ||
| jq -r '.[] | select( | ||
| .type == "Docker Image" and | ||
| .goarch == "amd64" and | ||
| .goos == "linux" and | ||
| .extra.DockerConfig.dockerfile == "goreleaser.dockerfile" | ||
| ) | .name' output.json | while read -r image; do | ||
| echo "Testing image $image" | ||
|
|
||
| exit_code=0 | ||
| docker run -v ${PWD}:/src $image -L /src/go.mod || exit_code=$? | ||
|
|
||
| # fail if we get a non-zero exit code other than "vulnerabilities were found" | ||
| if [[ $exit_code -ne 0 && $exit_code -ne 1 ]]; then | ||
| exit $exit_code | ||
| fi | ||
| done | ||
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
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
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
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
Oops, something went wrong.
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
merge-multiple: truemay help with the re-run failures?https://github.com/actions/download-artifact/blob/main/README.md#inputs
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
friendly ping on this comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done