-
Notifications
You must be signed in to change notification settings - Fork 0
96 lines (78 loc) · 2.84 KB
/
tests.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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
name: Tests
on:
push:
pull_request:
branches: [ $default-branch ]
concurrency:
group: ${{ github.workflow }}
cancel-in-progress: true
jobs:
tests:
name: Tests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: pull docker containers
run: docker compose pull mysql
- uses: satackey/action-docker-layer-caching@v0.0.11
continue-on-error: true
- name: build docker container
run: docker compose build
- name: PHP dependencies
run: docker compose run -u root:root app composer install
- name: env
run: cp .env.ci .env
- name: laravel key
run: docker compose run -u root:root app php artisan key:generate
- name: start containers
run: docker compose up -d mysql
- name: wait for mysql
run: |
while ! docker exec -t wsmysql_webling sh -c 'mysql -uroot -p"${MYSQL_ROOT_PASSWORD}" -e quit > /dev/null 2>&1'; do
sleep 1
done
- name: run migrations
run: docker compose run -u root:root app php artisan migrate
- name: install passport
run: docker compose run -u root:root app php artisan passport:install
- name: run tests
env:
WEBLING_API_KEY: ${{ secrets.WEBLING_API_KEY }}
WEBLING_FINANCE_ADMIN_API_KEY: ${{ secrets.WEBLING_FINANCE_ADMIN_API_KEY }}
WEBLING_BASE_URL: ${{ secrets.WEBLING_BASE_URL }}
run: >-
docker compose
run
-u root:root
-e WEBLING_API_KEY=${WEBLING_API_KEY}
-e WEBLING_FINANCE_ADMIN_API_KEY=${WEBLING_FINANCE_ADMIN_API_KEY}
-e WEBLING_BASE_URL=${WEBLING_BASE_URL}
app
php
-dxdebug.mode=coverage
/var/www/html/vendor/phpunit/phpunit/phpunit
--configuration /var/www/html/phpunit.xml
--coverage-clover /var/www/html/build/logs/clover.xml
- name: Show logs if tests failed
if: ${{ failure() }}
run: cat storage/logs/laravel*.log
- name: publish coverage report
if: ${{ success() }}
env:
COVERALLS_REPO_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: >-
docker-compose
run
-u root:root
-e GITHUB_REF=${GITHUB_REF}
-e GITHUB_ACTIONS=${GITHUB_ACTIONS}
-e GITHUB_RUN_ID=${GITHUB_RUN_ID}
-e GITHUB_EVENT_NAME=${GITHUB_EVENT_NAME}
-e COVERALLS_REPO_TOKEN=${COVERALLS_REPO_TOKEN}
app
sh
-c
'git config --global --add safe.directory /var/www/html
&& curl -L https://github.com/php-coveralls/php-coveralls/releases/download/v2.5.2/php-coveralls.phar > /tmp/php-coveralls
&& chmod u+x /tmp/php-coveralls
&& /tmp/php-coveralls --coverage_clover=/var/www/html/build/logs/clover.xml -v'