-
Notifications
You must be signed in to change notification settings - Fork 62
69 lines (65 loc) · 2.86 KB
/
run-test.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
name: Run tests
on: [push, pull_request]
env:
APP_ENV: test # This is needed to show the party admin link after party creation so cypress can use it for e2e testing
CREATE_DB_DATABASE: secretsanta_test
CREATE_DB_USER: root
CREATE_DB_PASSWORD: root
DATABASE_URL: mysql://root:root@127.0.0.1/secretsanta_test?serverVersion=5.7&charset=utf8mb4
MAILER_DSN: sendmail://localhost
APP_DOMAIN: test.secretsantaorganizer.com
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Cache Composer dependencies
uses: actions/cache@v2
with:
path: /tmp/composer-cache
key: ${{ runner.os }}-${{ hashFiles('**/composer.lock') }}
- uses: shivammathur/setup-php@v2
with:
php-version: '8.2'
extensions: apcu
- name: Configure recaptcha secrets
run: cp config/recaptcha_secrets.json.dist config/recaptcha_secrets.json
- name: Display PHP version
run: php -v
- name: Composer install
run: composer install
- name: Configure postfix & mailhog
run: sudo bash .github/scripts/mailhog.sh
- name: Install GeoLite IP DB
run: curl https://www.secretsantaorganizer.com/GeoLite2-City.mmdb > /home/runner/work/SecretSanta/SecretSanta/GeoLite2-City.mmdb
- name: Install Symfony binary
run: curl -sS https://get.symfony.com/cli/installer | bash -s -- --install-dir=/usr/local/bin
- name: Prepare empty database
run: |
sudo /etc/init.d/mysql start
mysql -e 'CREATE DATABASE ${{ env.CREATE_DB_DATABASE }};' -u${{ env.CREATE_DB_USER }} -p${{ env.CREATE_DB_PASSWORD }}
- name: Initialize application DB schema
run: bin/console doctrine:schema:update -vvv --force
- name: Run tests
run: make test
- name: Run PHP CS Fixer
run: PHP_CS_FIXER_FUTURE_MODE=1 php ./vendor/bin/php-cs-fixer fix -v --dry-run --diff
- name: Prepare Symfony local server TLS
run: symfony server:ca:install
- name: Run Cypress E2E tests
uses: cypress-io/github-action@v4
with:
config-file: cypress.config.github.js
browser: chrome
build: npm run build
start: symfony server:start
- uses: actions/upload-artifact@v4
if: failure()
with:
name: cypress-screenshots
path: cypress/screenshots
- uses: actions/upload-artifact@v4
if: always()
with:
name: cypress-videos
path: cypress/videos