name: Test on: push: branches: [ 'main' ] paths: - '**.go' - '**.mod' - '**.wasm' - '**.yml' pull_request: branches: [ 'main' ] paths: - '**.go' - '**.mod' - '**.wasm' - '**.yml' workflow_dispatch: permissions: contents: read jobs: test: strategy: matrix: os: [macos-latest, ubuntu-latest, windows-latest] runs-on: ${{ matrix.os }} permissions: contents: write steps: - uses: actions/checkout@v5 - uses: actions/setup-go@v6 with: { go-version: stable } - name: Format run: gofmt -s -w . && git diff --exit-code if: matrix.os != 'windows-latest' - name: Tidy run: go mod tidy && git diff --exit-code - name: Download run: go mod download - name: Verify run: go mod verify - name: Vet run: go vet ./... - name: Build run: go build ./... - name: Test run: go test ./... -bench . -benchtime=1x - name: Test BSD locks run: go test -tags sqlite3_flock ./... if: matrix.os != 'windows-latest' - name: Test dot locks run: go test -tags sqlite3_dotlk ./... if: matrix.os != 'windows-latest' - name: Test modules shell: bash run: | go work init . go work use -r embed gormlite go test ./embed/bcw2/... - name: Test GORM shell: bash run: gormlite/test.sh if: matrix.os == 'ubuntu-latest' - name: Collect coverage run: | go get -tool github.com/dave/courtney@v0.4.4 go tool courtney if: | github.event_name == 'push' && matrix.os == 'ubuntu-latest' - uses: ncruces/go-coverage-report@v0 with: coverage-file: coverage.out chart: true amend: true if: | github.event_name == 'push' && matrix.os == 'ubuntu-latest' test-bsd: strategy: matrix: os: - name: freebsd version: '14.3' - name: netbsd version: '10.1' - name: freebsd arch: arm64 version: '14.3' tflags: '-test.short' - name: netbsd arch: arm64 version: '10.1' tflags: '-test.short' - name: openbsd version: '7.8' tflags: '-test.short' runs-on: ubuntu-latest needs: test steps: - uses: actions/checkout@v5 - name: Build env: GOOS: ${{ matrix.os.name }} GOARCH: ${{ matrix.os.arch }} TESTFLAGS: ${{ matrix.os.tflags }} run: .github/workflows/build-test.sh - name: Test uses: cross-platform-actions/action@v0.30.0 with: operating_system: ${{ matrix.os.name }} architecture: ${{ matrix.os.arch }} version: ${{ matrix.os.version }} shell: bash run: . ./test.sh sync_files: runner-to-vm test-vm: strategy: matrix: os: - name: dragonfly action: 'vmactions/dragonflybsd-vm@v1' - name: illumos action: 'vmactions/omnios-vm@v1' - name: solaris action: 'vmactions/solaris-vm@v1' bflags: '-tags sqlite3_dotlk' runs-on: ubuntu-latest needs: test steps: - uses: actions/checkout@v5 - name: Build env: GOOS: ${{ matrix.os.name }} BUILDFLAGS: ${{ matrix.os.bflags }} TESTFLAGS: ${{ matrix.os.tflags }} VMACTIONS: ${{ matrix.os.action }} run: .github/workflows/build-test.sh - name: Test uses: ./.github/actions/vmactions test-wasip1: runs-on: ubuntu-latest needs: test steps: - uses: bytecodealliance/actions/wasmtime/setup@v1 - uses: actions/checkout@v5 - uses: actions/setup-go@v6 with: { go-version: stable } - name: Set path run: echo "$(go env GOROOT)/lib/wasm" >> "$GITHUB_PATH" - name: Test wasmtime env: GOOS: wasip1 GOARCH: wasm GOWASIRUNTIME: wasmtime GOWASIRUNTIMEARGS: '--env CI=true' run: go test -short -tags sqlite3_dotlk -skip Example ./... test-qemu: runs-on: ubuntu-latest needs: test steps: - uses: docker/setup-qemu-action@v3 - uses: actions/checkout@v5 - uses: actions/setup-go@v6 with: { go-version: stable } - name: Test 386 (32-bit) run: GOARCH=386 go test -short ./... - name: Test riscv64 (interpreter) run: GOARCH=riscv64 go test -short ./... - name: Test ppc64le (interpreter) run: GOARCH=ppc64le go test -short ./... - name: Test loong64 (interpreter) run: GOARCH=loong64 go test -short ./... - name: Test s390x (big-endian) run: GOARCH=s390x go test -short -tags sqlite3_dotlk ./... test-linuxarm: runs-on: ubuntu-24.04-arm needs: test steps: - uses: actions/checkout@v5 - uses: actions/setup-go@v6 with: { go-version: stable } - name: Test run: go test ./... - name: Test arm (32-bit) run: GOARCH=arm GOARM=7 go test -short ./... test-macintel: runs-on: macos-15-intel needs: test steps: - uses: actions/checkout@v5 - uses: actions/setup-go@v6 with: { go-version: stable } - name: Test run: go test ./... test-winarm: runs-on: windows-11-arm needs: test steps: - uses: actions/checkout@v5 - uses: actions/setup-go@v6 with: { go-version: stable } - name: Test run: go test ./...