feat: add async update checker for new vet releases #1577
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
| name: CI | |
| on: | |
| pull_request: | |
| branches: | |
| - main | |
| push: | |
| branches: | |
| - main | |
| permissions: | |
| contents: read | |
| jobs: | |
| check-generated-code: | |
| timeout-minutes: 10 | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout Source | |
| uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4 | |
| - name: Set up Go | |
| uses: actions/setup-go@0aaccfd150d50ccaeb58ebd88d36e91967a5f35b # v5 | |
| with: | |
| go-version-file: go.mod | |
| - name: Run code generation | |
| run: make generate | |
| - name: Check for uncommitted changes in generated code | |
| run: | | |
| if [[ -n $(git status --porcelain -- ent/ pkg/analyzer/filterv2/) ]]; then | |
| echo "ERROR: Generated code is out of sync!" | |
| echo "Please run 'make generate' and commit the changes." | |
| echo "" | |
| echo "Files with changes:" | |
| git status --porcelain -- ent/ pkg/analyzer/filterv2/ | |
| echo "" | |
| echo "Diff:" | |
| git diff -- ent/ pkg/analyzer/filterv2/ | |
| exit 1 | |
| fi | |
| - name: Validate xBOM signatures | |
| run: go run . code validate | |
| run-test: | |
| timeout-minutes: 15 | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout Source | |
| uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4 | |
| - name: Set up Go | |
| uses: actions/setup-go@0aaccfd150d50ccaeb58ebd88d36e91967a5f35b # v5 | |
| with: | |
| go-version-file: go.mod | |
| - name: Install gotestsum | |
| run: go install gotest.tools/gotestsum@latest | |
| - name: Build and Test | |
| run: | | |
| go mod tidy | |
| go build | |
| gotestsum --format github-actions -- -coverprofile=coverage.txt ./... | |
| env: | |
| VET_E2E: true | |
| # Used to avoid rate limiting issue while running | |
| # test suites that use GitHub API | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Upload Coverage | |
| if: (github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository) || github.event_name == 'push' | |
| uses: codecov/codecov-action@0565863a31f2c772f9f0395002a31e3f06189574 # v5 | |
| with: | |
| token: ${{ secrets.CODECOV_TOKEN }} | |
| run-e2e: | |
| timeout-minutes: 30 | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout Source | |
| uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4 | |
| - name: Set up Go | |
| uses: actions/setup-go@0aaccfd150d50ccaeb58ebd88d36e91967a5f35b # v5 | |
| with: | |
| go-version-file: go.mod | |
| check-latest: true | |
| - name: Build vet | |
| run: | | |
| go mod tidy | |
| go build | |
| - name: Run E2E Scenarios | |
| run: | | |
| ./test/scenarios/all.sh | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Run E2E Scenarios with Insights V2 | |
| if: github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository | |
| run: | | |
| ./test/scenarios/all.sh | |
| env: | |
| E2E_INSIGHTS_V2: true | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| # This will not be available when there is a PR from a forked repository | |
| VET_API_KEY: ${{ secrets.SAFEDEP_CLOUD_API_KEY }} | |
| VET_CONTROL_TOWER_TENANT_ID: ${{ secrets.SAFEDEP_CLOUD_TENANT_DOMAIN }} | |
| # Free tier keys, used in e2e test scenerio 15 | |
| VET_API_KEY_FREE: ${{ secrets.SAFEDEP_CLOUD_API_KEY_FREE }} | |
| VET_CONTROL_TOWER_TENANT_ID_FREE: ${{ secrets.SAFEDEP_CLOUD_TENANT_DOMAIN_FREE }} | |
| build-container-test: | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 15 | |
| steps: | |
| - name: Checkout Source | |
| uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4 | |
| - name: Setup QEMU | |
| uses: docker/setup-qemu-action@29109295f81e9208d7d86ff1c6c12d2833863392 # v3 | |
| - name: Setup Docker Buildx | |
| uses: docker/setup-buildx-action@b5ca514318bd6ebac0fb2aedd5d36ec1b5c232a2 # v3 | |
| - name: Build Multi-Platform Container Image (verification only) | |
| run: | | |
| docker buildx build --platform linux/amd64,linux/arm64 \ | |
| -t build-container-test:latest . | |
| - name: Build and Load Native Platform Image for Testing | |
| run: | | |
| docker buildx build --platform linux/amd64 --load \ | |
| -t build-container-test:latest . | |
| - name: Test Container Image | |
| if: github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository | |
| run: | | |
| docker run --rm \ | |
| -e VET_API_KEY=${{ secrets.SAFEDEP_CLOUD_API_KEY }} \ | |
| -e VET_CONTROL_TOWER_TENANT_ID=${{ secrets.SAFEDEP_CLOUD_TENANT_DOMAIN }} \ | |
| build-container-test:latest \ | |
| auth verify |