Vectrum
Sign In
45 lines · 932 Bytes
name: ci

on:
  push:
    branches: [main]
  pull_request:

permissions:
  contents: read

jobs:
  test:
    name: ${{ matrix.os }}
    strategy:
      # One platform failing says nothing about the other, and seeing both
      # at once is how a portability bug is told from a plain one.
      fail-fast: false
      matrix:
        os: [ubuntu-latest, macos-latest]
    runs-on: ${{ matrix.os }}
    steps:
      - uses: actions/checkout@v5

      - uses: actions/setup-go@v6
        with:
          go-version-file: go.mod

      - name: build
        run: go build ./...

      - name: vet
        run: go vet ./...

      - name: test
        run: go test ./...

      - name: gofmt
        if: runner.os == 'Linux'
        run: |
          unformatted=$(gofmt -l .)
          if [ -n "$unformatted" ]; then
            echo "These files are not gofmt-formatted:"
            echo "$unformatted"
            exit 1
          fi