🌱 Update github-actions group (major) #4612
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: Test Code | |
| # yamllint disable rule:line-length | |
| on: # yamllint disable-line rule:truthy | |
| workflow_dispatch: | |
| pull_request: | |
| types: [opened, edited, synchronize, reopened, ready_for_review] | |
| branches: | |
| - main | |
| - "releases/**" | |
| paths: | |
| - "**.go" | |
| - "**go.mod" | |
| - "**go.sum" | |
| - ".github/workflows/**" | |
| - "Makefile" | |
| - "images/builder/**" | |
| - "images/caph/**" | |
| push: | |
| branches: | |
| - main | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.event.after }} | |
| cancel-in-progress: true | |
| jobs: | |
| test: | |
| name: Test Code | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 10 | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # v6.0.0 | |
| - name: Coverage result name | |
| id: name | |
| run: | | |
| if [ ${{ github.event.pull_request }} ]; then | |
| NAME=pr-${{ github.event.pull_request.number }} | |
| else | |
| NAME=${{ github.sha }} | |
| fi | |
| echo name=${NAME} >> $GITHUB_OUTPUT | |
| - uses: actions/setup-go@4dc6199c7b1a012772edbd06daecab0f50c9053c # v6.1.0 | |
| with: | |
| go-version-file: "go.mod" | |
| - name: Install dependencies | |
| run: make gotestsum go-cover-treemap setup-envtest | |
| - name: Install go modules for test | |
| shell: bash | |
| run: | | |
| cd test && go mod download | |
| # Cache envtest binaries so we don't re-download from | |
| # https://github.com/kubernetes-sigs/controller-tools/releases/... | |
| # every run (helps avoid 503s). | |
| - name: Cache envtest binaries | |
| id: cache-envtest | |
| uses: actions/cache@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3 | |
| with: | |
| path: ~/.local/share/kubebuilder-envtest | |
| key: local-share-kubebuilder-envtest-${{ runner.os }} | |
| - name: Running tests | |
| run: make test-unit | |
| - name: Create Report | |
| run: make report-cover-html report-cover-treemap | |
| - name: Report Slowest tests | |
| run: hack/tools/bin/gotestsum tool slowest --num 10 --jsonfile .reports/go-test-output.json > .reports/slowest-tests.txt | |
| if: ${{ !cancelled() }} | |
| - name: Test Summary | |
| uses: test-summary/action@31493c76ec9e7aa675f1585d3ed6f1da69269a86 # v2.4 | |
| with: | |
| paths: ".coverage/junit.xml" | |
| - name: Check Release Manifests | |
| shell: bash | |
| run: | | |
| make release-manifests | |
| ./hack/check-release-manifests.sh | |
| - name: Upload Report | |
| uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2 | |
| if: ${{ !cancelled() }} | |
| with: | |
| name: reports-${{ steps.name.outputs.name }} | |
| path: .reports | |
| include-hidden-files: true | |
| retention-days: 30 |