Skip to content

Commit f0b2d0a

Browse files
authored
Merge pull request #256 from os2display/feature/playwright-actions
Github Actions Playwright workflow
2 parents e4d1dc9 + f33a1bd commit f0b2d0a

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

61 files changed

+3491
-4152
lines changed

.docker/templates/default.conf.template

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -37,17 +37,6 @@ server {
3737
internal;
3838
}
3939

40-
location /vite {
41-
proxy_set_header X-Forwarded-For $remote_addr;
42-
proxy_set_header Host $http_host;
43-
proxy_pass http://node:3000;
44-
proxy_http_version 1.1;
45-
46-
# Enable WebSocket support for HMR
47-
proxy_set_header Upgrade $http_upgrade;
48-
proxy_set_header Connection "upgrade";
49-
}
50-
5140
location ~ \.php$ {
5241
return 404;
5342
}

.env

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ TRACK_SCREEN_INFO_UPDATE_INTERVAL_SECONDS=300
115115
ADMIN_REJSEPLANEN_APIKEY=
116116
ADMIN_SHOW_SCREEN_STATUS=false
117117
ADMIN_TOUCH_BUTTON_REGIONS=false
118-
ADMIN_LOGIN_METHODS="[]"
118+
ADMIN_LOGIN_METHODS='[{"type":"username-password","enabled":true,"provider":"username-password","label":""}]'
119119
ADMIN_ENHANCED_PREVIEW=false
120120
###< Admin configuration ###
121121

.github/workflows/apispec.yaml

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
on: pull_request
2+
3+
name: Api Spec
4+
5+
jobs:
6+
apispec:
7+
runs-on: ubuntu-latest
8+
name: API Specification validation
9+
strategy:
10+
fail-fast: false
11+
matrix:
12+
php: ["8.3"]
13+
steps:
14+
- name: Checkout
15+
uses: actions/checkout@v4
16+
with:
17+
fetch-depth: 2
18+
19+
- name: Setup PHP, with composer and extensions
20+
uses: shivammathur/setup-php@v2
21+
with:
22+
php-version: ${{ matrix.php}}
23+
extensions: apcu, ctype, iconv, imagick, json, redis, soap, xmlreader, zip
24+
coverage: none
25+
26+
- name: Get composer cache directory
27+
id: composer-cache
28+
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
29+
30+
- name: Cache composer dependencies
31+
uses: actions/cache@v4
32+
with:
33+
path: ${{ steps.composer-cache.outputs.dir }}
34+
key: ${{ matrix.php }}-composer-${{ hashFiles('**/composer.lock') }}
35+
restore-keys: ${{ matrix.php }}-composer-
36+
37+
- name: Install Dependencies
38+
run: composer install -q --no-ansi --no-interaction --no-scripts --no-suggest --no-progress --prefer-dist
39+
40+
- name: Export specifications (yaml)
41+
run: bin/console api:openapi:export --yaml --output=public/api-spec-v2.yaml --no-interaction
42+
43+
- name: Check for changes in specifications (yaml)
44+
run: git diff --diff-filter=ACMRT --exit-code public/api-spec-v2.yaml
45+
46+
- name: Export specifications (json)
47+
run: bin/console api:openapi:export --output=public/api-spec-v2.json --no-interaction
48+
49+
- name: Check for changes in specifications (json)
50+
run: git diff --diff-filter=ACMRT --exit-code public/api-spec-v2.json

.github/workflows/composer.yaml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
name: Composer
2727

2828
env:
29-
COMPOSE_USER: root
29+
COMPOSE_USER: runner
3030

3131
on:
3232
pull_request:
@@ -65,5 +65,4 @@ jobs:
6565
- uses: actions/checkout@v4
6666
- run: |
6767
docker network create frontend
68-
docker compose run --rm phpfpm composer install
69-
docker compose run --rm phpfpm composer audit
68+
docker compose run --rm phpfpm composer audit --locked
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
on: pull_request
2+
3+
name: Composer install
4+
5+
jobs:
6+
test-composer-install:
7+
runs-on: ubuntu-latest
8+
env:
9+
COMPOSER_ALLOW_SUPERUSER: 1
10+
strategy:
11+
fail-fast: false
12+
matrix:
13+
php: ["8.3"]
14+
name: Composer install in prod mode (PHP ${{ matrix.php}})
15+
steps:
16+
- name: Checkout
17+
uses: actions/checkout@v4
18+
19+
- name: Setup PHP, with composer and extensions
20+
uses: shivammathur/setup-php@v2
21+
with:
22+
php-version: ${{ matrix.php}}
23+
extensions: apcu, ctype, iconv, imagick, json, redis, soap, xmlreader, zip
24+
coverage: none
25+
26+
- name: Get composer cache directory
27+
id: composer-cache
28+
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
29+
30+
- name: Cache composer dependencies
31+
uses: actions/cache@v4
32+
with:
33+
path: ${{ steps.composer-cache.outputs.dir }}
34+
key: ${{ matrix.php }}-composer-${{ hashFiles('**/composer.lock') }}
35+
restore-keys: ${{ matrix.php }}-composer-
36+
37+
- name: "[prod] Composer install with exported .env variables"
38+
run: |
39+
set -a && source .env && set +a
40+
APP_ENV=prod composer install --no-dev -o

.github/workflows/doctrine.yaml

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
on: pull_request
2+
3+
name: Doctrine
4+
5+
jobs:
6+
validate-doctrine-shema:
7+
runs-on: ubuntu-latest
8+
env:
9+
DATABASE_URL: mysql://db:db@127.0.0.1:3306/db?serverVersion=mariadb-10.5.13
10+
strategy:
11+
fail-fast: false
12+
matrix:
13+
php: ["8.3"]
14+
name: Validate Schema (PHP ${{ matrix.php}})
15+
services:
16+
mariadb:
17+
image: mariadb:10.5.13
18+
env:
19+
MYSQL_USER: db
20+
MYSQL_PASSWORD: db
21+
MYSQL_DATABASE: db
22+
MYSQL_ROOT_PASSWORD: db
23+
ports:
24+
- 3306:3306
25+
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3
26+
steps:
27+
- name: Checkout
28+
uses: actions/checkout@v4
29+
30+
- name: Setup PHP, with composer and extensions
31+
uses: shivammathur/setup-php@v2
32+
with:
33+
php-version: ${{ matrix.php}}
34+
extensions: apcu, ctype, iconv, imagick, json, redis, soap, xmlreader, zip
35+
coverage: none
36+
37+
- name: Get composer cache directory
38+
id: composer-cache
39+
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
40+
41+
- name: Cache composer dependencies
42+
uses: actions/cache@v4
43+
with:
44+
path: ${{ steps.composer-cache.outputs.dir }}
45+
key: ${{ matrix.php }}-composer-${{ hashFiles('**/composer.lock') }}
46+
restore-keys: ${{ matrix.php }}-composer-
47+
48+
- name: "Composer install with exported .env variables"
49+
run: |
50+
set -a && source .env && set +a
51+
APP_ENV=prod composer install --no-dev -o
52+
53+
- name: Run Doctrine Migrations
54+
run: APP_ENV=prod php bin/console doctrine:migrations:migrate --no-interaction
55+
56+
- name: Validate Doctrine schema
57+
run: APP_ENV=prod php bin/console doctrine:schema:validate

.github/workflows/php.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
name: Symfony PHP
3535

3636
env:
37-
COMPOSE_USER: root
37+
COMPOSE_USER: runner
3838

3939
on:
4040
pull_request:

.github/workflows/phpunit.yaml

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
on: pull_request
2+
3+
name: Test
4+
5+
jobs:
6+
phpunit:
7+
runs-on: ubuntu-latest
8+
services:
9+
mariadb:
10+
image: mariadb:lts
11+
ports:
12+
- 3306
13+
env:
14+
MYSQL_USER: db
15+
MYSQL_PASSWORD: db
16+
MYSQL_DATABASE: db_test
17+
MYSQL_ROOT_PASSWORD: password
18+
# https://mariadb.org/mariadb-server-docker-official-images-healthcheck-without-mysqladmin/
19+
options: >-
20+
--health-cmd="healthcheck.sh --connect --innodb_initialized"
21+
--health-interval=5s
22+
--health-timeout=2s
23+
--health-retries=3
24+
strategy:
25+
fail-fast: false
26+
matrix:
27+
php: ["8.3"]
28+
name: PHP Unit tests (PHP ${{ matrix.php }})
29+
steps:
30+
- name: Checkout
31+
uses: actions/checkout@v4
32+
33+
- name: Setup PHP, with composer and extensions
34+
uses: shivammathur/setup-php@v2
35+
with:
36+
php-version: ${{ matrix.php}}
37+
extensions: apcu, ctype, iconv, imagick, json, redis, soap, xmlreader, zip
38+
coverage: none
39+
40+
- name: Get composer cache directory
41+
id: composer-cache
42+
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
43+
44+
- name: Cache composer dependencies
45+
uses: actions/cache@v4
46+
with:
47+
path: ${{ steps.composer-cache.outputs.dir }}
48+
key: ${{ matrix.php }}-composer-${{ hashFiles('**/composer.lock') }}
49+
restore-keys: ${{ matrix.php }}-composer-
50+
51+
- name: Install Dependencies
52+
run: composer install -q --no-ansi --no-interaction --no-scripts --no-suggest --no-progress --prefer-dist
53+
54+
- name: PHP Unit - Test setup
55+
env:
56+
PORT: ${{ job.services.mariadb.ports[3306] }}
57+
run: |
58+
DATABASE_URL="mysql://db:db@127.0.0.1:$PORT/db_test" composer run test-setup
59+
DATABASE_URL="mysql://db:db@127.0.0.1:$PORT/db_test" composer run test

.github/workflows/playwright.yaml

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
on: pull_request
2+
3+
name: Test
4+
5+
env:
6+
COMPOSE_USER: runner
7+
8+
jobs:
9+
frontend-build-and-test:
10+
name: Playwright
11+
runs-on: ubuntu-latest
12+
strategy:
13+
fail-fast: true
14+
steps:
15+
- name: Checkout
16+
uses: actions/checkout@v4
17+
18+
- name: Setup network
19+
run: docker network create frontend
20+
21+
- name: Composer install
22+
run: |
23+
docker compose run --rm phpfpm composer install
24+
25+
- name: Build assets
26+
run: |
27+
docker compose run --rm node npm install
28+
docker compose run --rm node npm run build
29+
30+
- name: Run playwright
31+
env:
32+
CI: "true"
33+
run: |
34+
docker compose run --rm playwright npx playwright install --with-deps
35+
docker compose run --rm playwright npx playwright test
36+
37+
- uses: actions/upload-artifact@v4
38+
if: always()
39+
with:
40+
name: playwright-report
41+
path: playwright-report/
42+
retention-days: 30

0 commit comments

Comments
 (0)