4646 - run : cargo fmt --all -- --check
4747 - run : cargo clippy --all-targets --all-features -- -D warnings
4848 - run : cargo test --features odbc-static
49+ # The database matrix below runs the same Rust test harnesses against
50+ # different DATABASE_URL values. Package the Linux test executables once
51+ # here so those jobs do not recompile SQLPage or its dependencies.
52+ - name : Package Linux Rust test binaries
53+ run : |
54+ set -euo pipefail
55+ rm -rf target/sqlpage-test-binaries
56+ mkdir -p target/sqlpage-test-binaries
57+ cargo test --features odbc-static --no-run --message-format=json \
58+ | jq -r 'select(.profile.test == true and .executable != null) | .executable' \
59+ | while IFS= read -r test_binary; do
60+ cp -- "$test_binary" target/sqlpage-test-binaries/
61+ done
62+ test -n "$(find target/sqlpage-test-binaries -maxdepth 1 -type f -print -quit)"
63+ tar -C target/sqlpage-test-binaries -czf target/sqlpage-linux-test-binaries.tar.gz .
64+ - name : Upload Linux Rust test binaries
65+ uses : actions/upload-artifact@v7
66+ with :
67+ name : sqlpage-linux-test-binaries
68+ path : " target/sqlpage-linux-test-binaries.tar.gz"
4969 - name : Upload Linux binary
5070 uses : actions/upload-artifact@v7
5171 with :
5474
5575 test :
5676 runs-on : ubuntu-latest
77+ needs : compile_and_lint
5778 strategy :
5879 matrix :
5980 include :
@@ -75,13 +96,18 @@ jobs:
7596 db_url : " Driver=Oracle 21 ODBC driver;Dbq=//127.0.0.1:1521/FREEPDB1;Uid=root;Pwd=Password123!"
7697 steps :
7798 - uses : actions/checkout@v6
78- - name : Set up cargo cache
79- uses : Swatinem/rust-cache@c19371144df3bb44fab255c43d04cbc2ab54d1c4
80- env :
81- NODE_OPTIONS : --no-deprecation
99+ # Reuse the exact Linux test harnesses produced by compile_and_lint.
100+ # This keeps the DB matrix focused on database behavior instead of
101+ # compiling the same Rust crate five more times.
102+ - name : Download Linux Rust test binaries
103+ uses : actions/download-artifact@v8
82104 with :
83- shared-key : rust-sqlpage-proj-test
84- save-if : false
105+ name : sqlpage-linux-test-binaries
106+ path : target
107+ - name : Extract Linux Rust test binaries
108+ run : |
109+ mkdir -p target/sqlpage-test-binaries
110+ tar -xzf target/sqlpage-linux-test-binaries.tar.gz -C target/sqlpage-test-binaries
85111 - name : Install PostgreSQL ODBC driver
86112 if : matrix.setup_odbc
87113 run : sudo apt-get install -y odbc-postgresql
@@ -95,15 +121,27 @@ jobs:
95121 sudo alien -i oracle-instantclient-odbc-21.21.0.0.0-1.el8.x86_64.rpm
96122 sudo ln -s /usr/lib/x86_64-linux-gnu/libaio.so.1t64 /usr/lib/libaio.so.1
97123 sudo /usr/lib/oracle/21/client64/bin/odbc_update_ini.sh / /usr/lib/oracle/21/client64/lib
98- echo "LD_LIBRARY_PATH=/usr/lib/oracle/21/client64/lib:$LD_LIBRARY_PATH" >> $GITHUB_ENV
124+ echo "LD_LIBRARY_PATH=/usr/lib/oracle/21/client64/lib:$LD_LIBRARY_PATH" >> " $GITHUB_ENV"
99125 - name : Start database container
100126 run : docker compose up --wait ${{ matrix.container }}
101127 - name : Show container logs
102128 if : failure()
103129 run : docker compose logs ${{ matrix.container }}
104130 - name : Run tests against ${{ matrix.database }}
105131 timeout-minutes : 5
106- run : cargo test --features odbc-static
132+ run : |
133+ set -euo pipefail
134+ shopt -s nullglob
135+ test_binaries=(target/sqlpage-test-binaries/*)
136+ if ((${#test_binaries[@]} == 0)); then
137+ echo "No test binaries were found in target/sqlpage-test-binaries" >&2
138+ exit 1
139+ fi
140+ for test_binary in "${test_binaries[@]}"; do
141+ echo "::group::$(basename "$test_binary")"
142+ "$test_binary"
143+ echo "::endgroup::"
144+ done
107145 env :
108146 DATABASE_URL : ${{ matrix.db_url }}
109147 MALLOC_CHECK_ : 3
@@ -140,6 +178,48 @@ jobs:
140178 name : sqlpage-windows-debug
141179 path : " target/debug/sqlpage.exe"
142180
181+ playwright :
182+ runs-on : ubuntu-latest
183+ timeout-minutes : 10
184+ needs : compile_and_lint
185+ defaults :
186+ run :
187+ working-directory : ./tests/end-to-end
188+ steps :
189+ - uses : actions/checkout@v6
190+ - uses : actions/setup-node@v6
191+ with :
192+ node-version : lts/*
193+ cache : ' npm'
194+ cache-dependency-path : ./tests/end-to-end/package-lock.json
195+ - run : sudo apt-get update && sudo apt-get install -y unixodbc-dev
196+ - run : npm ci && npx playwright install --with-deps chromium
197+ # The browser tests exercise the official site, but they do not need a
198+ # separate Rust build. Reuse the binary compiled and tested above.
199+ - name : Download Linux binary
200+ uses : actions/download-artifact@v8
201+ with :
202+ name : sqlpage-linux-debug
203+ path : ${{ runner.temp }}/sqlpage-bin
204+ - name : Start official site and wait for it to be ready
205+ timeout-minutes : 1
206+ run : |
207+ chmod +x "${{ runner.temp }}/sqlpage-bin/sqlpage"
208+ "${{ runner.temp }}/sqlpage-bin/sqlpage" 2>/tmp/stderrlog &
209+ tail -f /tmp/stderrlog | grep -q "started successfully"
210+ working-directory : ./examples/official-site
211+ - name : Run Playwright tests
212+ run : npx playwright test
213+ - name : show server logs
214+ if : failure()
215+ run : cat /tmp/stderrlog
216+ - uses : actions/upload-artifact@v7
217+ if : always()
218+ with :
219+ name : playwright-report
220+ path : ./tests/end-to-end/playwright-report/
221+ retention-days : 30
222+
143223 docker_build :
144224 runs-on : ubuntu-latest
145225 strategy :
0 commit comments