Skip to content
go-libfossil Artifact [88d6d52dec]
Login

Artifact [88d6d52dec]

Artifact 88d6d52decf08e2e651db3b183035a04723a650983d311a2076dd9efa0428e54:


name: Tests

on:
  push:
    branches: [main]
  pull_request:

jobs:
  test:
    name: Test (modernc)
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: actions/setup-go@v5
        with:
          go-version-file: go.mod
      - name: Install Fossil
        run: sudo apt-get update && sudo apt-get install -y fossil
      - name: Build all packages
        # Build every package, not just the cmd/libfossil dependency closure.
        # The `go test $(go list ./...)` step below silently drops any package
        # that fails to compile (go list omits it from stdout instead of
        # failing), so a broken import can vanish from the test run undetected.
        # Building `./...` first makes that a loud, fail-fast build error.
        run: GOWORK=off go build ./...
      - name: Unit tests
        # REQUIRE_FOSSIL_BIN turns "fossil is missing" into a failure rather
        # than an invisible skip. Verifying a real fossil reads what we write
        # is the one thing our own tests cannot substitute for.
        env:
          REQUIRE_FOSSIL_BIN: "1"
        run: GOWORK=off go test $(GOWORK=off go list ./... | grep -v '/dst') -count=1 -timeout=120s
      - name: DST
        run: GOWORK=off go test ./dst/... -count=1 -timeout=300s
      - name: Driver tests (modernc)
        run: cd db/driver/modernc && GOWORK=off go test ./... -count=1
      - name: Vet
        run: GOWORK=off go vet ./...

  test-ncruces:
    name: Test (ncruces)
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: actions/setup-go@v5
        with:
          go-version-file: go.mod
      - name: Install Fossil
        run: sudo apt-get update && sudo apt-get install -y fossil
      - name: Build all packages (ncruces)
        # Same fail-fast guard as the modernc leg, under the test_ncruces tag so
        # the ncruces driver's compile surface is covered too.
        run: GOWORK=off go build -tags test_ncruces ./...
      - name: Unit tests (ncruces)
        env:
          REQUIRE_FOSSIL_BIN: "1"
        run: GOWORK=off go test -tags test_ncruces $(GOWORK=off go list ./... | grep -v '/dst' | grep -v 'cmd/libfossil') -count=1 -timeout=120s
      - name: DST (ncruces)
        run: GOWORK=off go test -tags test_ncruces ./dst/... -count=1 -timeout=300s
      - name: Driver tests (ncruces)
        run: cd db/driver/ncruces && GOWORK=off go test ./... -count=1

  test-otel:
    name: Test (observer/otel)
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: actions/setup-go@v5
        with:
          go-version-file: go.mod
      - name: OTel sub-module tests
        run: cd observer/otel && GOWORK=off go test ./... -count=1