41 lines
979 B
YAML
41 lines
979 B
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
|
|
cd web
|
|
npm install
|
|
npx playwright install --with-deps chromium
|
|
|
|
- name: Start web app
|
|
run: |
|
|
cd web
|
|
PORT=8095 node server.js > /tmp/calorie-ai-web.log 2>&1 &
|
|
for i in $(seq 1 30); do
|
|
curl -fsS http://127.0.0.1:8095 >/dev/null && exit 0
|
|
sleep 1
|
|
done
|
|
cat /tmp/calorie-ai-web.log
|
|
exit 1
|
|
|
|
- name: Run Playwright tests
|
|
run: |
|
|
cd web
|
|
npm test
|