ci: retain the useful failure tail #3
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: | |
| push: | |
| pull_request: | |
| workflow_call: | |
| permissions: | |
| contents: read | |
| jobs: | |
| test: | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| os: [ubuntu-latest, macos-latest, windows-latest] | |
| go: ['1.25.x', '1.26.x'] | |
| runs-on: ${{ matrix.os }} | |
| steps: | |
| - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 | |
| - uses: actions/setup-go@b7ad1dad31e06c5925ef5d2fc7ad053ef454303e # v7.0.0 | |
| with: | |
| go-version: ${{ matrix.go }} | |
| - name: Test | |
| shell: bash | |
| run: | | |
| if ! test_output=$(go test -timeout 5m ./... 2>&1); then | |
| printf '%s\n' "$test_output" | |
| annotation=$(printf '%s\n' "$test_output" | tail -80) | |
| annotation=${annotation//'%'/'%25'} | |
| annotation=${annotation//$'\r'/'%0D'} | |
| annotation=${annotation//$'\n'/'%0A'} | |
| echo "::error title=go test failed::$annotation" | |
| exit 1 | |
| fi | |
| printf '%s\n' "$test_output" | |
| - run: go vet ./... | |
| - run: go test -race -timeout 5m ./... | |
| - run: go build ./cmd/ctxt | |
| analysis: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 | |
| - uses: actions/setup-go@b7ad1dad31e06c5925ef5d2fc7ad053ef454303e # v7.0.0 | |
| with: | |
| go-version: '1.26.x' | |
| - run: go install honnef.co/go/tools/cmd/staticcheck@v0.7.0 | |
| - run: staticcheck ./... | |
| - run: go install github.com/golangci/golangci-lint/v2/cmd/golangci-lint@v2.10.1 | |
| - run: golangci-lint run | |
| - run: go install golang.org/x/vuln/cmd/govulncheck@v1.1.4 | |
| - run: govulncheck ./... |