mirror of
https://github.com/BaaRai/ARTEX.git
synced 2026-11-19 14:40:53 +08:00
ci: build a dedicated database for the online index scripts
The job-level test database has no schema and cached go test results do not guarantee any suffixed test database exists; create one from db/schema.sql and db/migrations, then apply and roll back the scripts.
This commit is contained in:
@@ -49,15 +49,18 @@ jobs:
|
||||
# keeps the database state deterministic.
|
||||
run: go test -p 1 ./...
|
||||
- name: online index scripts
|
||||
# Apply and roll back scripts/sql against a database that holds the
|
||||
# schema. The job-level artextest database stays empty (every package
|
||||
# that opens the database uses its own suffixed one); the db package's
|
||||
# artextest_db has the full schema after the step above.
|
||||
# Apply and roll back scripts/sql on a database built here from
|
||||
# db/schema.sql and db/migrations. The job-level artextest database
|
||||
# never gets the schema (packages use suffixed databases), and cached
|
||||
# test results mean no test database is guaranteed to exist.
|
||||
env:
|
||||
ARTEX_PG_DSN: postgres://artex:testpass@localhost:5432/artextest_db?sslmode=disable
|
||||
SQL_DSN: postgres://artex:testpass@localhost:5432/artextest_sqlscripts?sslmode=disable
|
||||
run: |
|
||||
psql "$ARTEX_PG_DSN" -X -v ON_ERROR_STOP=1 -f scripts/sql/20261115-task-query-indexes.sql
|
||||
psql "$ARTEX_PG_DSN" -X -v ON_ERROR_STOP=1 -f scripts/sql/20261115-task-query-indexes.rollback.sql
|
||||
psql "$ARTEX_PG_DSN" -X -v ON_ERROR_STOP=1 -c 'CREATE DATABASE artextest_sqlscripts'
|
||||
psql "$SQL_DSN" -X -q -v ON_ERROR_STOP=1 -f db/schema.sql
|
||||
for f in db/migrations/*.sql; do psql "$SQL_DSN" -X -q -v ON_ERROR_STOP=1 -f "$f"; done
|
||||
psql "$SQL_DSN" -X -v ON_ERROR_STOP=1 -f scripts/sql/20261115-task-query-indexes.sql
|
||||
psql "$SQL_DSN" -X -v ON_ERROR_STOP=1 -f scripts/sql/20261115-task-query-indexes.rollback.sql
|
||||
- name: go test -race
|
||||
# Race detector on the packages that pass under -race today. ./server
|
||||
# joined once its suite was checked with -race against postgres and its
|
||||
|
||||
Reference in New Issue
Block a user