Skip to content

fix: improve error messages for missing database tables #9517

fix: improve error messages for missing database tables

fix: improve error messages for missing database tables #9517

Workflow file for this run

---
name: "Build & Test"
on: # yamllint disable-line rule:truthy
push:
branches:
- "main"
pull_request:
branches:
- "*"
merge_group:
types:
- "checks_requested"
permissions:
contents: "read"
env:
DOCKERHUB_PUBLIC_ACCESS_TOKEN: "dckr_pat_8AEETZWxu8f7FvJUk9NrpyX_ZEQ"
DOCKERHUB_PUBLIC_USER: "spicedbgithubactions"
jobs:
paths-filter:
runs-on: "depot-ubuntu-24.04-small"
outputs:
codechange: "${{ steps.code-filter.outputs.codechange }}"
protochange: "${{ steps.proto-filter.outputs.protochange }}"
steps:
- uses: "actions/checkout@ff7abcd0c3c05ccf6adc123a8cd1fd4fb30fb493" # v4.2.2
- uses: "dorny/paths-filter@de90cc6fb38fc0963ad72b210f1f284cd68cea36" # v3.0.2
id: "code-filter"
with:
filters: |
codechange:
- ".github/workflows/build-test.yaml"
- "Dockerfile"
- "go.mod"
- "go.sum"
- "cmd/**"
- "pkg/**"
- "e2e/**"
- "internal/**"
- uses: "dorny/paths-filter@de90cc6fb38fc0963ad72b210f1f284cd68cea36" # v3.0.2
id: "proto-filter"
with:
filters: |
protochange:
- "buf.gen.yaml"
- "buf.work.yaml"
- "proto/**"
- "go.mod"
build:
name: "Build Binary & Image"
runs-on: "depot-ubuntu-24.04-4"
needs: "paths-filter"
if: |
needs.paths-filter.outputs.codechange == 'true'
steps:
- uses: "actions/checkout@ff7abcd0c3c05ccf6adc123a8cd1fd4fb30fb493" # v4.2.2
- uses: "authzed/actions/setup-go@6cde6aeb82fab36d8383c2f55bed8128955af34d" # main
- uses: "docker/login-action@5e57cd118135c172c3672efd75eb46360885c0ef" # v3.6.0
with:
username: "${{ env.DOCKERHUB_PUBLIC_USER }}"
password: "${{ env.DOCKERHUB_PUBLIC_ACCESS_TOKEN }}"
- uses: "authzed/actions/go-build@70432bd54a9e690d7fe19817dda46d8e4c0a2c3a" # main
with:
ldflags: "-checklinkname=0"
- name: "Image tests"
run: "go run mage.go test:image"
unit:
name: "Unit"
runs-on: "depot-ubuntu-24.04-4"
needs: "paths-filter"
if: |
needs.paths-filter.outputs.codechange == 'true'
steps:
- uses: "actions/checkout@ff7abcd0c3c05ccf6adc123a8cd1fd4fb30fb493" # v4.2.2
- uses: "authzed/actions/setup-go@6cde6aeb82fab36d8383c2f55bed8128955af34d" # main
- name: "Unit tests with coverage"
run: "go run mage.go test:unitCover"
- name: "Coverage"
uses: "codecov/codecov-action@5a1091511ad55cbe89839c7260b706298ca349f7" # v5.5.1
with:
files: "./coverage.txt"
token: "${{ secrets.CODECOV_TOKEN }}"
fail_ci_if_error: false
steelthread:
name: "Steelthread"
runs-on: "depot-ubuntu-24.04-4"
needs: "paths-filter"
if: |
needs.paths-filter.outputs.codechange == 'true'
steps:
- uses: "actions/checkout@ff7abcd0c3c05ccf6adc123a8cd1fd4fb30fb493" # v4.2.2
- uses: "authzed/actions/setup-go@6cde6aeb82fab36d8383c2f55bed8128955af34d" # main
- name: "Steelthread tests"
run: "go run mage.go test:steelthread"
integration:
name: "Integration Tests"
runs-on: "depot-ubuntu-24.04-4"
needs: "paths-filter"
if: |
needs.paths-filter.outputs.codechange == 'true'
steps:
- uses: "actions/checkout@ff7abcd0c3c05ccf6adc123a8cd1fd4fb30fb493" # v4.2.2
- uses: "authzed/actions/setup-go@6cde6aeb82fab36d8383c2f55bed8128955af34d" # main
- uses: "docker/login-action@5e57cd118135c172c3672efd75eb46360885c0ef" # v3.6.0
with:
username: "${{ env.DOCKERHUB_PUBLIC_USER }}"
password: "${{ env.DOCKERHUB_PUBLIC_ACCESS_TOKEN }}"
- name: "Integration tests with coverage"
run: "go run mage.go test:integrationCover"
- name: "Coverage"
uses: "codecov/codecov-action@5a1091511ad55cbe89839c7260b706298ca349f7" # v5.5.1
with:
files: "./coverage.txt"
token: "${{ secrets.CODECOV_TOKEN }}"
fail_ci_if_error: false
datastoreinttest:
name: "Datastore Integration Tests"
runs-on: "depot-ubuntu-24.04-8"
needs: "paths-filter"
strategy:
fail-fast: false
matrix:
datastore: ["mysql", "spanner"]
steps:
- uses: "actions/checkout@ff7abcd0c3c05ccf6adc123a8cd1fd4fb30fb493" # v4.2.2
if: |
needs.paths-filter.outputs.codechange == 'true'
- uses: "authzed/actions/setup-go@6cde6aeb82fab36d8383c2f55bed8128955af34d" # main
if: |
needs.paths-filter.outputs.codechange == 'true'
- uses: "docker/login-action@5e57cd118135c172c3672efd75eb46360885c0ef" # v3.6.0
if: |
needs.paths-filter.outputs.codechange == 'true'
with:
username: "${{ env.DOCKERHUB_PUBLIC_USER }}"
password: "${{ env.DOCKERHUB_PUBLIC_ACCESS_TOKEN }}"
- name: "Integration tests"
if: |
needs.paths-filter.outputs.codechange == 'true'
run: "go run mage.go testds:${{ matrix.datastore }}"
- name: "Coverage"
if: |
needs.paths-filter.outputs.codechange == 'true'
uses: "codecov/codecov-action@5a1091511ad55cbe89839c7260b706298ca349f7" # v5.5.1
with:
files: "./coverage.txt"
token: "${{ secrets.CODECOV_TOKEN }}"
fail_ci_if_error: false
datastoreconstest:
name: "Datastore Consistency Tests"
runs-on: "depot-ubuntu-24.04-8"
needs: "paths-filter"
strategy:
fail-fast: false
matrix:
datastore: ["mysql", "spanner"]
steps:
- uses: "actions/checkout@ff7abcd0c3c05ccf6adc123a8cd1fd4fb30fb493" # v4.2.2
if: |
needs.paths-filter.outputs.codechange == 'true'
- uses: "authzed/actions/setup-go@6cde6aeb82fab36d8383c2f55bed8128955af34d" # main
if: |
needs.paths-filter.outputs.codechange == 'true'
- uses: "docker/login-action@5e57cd118135c172c3672efd75eb46360885c0ef" # v3.6.0
if: |
needs.paths-filter.outputs.codechange == 'true'
with:
username: "${{ env.DOCKERHUB_PUBLIC_USER }}"
password: "${{ env.DOCKERHUB_PUBLIC_ACCESS_TOKEN }}"
- name: "Consistency tests"
if: |
needs.paths-filter.outputs.codechange == 'true'
run: "go run mage.go testcons:${{ matrix.datastore }}"
- name: "Coverage"
if: |
needs.paths-filter.outputs.codechange == 'true'
uses: "codecov/codecov-action@5a1091511ad55cbe89839c7260b706298ca349f7" # v5.5.1
with:
files: "./coverage.txt"
token: "${{ secrets.CODECOV_TOKEN }}"
fail_ci_if_error: false
pgdatastoreinttest:
name: "Datastore Integration Tests"
runs-on: "depot-ubuntu-24.04-4"
needs: "paths-filter"
strategy:
fail-fast: false
matrix:
datastore: ["postgres", "pgbouncer"]
pgversion: ["13.8", "14", "15", "16", "17"]
steps:
- uses: "actions/checkout@ff7abcd0c3c05ccf6adc123a8cd1fd4fb30fb493" # v4.2.2
if: |
needs.paths-filter.outputs.codechange == 'true'
- uses: "authzed/actions/setup-go@6cde6aeb82fab36d8383c2f55bed8128955af34d" # main
if: |
needs.paths-filter.outputs.codechange == 'true'
- uses: "docker/login-action@5e57cd118135c172c3672efd75eb46360885c0ef" # v3.6.0
if: |
needs.paths-filter.outputs.codechange == 'true'
with:
username: "${{ env.DOCKERHUB_PUBLIC_USER }}"
password: "${{ env.DOCKERHUB_PUBLIC_ACCESS_TOKEN }}"
- name: "Integration tests"
if: |
needs.paths-filter.outputs.codechange == 'true'
run: "go run mage.go testds:${{ matrix.datastore }}ver ${{ matrix.pgversion }}"
- name: "Coverage"
if: |
needs.paths-filter.outputs.codechange == 'true'
uses: "codecov/codecov-action@5a1091511ad55cbe89839c7260b706298ca349f7" # v5.5.1
with:
files: "./coverage.txt"
token: "${{ secrets.CODECOV_TOKEN }}"
fail_ci_if_error: false
pgdatastoreconstest:
name: "Datastore Consistency Tests"
runs-on: "depot-ubuntu-24.04-4"
needs: "paths-filter"
strategy:
fail-fast: false
matrix:
datastore: ["postgres"]
pgversion: ["13.8", "14", "15", "16", "17"]
steps:
- uses: "actions/checkout@ff7abcd0c3c05ccf6adc123a8cd1fd4fb30fb493" # v4.2.2
if: |
needs.paths-filter.outputs.codechange == 'true'
- uses: "authzed/actions/setup-go@6cde6aeb82fab36d8383c2f55bed8128955af34d" # main
if: |
needs.paths-filter.outputs.codechange == 'true'
- uses: "docker/login-action@5e57cd118135c172c3672efd75eb46360885c0ef" # v3.6.0
if: |
needs.paths-filter.outputs.codechange == 'true'
with:
username: "${{ env.DOCKERHUB_PUBLIC_USER }}"
password: "${{ env.DOCKERHUB_PUBLIC_ACCESS_TOKEN }}"
- name: "Consistency tests"
if: |
needs.paths-filter.outputs.codechange == 'true'
run: "go run mage.go testcons:postgresver ${{ matrix.pgversion }}"
- name: "Coverage"
if: |
needs.paths-filter.outputs.codechange == 'true'
uses: "codecov/codecov-action@5a1091511ad55cbe89839c7260b706298ca349f7" # v5.5.1
with:
files: "./coverage.txt"
token: "${{ secrets.CODECOV_TOKEN }}"
fail_ci_if_error: false
crdbdatastoreinttest:
name: "Datastore Integration Tests"
runs-on: "depot-ubuntu-24.04-4"
needs: "paths-filter"
strategy:
fail-fast: false
matrix:
datastore: ["crdb"]
crdbversion: ["25.2.0", "25.3.0"]
steps:
- uses: "actions/checkout@ff7abcd0c3c05ccf6adc123a8cd1fd4fb30fb493" # v4.2.2
if: |
needs.paths-filter.outputs.codechange == 'true'
- uses: "authzed/actions/setup-go@6cde6aeb82fab36d8383c2f55bed8128955af34d" # main
if: |
needs.paths-filter.outputs.codechange == 'true'
- uses: "docker/login-action@5e57cd118135c172c3672efd75eb46360885c0ef" # v3.6.0
if: |
needs.paths-filter.outputs.codechange == 'true'
with:
username: "${{ env.DOCKERHUB_PUBLIC_USER }}"
password: "${{ env.DOCKERHUB_PUBLIC_ACCESS_TOKEN }}"
- name: "Integration tests"
if: |
needs.paths-filter.outputs.codechange == 'true'
run: "go run mage.go testds:${{ matrix.datastore }}ver ${{ matrix.crdbversion }}"
- name: "Coverage"
if: |
needs.paths-filter.outputs.codechange == 'true'
uses: "codecov/codecov-action@5a1091511ad55cbe89839c7260b706298ca349f7" # v5.5.1
with:
files: "./coverage.txt"
token: "${{ secrets.CODECOV_TOKEN }}"
fail_ci_if_error: false
crdbdatastoreconstest:
name: "Datastore Consistency Tests"
runs-on: "depot-ubuntu-24.04-4"
needs: "paths-filter"
strategy:
fail-fast: false
matrix:
datastore: ["crdb"]
crdbversion: ["25.2.0", "25.3.0"]
steps:
- uses: "actions/checkout@ff7abcd0c3c05ccf6adc123a8cd1fd4fb30fb493" # v4.2.2
if: |
needs.paths-filter.outputs.codechange == 'true'
- uses: "authzed/actions/setup-go@6cde6aeb82fab36d8383c2f55bed8128955af34d" # main
if: |
needs.paths-filter.outputs.codechange == 'true'
- uses: "docker/login-action@5e57cd118135c172c3672efd75eb46360885c0ef" # v3.6.0
if: |
needs.paths-filter.outputs.codechange == 'true'
with:
username: "${{ env.DOCKERHUB_PUBLIC_USER }}"
password: "${{ env.DOCKERHUB_PUBLIC_ACCESS_TOKEN }}"
- name: "Consistency tests"
if: |
needs.paths-filter.outputs.codechange == 'true'
run: "go run mage.go testcons:crdbver ${{ matrix.crdbversion }}"
- name: "Coverage"
if: |
needs.paths-filter.outputs.codechange == 'true'
uses: "codecov/codecov-action@5a1091511ad55cbe89839c7260b706298ca349f7" # v5.5.1
with:
files: "./coverage.txt"
token: "${{ secrets.CODECOV_TOKEN }}"
fail_ci_if_error: false
e2e:
name: "E2E"
runs-on: "depot-ubuntu-24.04-8"
needs: "paths-filter"
strategy:
fail-fast: false
matrix:
crdbversion: ["22.1.5"] # TODO update to 25.x when we figure out how to override the clock
if: |
needs.paths-filter.outputs.codechange == 'true'
steps:
- uses: "actions/checkout@ff7abcd0c3c05ccf6adc123a8cd1fd4fb30fb493" # v4.2.2
- uses: "authzed/actions/setup-go@6cde6aeb82fab36d8383c2f55bed8128955af34d" # main
with:
go-version-file: "e2e/go.mod"
cache-dependency-path: "e2e/go.sum"
- name: "Run e2e"
run: "go run mage.go test:e2e ${{ matrix.crdbversion }}"
- uses: "actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4" # v5.0.0
if: "always()"
# this upload step is really flaky, don't fail the job if it fails
continue-on-error: true
with:
name: "node-logs"
path: "e2e/newenemy/*.log"
analyzers-unit-tests:
name: "Analyzers Unit Tests"
runs-on: "depot-ubuntu-24.04-small"
needs: "paths-filter"
if: |
needs.paths-filter.outputs.codechange == 'true'
steps:
- uses: "actions/checkout@ff7abcd0c3c05ccf6adc123a8cd1fd4fb30fb493" # v4.2.2
- uses: "authzed/actions/setup-go@6cde6aeb82fab36d8383c2f55bed8128955af34d" # main
with:
go-version-file: "tools/analyzers/go.mod"
cache-dependency-path: "tools/analyzers/go.sum"
- name: "Analyzer tests"
run: "go run mage.go test:analyzers"
development:
name: "WASM Tests"
runs-on: "depot-ubuntu-24.04-4"
needs: "paths-filter"
if: |
needs.paths-filter.outputs.codechange == 'true'
steps:
- uses: "actions/checkout@ff7abcd0c3c05ccf6adc123a8cd1fd4fb30fb493" # v4.2.2
- uses: "authzed/actions/setup-go@6cde6aeb82fab36d8383c2f55bed8128955af34d" # main
- name: "Disable AppArmor"
if:
"runner.os == 'Linux'"
# Disable AppArmor for Ubuntu 23.10+.
# https://chromium.googlesource.com/chromium/src/+/main/docs/security/apparmor-userns-restrictions.md
run: "echo 0 | sudo tee /proc/sys/kernel/apparmor_restrict_unprivileged_userns"
# cleanenv is a util provided by the wasmbrowsertest package that removes
# environment variables from the environment handed to wasmbrowsertest.
# this works around https://github.com/agnivade/wasmbrowsertest/issues/40,
# which we were experiencing on depot.
- name: "Install cleanenv"
run: "go install github.com/agnivade/wasmbrowsertest/cmd/cleanenv@latest"
- name: "WASM tests"
# There's a whole bunch of vars in the environment that aren't needed for running this test, so we clear them out.
# NOTE: if you need to do this in the future, I recommend bashing into the container and running `env | sort | less`
run: "cleanenv -remove-prefix GITHUB_ -remove-prefix ANDROID_ -remove-prefix JAVA_ -remove-prefix DOTNET_ -remove-prefix RUNNER_ -remove-prefix HOMEBREW_ -remove-prefix runner_ -- go run mage.go test:wasm"
protobuf:
name: "Generate Protobufs"
runs-on: "depot-ubuntu-24.04-small"
needs: "paths-filter"
if: |
needs.paths-filter.outputs.protochange == 'true'
steps:
- uses: "actions/checkout@ff7abcd0c3c05ccf6adc123a8cd1fd4fb30fb493" # v4.2.2
- uses: "authzed/actions/setup-go@6cde6aeb82fab36d8383c2f55bed8128955af34d" # main
- name: "Generate Protos"
run: "go run mage.go gen:proto"
- uses: "chainguard-dev/actions/nodiff@1b32103f5aa389c31ab0be75a8edc38d7e4750d8" # main
with:
path: ""
fixup-command: "go run mage.go gen:proto"
- uses: "bufbuild/buf-setup-action@a47c93e0b1648d5651a065437926377d060baa99" # v1.5.0
- uses: "bufbuild/buf-breaking-action@c57b3d842a5c3f3b454756ef65305a50a587c5ba" # v1.1.4 TODO(miparnisari) deprecated, use buf-action
if: "github.event_name == 'pull_request'"
env:
BUF_INPUT_HTTPS_USERNAME: "${{ github.actor }}"
BUF_INPUT_HTTPS_PASSWORD: "${{ github.token }}"
with:
input: "proto/internal"
against: "https://github.com/authzed/spicedb.git#branch=main,subdir=proto/internal"
buf_token: "${{ secrets.BUF_REGISTRY_TOKEN }}"
benchmarks:
name: "Run Go benchmarks"
runs-on: "depot-ubuntu-24.04-8"
timeout-minutes: 30
needs: "paths-filter"
# Benchmarks on Main are ran through a different workflow
if: |
needs.paths-filter.outputs.codechange == 'true' &&
github.event_name == 'pull_request' &&
github.base_ref == 'main'
steps:
- uses: "actions/checkout@ff7abcd0c3c05ccf6adc123a8cd1fd4fb30fb493" # v4.2.2
with:
fetch-depth: 0
- uses: "actions/setup-go@faf52423ec0d44c58f68e83b614bfcd99dded66f" # v5.4.0
with:
go-version-file: "./go.mod"
cache-dependency-path: "./go.sum"
check-latest: true
- name: "Run benchmark on PR"
run: |
set -o pipefail
go run mage.go benchmark:all | tee ${{ github.sha }}_bench_output.txt
- name: "Get CPU information"
uses: "kenchan0130/actions-system-info@master"
id: "system-info"
- name: "Get Main branch SHA"
id: "get-main-branch-sha"
run: |
SHA=$(git rev-parse origin/main)
echo "sha=$SHA" >> $GITHUB_OUTPUT
- name: "Download benchmark from Main"
uses: "actions/cache/restore@0057852bfaa89a56745cba8c7296529d2fc39830" # v4.3.0
id: "downloadbenchmark"
with:
path: "./cache/benchmark-data.json"
key: "${{ steps.get-main-branch-sha.outputs.sha }}-${{ runner.os }}-${{ steps.system-info.outputs.cpu-model }}-go-benchmark"
- name: "Compare benchmarks with Main"
uses: "benchmark-action/github-action-benchmark@4bdcce38c94cec68da58d012ac24b7b1155efe8b" # v1.20.7
if: "steps.downloadbenchmark.outputs.cache-hit == 'true'"
with:
alert-threshold: "200%"
# What benchmark tool the output.txt came from
tool: "go"
# Where the output from the benchmark tool is stored
output-file-path: "${{ github.sha }}_bench_output.txt"
# Where the benchmarks in main are (to compare)
external-data-json-path: "./cache/benchmark-data.json"
# Do not save the data
save-data-file: false
# Workflow will fail when an alert happens
fail-on-alert: true
github-token: "${{ secrets.GITHUB_TOKEN }}"
# Enable Job Summary for PRs
summary-always: true
- name: "Run benchmarks but don't compare to Main branch"
uses: "benchmark-action/github-action-benchmark@4bdcce38c94cec68da58d012ac24b7b1155efe8b" # v1.20.7
if: "steps.downloadbenchmark.outputs.cache-hit != 'true'"
with:
# What benchmark tool the output.txt came from
tool: "go"
# Where the output from the benchmark tool is stored
output-file-path: "${{ github.sha }}_bench_output.txt"
# Do not save the data anywhere, just publish summary
save-data-file: false
external-data-json-path: "ignoreme"
# Enable Job Summary for PRs
summary-always: true