Update go modules (main) (patch) #2198
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
| # Copyright The Conforma Contributors | |
| # | |
| # 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. | |
| # | |
| # SPDX-License-Identifier: Apache-2.0 | |
| --- | |
| name: Checks | |
| "on": | |
| pull_request: | |
| branches: | |
| - main | |
| - release-* | |
| push: | |
| branches: | |
| - main | |
| - release-* | |
| workflow_dispatch: | |
| permissions: | |
| contents: read | |
| jobs: | |
| Test: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Harden Runner | |
| uses: step-security/harden-runner@20cf305ff2072d973412fa9b1e3a4f227bda3c76 # v2.14.0 | |
| with: | |
| egress-policy: audit | |
| disable-telemetry: true | |
| - name: Checkout repository | |
| uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1 | |
| with: | |
| # Needed in hack/derive-version.sh | |
| fetch-depth: 0 | |
| - name: Restore Cache | |
| uses: actions/cache/restore@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.3.0 | |
| with: | |
| key: main | |
| path: '**' | |
| - name: Setup Go environment | |
| uses: actions/setup-go@40f1582b2485089dde7abd97c1529aa768e1baff # v5.6.0 | |
| with: | |
| go-version-file: go.mod | |
| cache: false | |
| - name: Check go versions | |
| uses: conforma/github-workflows/golang-version-check@main | |
| - name: Show git sha and commit subject | |
| run: git log --oneline -n1 | |
| - name: Generate | |
| run: make generate | |
| # Possibly useful for debugging if the next step produces an error | |
| - name: Show diff after `make generate` | |
| run: git diff --stat --patch | |
| - name: Check for uncommitted changes | |
| run: | | |
| if ! git diff --exit-code -s; then | |
| for f in $(git diff --exit-code --name-only); do | |
| echo "::error file=$f,line=1,col=1,endColumn=1::File was modified in build" | |
| done | |
| exit 1 | |
| fi | |
| - name: Test | |
| run: make test | |
| - name: Upload test coverage artifacts | |
| uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.0 | |
| with: | |
| name: coverage-test | |
| path: | | |
| ./coverage-unit.out | |
| ./coverage-generative.out | |
| ./coverage-integration.out | |
| retention-days: 1 | |
| Acceptance: | |
| runs-on: ubuntu-latest | |
| steps: | |
| # Disabled until we figure out the "Could not resolve host: github.com" in | |
| # acceptance tests | |
| # - name: Harden Runner | |
| # uses: step-security/harden-runner@4d991eb9b905ef189e4c376166672c3f2f230481 # v2.11.0 | |
| # with: | |
| # egress-policy: audit | |
| # disable-telemetry: true | |
| - name: Checkout repository | |
| uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1 | |
| - name: Restore Cache | |
| uses: actions/cache/restore@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.3.0 | |
| with: | |
| key: main | |
| path: '**' | |
| - name: Setup Go environment | |
| uses: actions/setup-go@40f1582b2485089dde7abd97c1529aa768e1baff # v5.6.0 | |
| with: | |
| go-version-file: go.mod | |
| cache: false | |
| - name: Update podman | |
| run: | | |
| "${GITHUB_WORKSPACE}/hack/ubuntu-podman-update.sh" | |
| - name: Show git sha and commit subject | |
| run: git log --oneline -n1 | |
| - name: Acceptance test | |
| id: acceptance_test | |
| run: E2E_INSTRUMENTATION=true make acceptance | |
| - name: Upload acceptance coverage artifact | |
| uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.0 | |
| with: | |
| name: coverage-acceptance | |
| path: ./coverage-acceptance.out | |
| retention-days: 1 | |
| Upload: | |
| name: "Upload Coverage Statistics" | |
| runs-on: ubuntu-latest | |
| needs: [Test, Acceptance] | |
| steps: | |
| - name: Harden Runner | |
| uses: step-security/harden-runner@20cf305ff2072d973412fa9b1e3a4f227bda3c76 # v2.14.0 | |
| with: | |
| egress-policy: audit | |
| disable-telemetry: true | |
| # checkout is required for codecov to map the coverage data back to files in the repo | |
| - name: Checkout repository | |
| uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1 | |
| with: | |
| fetch-depth: 0 | |
| - name: Download test coverage artifacts | |
| uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8 | |
| with: | |
| name: coverage-test | |
| path: ./coverage | |
| - name: Download acceptance coverage artifact | |
| uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8 | |
| with: | |
| name: coverage-acceptance | |
| path: ./coverage | |
| - name: Upload unit test coverage report | |
| uses: codecov/codecov-action@671740ac38dd9b0130fbe1cec585b89eea48d3de # v5.5.2 | |
| env: | |
| CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} | |
| with: | |
| files: ./coverage/coverage-unit.out | |
| disable_search: true | |
| flags: unit | |
| - name: Upload generative test coverage report | |
| uses: codecov/codecov-action@671740ac38dd9b0130fbe1cec585b89eea48d3de # v5.5.2 | |
| env: | |
| CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} | |
| with: | |
| files: ./coverage/coverage-generative.out | |
| disable_search: true | |
| flags: generative | |
| - name: Upload integration test coverage report | |
| uses: codecov/codecov-action@671740ac38dd9b0130fbe1cec585b89eea48d3de # v5.5.2 | |
| env: | |
| CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} | |
| with: | |
| files: ./coverage/coverage-integration.out | |
| disable_search: true | |
| flags: integration | |
| - name: Upload acceptance test coverage report | |
| uses: codecov/codecov-action@671740ac38dd9b0130fbe1cec585b89eea48d3de # v5.5.2 | |
| env: | |
| CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} | |
| with: | |
| files: ./coverage/coverage-acceptance.out | |
| disable_search: true | |
| flags: acceptance | |
| Tools: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1 | |
| - name: Restore Cache | |
| uses: actions/cache/restore@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.3.0 | |
| with: | |
| key: main | |
| path: '**' | |
| - name: Setup Go environment | |
| uses: actions/setup-go@40f1582b2485089dde7abd97c1529aa768e1baff # v5.6.0 | |
| with: | |
| go-version-file: go.mod | |
| cache: false | |
| - name: Development tools can be run | |
| run: | | |
| go run -modfile tools/go.mod github.com/tektoncd/cli/cmd/tkn version | |
| go run -modfile tools/go.mod sigs.k8s.io/kustomize/kustomize/v5 version | |
| go run -modfile tools/go.mod helm.sh/helm/v3/cmd/helm version | |
| go run -modfile tools/go.mod github.com/open-policy-agent/conftest --version |