Phase 1: idempotent index DDL script and EXPLAIN-plan red-to-green te… #290
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Go | |
| on: [push] | |
| jobs: | |
| build: | |
| name: Build | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Check out code | |
| uses: actions/checkout@v6.0.2 | |
| - name: Install tools | |
| run: | | |
| make install | |
| echo "PATH=$(go env GOPATH)/bin:$PATH" >> $GITHUB_ENV | |
| - name: Install buf | |
| run: | | |
| URL=$(curl -s https://api.github.com/repos/bufbuild/buf/releases/latest | jq -r '.assets[] | select(.name=="buf-Linux-x86_64") | .browser_download_url') | |
| curl -sSL "$URL" -o /usr/local/bin/buf | |
| chmod +x /usr/local/bin/buf | |
| - name: Regenerate files | |
| run: make generate | |
| - name: Tidy | |
| run: go mod tidy | |
| - name: Build | |
| run: go build -v ./... | |
| test: | |
| name: Test | |
| runs-on: ubuntu-latest | |
| services: | |
| mariadb: | |
| # Matches the forum's major version and testdb/compose.yaml. | |
| image: mariadb:11.5 | |
| env: | |
| # Throwaway credential for disposable fixture data; mirrored in | |
| # testdb/testdb.go and testdb/compose.yaml. | |
| MARIADB_ROOT_PASSWORD: harness | |
| ports: | |
| - 3310:3306 | |
| options: >- | |
| --health-cmd="healthcheck.sh --connect --innodb_initialized" | |
| --health-interval=5s | |
| --health-timeout=5s | |
| --health-retries=24 | |
| steps: | |
| - name: Check out code | |
| uses: actions/checkout@v6.0.2 | |
| # The service container is up for the whole job; this step is "no | |
| # harness" only in the sense that TESTDB_ADDR is left unset. | |
| - name: Test (TESTDB_ADDR unset — integration tests must skip) | |
| run: go test ./... | |
| # `go test ./...` prints identical output whether the integration | |
| # tests ran or all skipped, so env-wiring drift would silently turn | |
| # the harness suite into a no-op forever. Surface the ./testdb | |
| # verdicts verbosely and fail loudly on any skip before running the | |
| # full suite. | |
| - name: Test with MariaDB harness | |
| run: | | |
| set -euo pipefail | |
| go test -v ./testdb 2>&1 | tee testdb-harness.log | |
| if grep -q -- '--- SKIP' testdb-harness.log; then | |
| echo "::error::testdb integration tests skipped despite TESTDB_ADDR being set — env wiring has drifted and the harness suite degraded to a no-op" | |
| exit 1 | |
| fi | |
| go test ./... | |
| env: | |
| TESTDB_ADDR: 127.0.0.1:3310 | |
| lint: | |
| name: Lint | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Check out code | |
| uses: actions/checkout@v6.0.2 | |
| - name: Install tools | |
| run: make install | |
| - name: Install buf | |
| run: | | |
| URL=$(curl -s https://api.github.com/repos/bufbuild/buf/releases/latest | jq -r '.assets[] | select(.name=="buf-Linux-x86_64") | .browser_download_url') | |
| curl -sSL "$URL" -o /usr/local/bin/buf | |
| chmod +x /usr/local/bin/buf | |
| - name: Lint | |
| run: make lint |