github.com/metacubex/quic-go@v0.44.1-0.20240520163451-20b689a59136/.github/workflows/unit.yml (about) 1 on: [push, pull_request] 2 3 4 jobs: 5 unit: 6 strategy: 7 fail-fast: false 8 matrix: 9 os: [ "ubuntu", "windows", "macos" ] 10 go: [ "1.21.x", "1.22.0-rc.2" ] 11 runs-on: ${{ fromJSON(vars[format('UNIT_RUNNER_{0}', matrix.os)] || format('"{0}-latest"', matrix.os)) }} 12 name: Unit tests (${{ matrix.os}}, Go ${{ matrix.go }}) 13 steps: 14 - uses: actions/checkout@v4 15 - uses: actions/setup-go@v5 16 with: 17 go-version: ${{ matrix.go }} 18 - run: go version 19 - name: Run tests 20 env: 21 TIMESCALE_FACTOR: 10 22 run: go run github.com/onsi/ginkgo/v2/ginkgo -r -v -cover -randomize-all -randomize-suites -trace -skip-package integrationtests 23 - name: Run tests as root 24 if: ${{ matrix.os == 'ubuntu' }} 25 env: 26 TIMESCALE_FACTOR: 10 27 FILE: sys_conn_helper_linux_test.go 28 run: | 29 test -f $FILE # make sure the file actually exists 30 go run github.com/onsi/ginkgo/v2/ginkgo build -cover -tags root . 31 sudo ./quic-go.test -ginkgo.v -ginkgo.trace -ginkgo.randomize-all -ginkgo.focus-file=$FILE -test.coverprofile coverage-root.txt 32 rm quic-go.test 33 - name: Run tests (32 bit) 34 if: ${{ matrix.os != 'macos' }} # can't run 32 bit tests on OSX. 35 env: 36 TIMESCALE_FACTOR: 10 37 GOARCH: 386 38 run: go run github.com/onsi/ginkgo/v2/ginkgo -r -v -cover -coverprofile coverage.txt -output-dir . -randomize-all -randomize-suites -trace -skip-package integrationtests 39 - name: Run tests with race detector 40 if: ${{ matrix.os == 'ubuntu' }} # speed things up. Windows and OSX VMs are slow 41 env: 42 TIMESCALE_FACTOR: 20 43 run: go run github.com/onsi/ginkgo/v2/ginkgo -r -v -race -randomize-all -randomize-suites -trace -skip-package integrationtests 44 - name: Run benchmark tests 45 run: go test -v -run=^$ -benchtime 0.5s -bench=. $(go list ./... | grep -v integrationtests/self) 46 - name: Upload coverage to Codecov 47 uses: codecov/codecov-action@v4 48 with: 49 files: coverage.txt,coverage-root.txt 50 env_vars: OS=${{ matrix.os }}, GO=${{ matrix.go }} 51 token: ${{ secrets.CODECOV_TOKEN }}