feat(build): trigger COPR RPM builds on release #119
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 App | |
| on: | |
| push: | |
| paths: | |
| - ".github/workflows/test-app.yml" | |
| - "cmd/**" | |
| - "internal/**" | |
| - "server/**" | |
| - "test/**" | |
| - "main.go" | |
| - "go.mod" | |
| - "go.sum" | |
| branches-ignore: ["release/*", "nightly"] | |
| tags-ignore: ["v*"] | |
| pull_request: | |
| paths: | |
| - ".github/workflows/test-app.yml" | |
| - "cmd/**" | |
| - "internal/**" | |
| - "server/**" | |
| - "test/**" | |
| - "main.go" | |
| - "go.mod" | |
| - "go.sum" | |
| branches-ignore: ["release/*", "nightly"] | |
| env: | |
| REPORT_DIR: "/tmp/test-reports" | |
| CGO_ENABLED: 0 | |
| permissions: | |
| contents: read | |
| concurrency: | |
| group: test-app-${{ github.event.pull_request.number || github.ref }} | |
| cancel-in-progress: true | |
| jobs: | |
| test_app: | |
| name: Test Go (${{ matrix.name }}) | |
| runs-on: ${{ matrix.runner }} | |
| timeout-minutes: 20 | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| - name: Linux AMD64 | |
| runner: ubuntu-24.04 | |
| artifact: linux-amd64 | |
| coverage: true | |
| - name: Linux ARM64 | |
| runner: ubuntu-24.04-arm | |
| artifact: linux-arm64 | |
| coverage: false | |
| - name: macOS | |
| runner: macos-latest | |
| artifact: macos | |
| coverage: false | |
| steps: | |
| - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 | |
| with: | |
| persist-credentials: false | |
| - name: Setup Go | |
| uses: actions/setup-go@b7ad1dad31e06c5925ef5d2fc7ad053ef454303e # v7.0.0 | |
| with: | |
| go-version-file: go.mod | |
| cache: false # https://github.com/actions/setup-go/issues/483 | |
| - id: go-vars | |
| name: Get Go variables for cache | |
| run: | | |
| echo "GOCACHE=$(go env GOCACHE)" >> "$GITHUB_OUTPUT" | |
| echo "GOMODCACHE=$(go env GOMODCACHE)" >> "$GITHUB_OUTPUT" | |
| - name: Cache go modules | |
| # v6.1.0; this test-only cache never feeds a publishing workflow. | |
| uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # zizmor: ignore[cache-poisoning] | |
| with: | |
| path: | | |
| ${{ steps.go-vars.outputs.GOCACHE }} | |
| ${{ steps.go-vars.outputs.GOMODCACHE }} | |
| key: go-test-${{ runner.os }}-${{ runner.arch }}-${{ hashFiles('go.sum') }} | |
| restore-keys: | | |
| go-test-${{ runner.os }}-${{ runner.arch }}- | |
| - name: Install tools | |
| run: go install gotest.tools/gotestsum@v1.13.0 | |
| - name: Download Go modules | |
| run: go mod download | |
| - name: Run vet | |
| run: go vet ./... | |
| - name: Run tests | |
| run: | | |
| mkdir -p "$REPORT_DIR" | |
| gotestsum \ | |
| --junitfile "$REPORT_DIR/unit-tests.xml" \ | |
| --jsonfile "$REPORT_DIR/unit-tests.json" \ | |
| -- -coverprofile="$REPORT_DIR/coverage.out" ./... | |
| - name: Upload test results | |
| if: ${{ !cancelled() }} | |
| uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 | |
| with: | |
| name: Go-Test-Results-${{ matrix.artifact }} | |
| path: ${{ env.REPORT_DIR }} | |
| - if: ${{ matrix.coverage && !cancelled() }} | |
| name: Upload coverage to Codecov | |
| uses: codecov/codecov-action@fb8b3582c8e4def4969c97caa2f19720cb33a72f # v7.0.0 | |
| with: | |
| flags: go | |
| file: ${{ env.REPORT_DIR }}/coverage.out | |
| token: ${{ secrets.CODECOV_TOKEN }} |