38 lines
1.3 KiB
YAML
38 lines
1.3 KiB
YAML
name: Web CI
|
|
|
|
on:
|
|
push:
|
|
branches: [main]
|
|
pull_request:
|
|
branches: [main]
|
|
workflow_dispatch:
|
|
|
|
jobs:
|
|
test:
|
|
runs-on: forgejo-local
|
|
steps:
|
|
- name: Check out repository
|
|
run: |
|
|
git clone "http://forgejo:3000/${GITHUB_REPOSITORY}.git" .
|
|
git checkout "$GITHUB_SHA"
|
|
|
|
- name: Install Node and browsers
|
|
run: |
|
|
apt-get update
|
|
apt-get install -y --no-install-recommends ca-certificates curl nodejs npm postgresql postgresql-client
|
|
service postgresql start
|
|
su - postgres -c "psql -tc \"SELECT 1 FROM pg_roles WHERE rolname='calorie_ai'\" | grep -q 1 || psql -c \"CREATE USER calorie_ai WITH PASSWORD 'calorie_ai';\""
|
|
su - postgres -c "psql -tc \"SELECT 1 FROM pg_database WHERE datname='calorie_ai_test'\" | grep -q 1 || createdb -O calorie_ai calorie_ai_test"
|
|
cd web
|
|
npm install
|
|
npx playwright install --with-deps chromium
|
|
|
|
- name: Run Playwright tests
|
|
run: |
|
|
cd web
|
|
CI=true \
|
|
CALORIE_AI_WEB_USER=admin \
|
|
CALORIE_AI_WEB_PASSWORD=test-password \
|
|
CALORIE_AI_SESSION_SECRET=test-session-secret \
|
|
CALORIE_AI_TEST_DATABASE_URL=postgresql://calorie_ai:calorie_ai@127.0.0.1:5432/calorie_ai_test \
|
|
npm test
|