From 7b0ca8aa1664c4252f1e778bb472671f0565af6c Mon Sep 17 00:00:00 2001 From: oxalica Date: Tue, 17 Sep 2024 22:49:43 -0400 Subject: [PATCH] test,ci: validate version of sqlite and fix ci --- .github/workflows/ci.yaml | 13 +++++++++++-- blahd/src/database.rs | 11 +++++++++++ 2 files changed, 22 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 61c1de8..df65405 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -39,15 +39,20 @@ jobs: test: strategy: + fail-fast: false matrix: rust: [stable, beta] name: Test ${{ matrix.rust }} - runs-on: ubuntu-latest + # Need libsqlite3-dev >= 3.38.0 (2022-02-22) + runs-on: ubuntu-24.04 timeout-minutes: 15 steps: - name: Checkout uses: actions/checkout@v4 + - name: Install sqlite + run: sudo apt-get install --no-install-recommends -y libsqlite3-dev + - name: Disable high-priority rust-toolchain.toml run: rm rust-toolchain.toml @@ -67,7 +72,11 @@ jobs: run: cargo build --workspace --all-targets - name: Test - run: cargo test --workspace --all-targets -- --include-ignored + run: cargo test --workspace --all-targets + + # WAIT: Next release of `criterion` for `--include-ignored`. + - name: Test ignored + run: cargo test --workspace --all-targets -- --ignored nix-flake: name: Flake package diff --git a/blahd/src/database.rs b/blahd/src/database.rs index 06b6f0a..5354c8c 100644 --- a/blahd/src/database.rs +++ b/blahd/src/database.rs @@ -131,4 +131,15 @@ impl ConnectionExt for Connection {} fn init_sql_valid() { let conn = Connection::open_in_memory().unwrap(); conn.execute_batch(INIT_SQL).unwrap(); + + // Instantiate view to check syntax and availability of `unixepoch()`. + // It requires sqlite >= 3.38.0 (2022-02-22) which is not available by default on GitHub CI. + let ret = conn + .query_row( + "SELECT COUNT(*) FROM `valid_user_act_key`", + params![], + |row| row.get::<_, i64>(0), + ) + .unwrap(); + assert_eq!(ret, 0); }