feat(ci): TIL you can't do subfolders in GitHub Actions
This commit is contained in:
parent
7e1fdefc63
commit
812b7c21b0
|
|
@ -1,121 +0,0 @@
|
||||||
name: E2E Tests
|
|
||||||
|
|
||||||
on:
|
|
||||||
push:
|
|
||||||
branches: [ master, main ]
|
|
||||||
pull_request:
|
|
||||||
branches: [ master, main ]
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
test-e2e:
|
|
||||||
timeout-minutes: 60
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
|
|
||||||
services:
|
|
||||||
postgres:
|
|
||||||
image: postgres:13
|
|
||||||
env:
|
|
||||||
POSTGRES_PASSWORD: postgres
|
|
||||||
POSTGRES_DB: readur_test
|
|
||||||
options: >-
|
|
||||||
--health-cmd pg_isready
|
|
||||||
--health-interval 10s
|
|
||||||
--health-timeout 5s
|
|
||||||
--health-retries 5
|
|
||||||
ports:
|
|
||||||
- 5432:5432
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v4
|
|
||||||
|
|
||||||
- name: Install system dependencies
|
|
||||||
run: |
|
|
||||||
sudo apt-get update
|
|
||||||
sudo apt-get install -y \
|
|
||||||
tesseract-ocr \
|
|
||||||
tesseract-ocr-eng \
|
|
||||||
libtesseract-dev \
|
|
||||||
libleptonica-dev \
|
|
||||||
pkg-config \
|
|
||||||
libclang-dev \
|
|
||||||
clang
|
|
||||||
|
|
||||||
- name: Setup Node.js
|
|
||||||
uses: actions/setup-node@v4
|
|
||||||
with:
|
|
||||||
node-version: '18'
|
|
||||||
cache: 'npm'
|
|
||||||
cache-dependency-path: frontend/package-lock.json
|
|
||||||
|
|
||||||
- name: Setup Rust
|
|
||||||
uses: actions-rs/toolchain@v1
|
|
||||||
with:
|
|
||||||
toolchain: stable
|
|
||||||
profile: minimal
|
|
||||||
override: true
|
|
||||||
|
|
||||||
- name: Install frontend dependencies
|
|
||||||
working-directory: ./frontend
|
|
||||||
run: npm ci
|
|
||||||
|
|
||||||
- name: Install Playwright Browsers
|
|
||||||
working-directory: ./frontend
|
|
||||||
run: npx playwright install --with-deps
|
|
||||||
|
|
||||||
- name: Build frontend
|
|
||||||
working-directory: ./frontend
|
|
||||||
run: npm run build
|
|
||||||
|
|
||||||
|
|
||||||
- name: Start backend server
|
|
||||||
run: |
|
|
||||||
# Build and start the backend in test mode
|
|
||||||
cargo build --release
|
|
||||||
|
|
||||||
# Start server in background
|
|
||||||
DATABASE_URL="postgresql://postgres:postgres@localhost:5432/readur_test" \
|
|
||||||
TEST_MODE=true \
|
|
||||||
ROCKET_PORT=8000 \
|
|
||||||
./target/release/readur &
|
|
||||||
|
|
||||||
# Wait for server to be ready
|
|
||||||
timeout 60 bash -c 'until curl -f http://localhost:8000/health; do sleep 2; done'
|
|
||||||
env:
|
|
||||||
DATABASE_URL: postgresql://postgres:postgres@localhost:5432/readur_test
|
|
||||||
TEST_MODE: true
|
|
||||||
ROCKET_PORT: 8000
|
|
||||||
|
|
||||||
- name: Start frontend dev server
|
|
||||||
working-directory: ./frontend
|
|
||||||
run: |
|
|
||||||
# Start Vite dev server in background
|
|
||||||
npm run dev &
|
|
||||||
|
|
||||||
# Wait for frontend to be ready
|
|
||||||
timeout 60 bash -c 'until curl -f http://localhost:5173; do sleep 2; done'
|
|
||||||
env:
|
|
||||||
VITE_API_BASE_URL: http://localhost:8000
|
|
||||||
|
|
||||||
- name: Run Playwright tests
|
|
||||||
working-directory: ./frontend
|
|
||||||
run: npm run test:e2e
|
|
||||||
env:
|
|
||||||
CI: true
|
|
||||||
|
|
||||||
- name: Upload test results
|
|
||||||
uses: actions/upload-artifact@v4
|
|
||||||
if: always()
|
|
||||||
with:
|
|
||||||
name: playwright-report
|
|
||||||
path: frontend/test-results/
|
|
||||||
retention-days: 30
|
|
||||||
|
|
||||||
- name: Upload test artifacts
|
|
||||||
uses: actions/upload-artifact@v4
|
|
||||||
if: always()
|
|
||||||
with:
|
|
||||||
name: playwright-artifacts
|
|
||||||
path: |
|
|
||||||
frontend/test-results/e2e-artifacts/
|
|
||||||
frontend/test-results/screenshots/
|
|
||||||
retention-days: 30
|
|
||||||
Loading…
Reference in New Issue