1+ name : Playwright Tests
2+ on :
3+ push :
4+ branches : development
5+ pull_request :
6+ branches : development
7+
8+ permissions :
9+ contents : read
10+ actions : read
11+ checks : write
12+ pull-requests : write
13+
14+ jobs :
15+ playwright :
16+ name : ' Playwright Tests'
17+ runs-on : ubuntu-latest
18+ container :
19+ image : mcr.microsoft.com/playwright:v1.55.0-noble
20+ env :
21+ DJANGO_DB : postgresql
22+ POSTGRES_DB : postgres
23+ POSTGRES_HOST : postgres
24+ POSTGRES_NAME : postgres
25+ POSTGRES_PASSWORD : postgres
26+ POSTGRES_PORT : 5432
27+ MEDIA_ROOT : /tmp/files_storage
28+ CELERY_BROKER_URL : redis://redis:6379/0
29+ CELERY_RESULT_BACKEND : django-db
30+ CELERY_TASK_ALWAYS_EAGER : " false"
31+ CELERY_TASK_EAGER_PROPAGATES : " false"
32+ DJANGO_ALLOWED_HOSTS : " localhost 127.0.0.1"
33+ DJANGO_TRUSTED_ORIGINS : " http://localhost:3000 http://127.0.0.1:3000 http://localhost:8000 http://127.0.0.1:8000"
34+ POSTGRES_USER : postgres
35+ VIRTUAL_ENV : backend/.dev/venv
36+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
37+
38+ services :
39+ postgres :
40+ image : postgres:16.8-alpine
41+ env :
42+ POSTGRES_DB : postgres
43+ POSTGRES_USER : postgres
44+ POSTGRES_PASSWORD : postgres
45+ options : >-
46+ --health-cmd pg_isready
47+ --health-interval 10s
48+ --health-timeout 5s
49+ --health-retries 5
50+ --network-alias postgres
51+ ports :
52+ - 5432:5432
53+ redis :
54+ image : redis:7.2-alpine
55+ options : >-
56+ --health-cmd "redis-cli ping"
57+ --health-interval 10s
58+ --health-timeout 5s
59+ --health-retries 5
60+ ports :
61+ - 6379:6379
62+ volumes :
63+ - redis_data:/data
64+
65+ steps :
66+ - name : Checkout repository
67+ uses : actions/checkout@v4
68+ with :
69+ submodules : recursive
70+
71+ - name : Prepare MEDIA_ROOT
72+ run : |
73+ mkdir -p /tmp/files_storage
74+ chmod -R 777 /tmp/files_storage
75+
76+ - name : Setup Node.js
77+ uses : actions/setup-node@v4
78+ with :
79+ node-version : lts/*
80+
81+ - name : Setup Python
82+ uses : actions/setup-python@v5
83+ with :
84+ python-version : ' 3.11'
85+
86+ - name : Install system dependencies
87+ run : |
88+ apt-get update
89+ apt-get install -y make wget unzip libpq-dev
90+
91+ - name : Cache backend dependencies
92+ uses : actions/cache@v4
93+ with :
94+ path : backend/.dev/venv
95+ key : ${{ runner.os }}-backend-${{ hashFiles('backend/**/requirements.txt') }}
96+ restore-keys : |
97+ ${{ runner.os }}-backend-
98+
99+ - name : Install backend dependencies
100+ run : |
101+ cd backend
102+ test -d .dev/venv || python3.11 -m venv .dev/venv
103+ .dev/venv/bin/pip install --upgrade pip
104+ find . -name 'requirements.txt' -exec .dev/venv/bin/pip install -r {} \;
105+ - name : Download and install ifcopenshell
106+ run : |
107+ wget -O /tmp/ifcopenshell_python.zip "https://s3.amazonaws.com/ifcopenshell-builds/ifcopenshell-python-311-v0.8.4-6924012-linux64.zip"
108+ mkdir -p .dev/venv/lib/python3.11/site-packages
109+ unzip -o -d .dev/venv/lib/python3.11/site-packages /tmp/ifcopenshell_python.zip
110+ rm /tmp/ifcopenshell_python.zip
111+ # Verify installation
112+ ls -la .dev/venv/lib/python3.11/site-packages/
113+ echo "Checking for ifcopenshell installation:"
114+ find .dev/venv/lib/python3.11/site-packages -name "*ifcopenshell*" || echo "No ifcopenshell files found"
115+ working-directory : ./backend
116+
117+ - name : Cache frontend dependencies
118+ uses : actions/cache@v4
119+ with :
120+ path : frontend/node_modules
121+ key : ${{ runner.os }}-frontend-${{ hashFiles('frontend/package-lock.json') }}
122+ restore-keys : |
123+ ${{ runner.os }}-frontend-
124+
125+ - name : Install frontend dependencies (required for webServer)
126+ run : npm install
127+ working-directory : ./frontend
128+
129+ - name : Cache e2e dependencies
130+ uses : actions/cache@v4
131+ with :
132+ path : e2e/node_modules
133+ key : ${{ runner.os }}-e2e-${{ hashFiles('e2e/package-lock.json') }}
134+ restore-keys : |
135+ ${{ runner.os }}-e2e-
136+
137+ - name : Install e2e dependencies (replicating make e2e-test)
138+ run : npm install
139+ working-directory : ./e2e
140+
141+ - name : Cache Playwright browsers
142+ uses : actions/cache@v4
143+ with :
144+ path : ~/.cache/ms-playwright
145+ key : ${{ runner.os }}-playwright-${{ hashFiles('e2e/package-lock.json') }}
146+ restore-keys : |
147+ ${{ runner.os }}-playwright-
148+
149+ - name : Install Playwright browsers
150+ run : npm run install-playwright
151+ working-directory : ./e2e
152+
153+ - name : Setup Django database, migrations, and superusers
154+ run : |
155+ cd backend
156+ .dev/venv/bin/python manage.py makemigrations
157+ .dev/venv/bin/python manage.py migrate
158+ .dev/venv/bin/python manage.py collectstatic --noinput
159+ DJANGO_SUPERUSER_USERNAME=root DJANGO_SUPERUSER_PASSWORD=root DJANGO_SUPERUSER_EMAIL=root@localhost .dev/venv/bin/python manage.py createsuperuser --noinput
160+ DJANGO_SUPERUSER_USERNAME=SYSTEM DJANGO_SUPERUSER_PASSWORD=system DJANGO_SUPERUSER_EMAIL=system@localhost .dev/venv/bin/python manage.py createsuperuser --noinput
161+ .dev/venv/bin/python manage.py seed_dummy_requests
162+ env :
163+ DJANGO_DB : postgresql
164+ POSTGRES_HOST : postgres
165+ POSTGRES_NAME : postgres
166+ POSTGRES_USER : postgres
167+ POSTGRES_PASSWORD : postgres
168+ POSTGRES_PORT : 5432
169+ VIRTUAL_ENV : backend/.dev/venv
170+
171+ - name : Run Playwright tests
172+ run : npx playwright test --workers="$(node -p "Math.max(1, Math.min(Math.floor((require('os').cpus()?.length||2)*0.75), 8))")"
173+ working-directory : ./e2e
174+ env :
175+ DJANGO_DB : postgresql
176+ POSTGRES_HOST : postgres
177+ POSTGRES_NAME : postgres
178+ POSTGRES_USER : postgres
179+ POSTGRES_PASSWORD : postgres
180+ POSTGRES_PORT : 5432
181+
182+ - name : Upload test results
183+ uses : actions/upload-artifact@v4
184+ if : always()
185+ with :
186+ name : playwright-report
187+ path : e2e/test-results/
188+ retention-days : 7
0 commit comments