Files
vibe-kanban/.github/workflows/test.yml
Alex Netsch 8a91dba6e3 Check prepare db in CI (vibe-kanban) (#1423)
* Done! Here's a summary of the changes:

1. **`scripts/prepare-db.js`** - Added `--check` flag support that runs `cargo sqlx prepare --check` instead of `cargo sqlx prepare`

2. **`package.json`** - Added new script:
   ```json
   "prepare-db:check": "node scripts/prepare-db.js --check"
   ```

3. **`.github/workflows/test.yml`** - Added `npm run prepare-db:check` to the Checks step

The check will verify that the `.sqlx/` cached query metadata is up-to-date with the actual SQL queries in the codebase. If a developer modifies a SQL query but forgets to run `npm run prepare-db`, the CI will fail.

* Fix image queries

* Done! Added check mode support to the remote script:

1. **`crates/remote/scripts/prepare-db.sh`** - Added `--check` flag support that runs `cargo sqlx prepare --check` when passed

2. **`package.json`** - Added:
   ```json
   "remote:prepare-db:check": "cd crates/remote && bash scripts/prepare-db.sh --check"
   ```

Note: I didn't add `remote:prepare-db:check` to CI since it requires PostgreSQL (`initdb`, `pg_ctl`) which may not be available on the CI runner. The local SQLite-based `prepare-db:check` is already in CI. Let me know if you'd like to add the remote check to CI as well (would require installing PostgreSQL in the workflow).

* Add remote db check to workflow

* Added a step to install `sqlx-cli` with both SQLite and PostgreSQL features. The Rust cache should help speed up subsequent runs since it caches installed crates.

* Done! All three files updated to use Rust `1.89.0`:

1. `rust-toolchain.toml` - `channel = "1.89.0"`
2. `.github/workflows/test.yml` - `toolchain: 1.89.0`
3. `.github/workflows/pre-release.yml` - `RUST_TOOLCHAIN: 1.89.0`

This should fix the `zerocopy` AVX512 compile error since 1.89.0 has `stdarch_x86_avx512` stabilized.

* Done. Added a step to install PostgreSQL before the Checks step so `npm run remote:prepare-db:check` can run.

* Updated to install `postgresql-16` and add `/usr/lib/postgresql/16/bin` to PATH so `initdb`, `pg_ctl`, and `createdb` are available.

* Added the official PostgreSQL apt repository so we can install PostgreSQL 16.

* Much cleaner. Using the `ikalnytskyi/action-setup-postgres@v7` action which handles the PostgreSQL 16 installation and PATH setup automatically.

* Done. Changes made:

1. **`crates/remote/scripts/prepare-db.sh`**: Now checks if `DATABASE_URL` is set. If so, uses the existing PostgreSQL server. Otherwise creates a temp cluster as before.

2. **`.github/workflows/test.yml`**:
   - Added `database: remote` to the PostgreSQL action to create the database
   - Added `DATABASE_URL: postgres://postgres@localhost:5432/remote` env var to the Checks step

* Done. Changes made:

1. **`.github/workflows/test.yml`**: Removed PostgreSQL setup step and `DATABASE_URL` env var
2. **`crates/remote/scripts/prepare-db.sh`**: Simplified - for `--check` mode, exits early with `SQLX_OFFLINE=true cargo sqlx prepare --check` (no database needed)
2025-12-04 15:57:32 +00:00

78 lines
1.9 KiB
YAML

name: Test
on:
pull_request:
branches:
- main
- louis/fe-revision
- gabriel/share
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ github.ref != 'refs/heads/main' }}
env:
CARGO_TERM_COLOR: always
NODE_VERSION: 22
PNPM_VERSION: 10.13.1
jobs:
test:
runs-on: buildjet-4vcpu-ubuntu-2204
steps:
- uses: actions/checkout@v4
- name: Setup Node
uses: ./.github/actions/setup-node
- name: Install dependencies
run: pnpm install
- name: Lint frontend
run: cd frontend && npm run lint
- name: Check i18n regressions
env:
GITHUB_BASE_REF: ${{ github.base_ref || 'main' }}
run: ./scripts/check-i18n.sh
- name: Format check frontend
run: cd frontend && npm run format:check
- name: Type check frontend
run: cd frontend && npx tsc --noEmit
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
with:
toolchain: 1.89.0
components: rustfmt, clippy
- name: Cache Rust dependencies
uses: Swatinem/rust-cache@v2
env:
RUST_CACHE_DEBUG: true
with:
workspaces: "."
cache-provider: "buildjet"
cache-on-failure: true
shared-key: "shared"
cache-all-crates: true
- name: Install sqlx-cli
run: cargo install sqlx-cli --no-default-features --features sqlite,postgres
- name: Build frontend
run: cd frontend && npm run build
env:
NODE_OPTIONS: --max-old-space-size=8192
- name: Checks
run: |
cargo fmt --all -- --check
npm run generate-types:check
npm run prepare-db:check
npm run remote:prepare-db:check
cargo test --workspace
cargo clippy --all --all-targets -- -D warnings