chore(deps): bump golang in the ci group (#562) #1401
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: Go | |
| on: | |
| push: | |
| branches: [ main ] | |
| pull_request: | |
| branches: [ main ] | |
| permissions: | |
| contents: read | |
| jobs: | |
| build-and-test: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - name: Set up Go | |
| uses: actions/setup-go@v6 | |
| with: | |
| go-version-file: 'go.mod' | |
| - name: Build without cgo | |
| run: CGO_ENABLED=0 go build -v ./... | |
| - name: Build with cgo | |
| run: CGO_ENABLED=1 go build -v ./... | |
| - name: Make coverage dirs | |
| run: mkdir -p /tmp/unit_coverage /tmp/e2e_coverage | |
| - name: Disable AppArmor unprivileged user namespaces limitations | |
| # https://chromium.googlesource.com/chromium/src/+/main/docs/security/apparmor-userns-restrictions.md | |
| run: echo 0 | sudo tee /proc/sys/kernel/apparmor_restrict_unprivileged_userns | |
| - name: Test | |
| run: go test -v -p=12 -race -cover -covermode=atomic -coverpkg=./... $(go list ./... | grep -v /e2e/test/) -args -test.gocoverdir=/tmp/unit_coverage | |
| - name: E2E Test | |
| run: go test -v -p=12 -race -cover -covermode=atomic -coverpkg=./... $(go list ./e2e/test/...) -args -test.gocoverdir=/tmp/e2e_coverage | |
| - name: Convert coverage reports | |
| run: | | |
| go tool covdata textfmt -i /tmp/unit_coverage/ -o unit_coverage.txt | |
| go tool covdata textfmt -i /tmp/e2e_coverage/ -o e2e_coverage.txt | |
| - name: Upload coverage reports to Codecov (unittests) | |
| uses: codecov/codecov-action@671740ac38dd9b0130fbe1cec585b89eea48d3de #v5.5.2 | |
| continue-on-error: true | |
| with: | |
| flags: unittests | |
| files: ./unit_coverage.txt | |
| disable_search: true | |
| token: ${{ secrets.CODECOV_TOKEN }} | |
| - name: Upload coverage reports to Codecov (e2e tests) | |
| uses: codecov/codecov-action@671740ac38dd9b0130fbe1cec585b89eea48d3de #v5.5.2 | |
| continue-on-error: true | |
| with: | |
| flags: e2etests | |
| files: ./e2e_coverage.txt | |
| disable_search: true | |
| token: ${{ secrets.CODECOV_TOKEN }} | |
| - name: Goroutine leak detector | |
| run: go test -c -o tests && for test in $(go test -list . | grep -E "^(Test|Example)"); do ./tests -test.run "^$test\$" &>/dev/null && echo -e "$test passed\n" || echo -e "$test failed\n"; done | |
| cross-build: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - name: Set up Go | |
| uses: actions/setup-go@v6 | |
| with: | |
| go-version-file: 'go.mod' | |
| - uses: mlugg/setup-zig@d1434d08867e3ee9daa34448df10607b98908d29 # v2.2.1 | |
| - name: Build for Windows | |
| run: CC="zig cc -lc -target x86_64-windows" CXX="zig c++ -lc -target x86_64-windows" CGO_ENABLED=1 GOOS=windows GOARCH=amd64 go build -v ./... | |
| - name: Build for Windows (cgo disabled) | |
| run: CGO_ENABLED=0 GOOS=windows GOARCH=amd64 go build -v ./... | |
| - name: Build for linux/arm64 (cgo) | |
| run: CGO_ENABLED=1 CC="zig cc -lc -target aarch64-linux-musl" CXX="zig c++ -lc -target aarch64-linux-musl" GOOS=linux GOARCH=arm64 go build -v ./... | |
| - name: Build for linux/arm64 (cgo disabled) | |
| run: CGO_ENABLED=0 GOOS=linux GOARCH=arm64 go build -v ./... |