Files
archtika/.github/workflows/playwright.yml
2024-09-01 18:40:41 +02:00

51 lines
1.1 KiB
YAML

name: "Playwright tests"
on:
push:
branches:
- main
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install Nix
uses: cachix/install-nix-action@v27
with:
github_access_token: ${{ secrets.GITHUB_TOKEN }}
- name: Setup and run dev vm
run: |
sudo mkdir -p /var/www/archtika-websites
sudo chown $USER:$(id -gn) /var/www/archtika-websites
nix run .#dev-vm &
VM_PID=$!
echo "VM_PID=$VM_PID" >> $GITHUB_ENV
# Wait for the PostgreSQL and nginx ports to be open
while ! nc -z localhost 15432 || ! nc -z localhost 18000; do
sleep 1
done
echo "VM is ready"
- name: Start PostgREST API
run: |
cd rest-api
nix run .#api
- name: Run playwright tests
run: |
cd web-app
nix develop .#web
npm install
npm run test
- name: Cleanup
if: always()
run: |
if [ -n "$VM_PID" ]; then
kill $VM_PID
fi