e2e GitHub action (IVS-603) #16
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Playwright Tests | |
on: | |
push: | |
branches: [ main, development ] | |
pull_request: | |
branches: [ main, development ] | |
jobs: | |
playwright: | |
name: 'Playwright Tests' | |
runs-on: ubuntu-latest | |
container: | |
image: mcr.microsoft.com/playwright:v1.55.0-noble | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
with: | |
submodules: recursive | |
- name: Setup Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version: lts/* | |
- name: Setup Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: '3.11' | |
- name: Install Docker | |
run: | | |
curl -fsSL https://get.docker.com -o get-docker.sh | |
sh ./get-docker.sh | |
- name: Install system dependencies | |
run: | | |
apt-get update | |
apt-get install -y make wget unzip | |
- name: Install backend dependencies | |
run: | | |
cd backend | |
test -d .dev/venv || python3.11 -m venv .dev/venv | |
.dev/venv/bin/pip install --upgrade pip | |
find . -name 'requirements.txt' -exec .dev/venv/bin/pip install -r {} \; | |
wget -O /tmp/ifcopenshell_python.zip "https://s3.amazonaws.com/ifcopenshell-builds/ifcopenshell-python-311-v0.8.4-6924012-linux64.zip" | |
mkdir -p .dev/venv/lib/python3.11/site-packages | |
unzip -f -d .dev/venv/lib/python3.11/site-packages /tmp/ifcopenshell_python.zip | |
rm /tmp/ifcopenshell_python.zip | |
env: | |
VIRTUAL_ENV: backend/.dev/venv | |
- name: Start infrastructure services (replicating start-infra) | |
run: docker compose -f docker-compose.infra_only.yml up -d | |
- name: Wait for services to be ready | |
run: | | |
echo "Waiting for services to start..." | |
sleep 10 | |
docker compose -f docker-compose.infra_only.yml ps | |
- name: Cache frontend dependencies | |
uses: actions/cache@v4 | |
with: | |
path: frontend/node_modules | |
key: ${{ runner.os }}-frontend-${{ hashFiles('frontend/package-lock.json') }} | |
restore-keys: | | |
${{ runner.os }}-frontend- | |
- name: Install frontend dependencies (required for webServer) | |
run: npm install | |
working-directory: ./frontend | |
- name: Cache e2e dependencies | |
uses: actions/cache@v4 | |
with: | |
path: e2e/node_modules | |
key: ${{ runner.os }}-e2e-${{ hashFiles('e2e/package-lock.json') }} | |
restore-keys: | | |
${{ runner.os }}-e2e- | |
- name: Install e2e dependencies (replicating make e2e-test) | |
run: npm install | |
working-directory: ./e2e | |
- name: Cache Playwright browsers | |
uses: actions/cache@v4 | |
with: | |
path: ~/.cache/ms-playwright | |
key: ${{ runner.os }}-playwright-${{ hashFiles('e2e/package-lock.json') }} | |
restore-keys: | | |
${{ runner.os }}-playwright- | |
- name: Install Playwright browsers | |
run: npm run install-playwright | |
working-directory: ./e2e | |
- name: Run Playwright tests | |
run: npm run test | |
working-directory: ./e2e | |
- name: Upload test results | |
uses: actions/upload-artifact@v4 | |
if: always() | |
with: | |
name: playwright-report | |
path: e2e/test-results/ | |
retention-days: 7 |