diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 0e1fb6bf..385e49ca 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -13,71 +13,48 @@ concurrency: group: ${{ github.workflow }}-${{ github.ref }} cancel-in-progress: true -on: - push: - pull_request: +on: [push, pull_request] jobs: - - linux: - name: Test ${{ matrix.platform }} (${{ matrix.go }}) + ci: + name: ${{ matrix.platform }} (${{ matrix.go-version || 'oldest' }}) timeout-minutes: 10 strategy: fail-fast: false matrix: - go: ["1.18.x", "oldstable", "stable"] - platform: [ubuntu-24.04] - runs-on: ${{ matrix.platform }} - steps: - - name: Install Go ${{ matrix.go }} - uses: actions/setup-go@v5 - with: - go-version: ${{ matrix.go }} - - name: Setup IPv6 - run: sudo sysctl -w net.ipv6.conf.lo.disable_ipv6=0 net.ipv6.conf.default.disable_ipv6=0 net.ipv6.conf.all.disable_ipv6=0 - - name: Checkout code - uses: actions/checkout@v4 - - name: Build for ${{ matrix.platform }} - run: go build ./... - - name: Test - run: go test -exec sudo -v ./... + go-version: + - "" # do not specify go-version to fall back on go-version-file (use go.mod); see https://github.com/actions/setup-go/issues/450#issuecomment-3620402646 + - "oldstable" + - "stable" + platform: [ubuntu-24.04, windows-latest, macos-latest] + include: + - platform: ubuntu-24.04 + test-cmd: go test -exec sudo -v ./... + ipv6: true + - platform: windows-latest + test-cmd: go test -v ./... + ipv6: false + - platform: macos-latest + test-cmd: go test -v ./... + ipv6: false - other: - name: Test ${{ matrix.platform }} (${{ matrix.go }}) - timeout-minutes: 10 - strategy: - fail-fast: false - matrix: - go: ["1.18.x", "oldstable", "stable"] - platform: [windows-latest, macos-latest] runs-on: ${{ matrix.platform }} steps: - - name: Install Go ${{ matrix.go }} - uses: actions/setup-go@v5 - with: - go-version: ${{ matrix.go }} + - name: Setup IPv6 + if: matrix.ipv6 + run: sudo sysctl -w net.ipv6.conf.lo.disable_ipv6=0 net.ipv6.conf.default.disable_ipv6=0 net.ipv6.conf.all.disable_ipv6=0 - name: Checkout code - uses: actions/checkout@v4 - - name: Build for ${{ matrix.platform }} - run: go build ./... - - name: Test - run: go test -v ./... - - lint: - name: Lint ${{ matrix.platform }} - timeout-minutes: 10 - strategy: - fail-fast: false - matrix: - platform: [ubuntu-24.04, windows-latest, macos-latest] - runs-on: ${{ matrix.platform }} - steps: - - uses: actions/checkout@v4 - - uses: actions/setup-go@v5 + uses: actions/checkout@v6 + - name: Install Go ${{ matrix.go-version }} + uses: actions/setup-go@v6 with: - go-version: "stable" - cache: false - - name: golangci-lint - uses: golangci/golangci-lint-action@v7 + go-version: ${{ matrix.go-version }} + go-version-file: "go.mod" # used when go-version is not specified. + - name: Lint + uses: golangci/golangci-lint-action@v9 with: - args: --timeout=5m + args: --timeout=5m --verbose + - name: Build + run: go build ./... + - name: Test + run: ${{ matrix.test-cmd }}