fix(tests): add step to run server for integration tests

This commit is contained in:
perf3ct 2025-06-18 21:01:51 +00:00
parent cab0d75436
commit 4b0f4ed226
1 changed files with 33 additions and 1 deletions

View File

@ -63,10 +63,42 @@ jobs:
restore-keys: |
${{ runner.os }}-cargo-
- name: Build readur binary
run: cargo build --release
- name: Start readur server
run: |
./target/release/readur &
echo $! > readur.pid
env:
DATABASE_URL: ${{ env.DATABASE_URL }}
JWT_SECRET: test-secret-key
PORT: 8000
UPLOAD_PATH: ./uploads
WATCH_PATH: ./watch
- name: Wait for server to be ready
run: |
for i in {1..30}; do
if curl -f http://localhost:8000/api/health > /dev/null 2>&1; then
echo "Readur server is ready"
break
fi
echo "Waiting for readur server... ($i/30)"
sleep 2
done
- name: Run integration tests
run: |
cargo test --test '*' -- --test-threads=1
env:
TEST_DATABASE_URL: ${{ env.DATABASE_URL }}
RUST_LOG: debug
RUST_LOG: debug
- name: Stop readur server
if: always()
run: |
if [ -f readur.pid ]; then
kill $(cat readur.pid) || true
rm readur.pid
fi