-
Notifications
You must be signed in to change notification settings - Fork 11
173 lines (164 loc) · 4.86 KB
/
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
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
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
name: test
on:
push:
branches: [master]
pull_request:
branches: [master]
concurrency:
group: test-${{ github.ref }}
cancel-in-progress: true
jobs:
workdir:
name: "Build"
runs-on: ubuntu-22.04
container:
image: skaut/lebeda:8.3
steps:
- uses: actions/checkout@v4
# Copy & paste from https://github.com/actions/cache/blob/master/examples.md#php---composer
- name: Get composer cache
id: composer-cache
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
- uses: actions/cache@v4
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
restore-keys: |
${{ runner.os }}-composer-
- name: Install yarn
run: |
apt-get update
apt-get install -y npm
npm install --global yarn
#Copy & paste from https://github.com/actions/cache/blob/master/examples.md#node---yarn
- name: Get yarn cache
id: yarn-cache
run: echo "dir=$(yarn cache dir)" >> $GITHUB_OUTPUT
- uses: actions/cache@v4
with:
path: ${{ steps.yarn-cache.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
- run: composer install
- run: yarn install
- run: yarn build
- name: Remove development docker compose override
run: rm docker-compose.override.yml
- name: Fix permissions
run: chown 1000:1000 . -R && chmod 777 . -R
- name: Create tarball
run: tar -czpf /tmp/workdir.tar.gz . && mv /tmp/workdir.tar.gz .
- name: Upload workdir
uses: actions/upload-artifact@v4
with:
name: workdir
path: workdir.tar.gz
tests-unit:
name: "Unit tests"
runs-on: ubuntu-22.04
container:
image: skaut/lebeda:8.3
needs: workdir
steps:
- name: Download workdir
uses: actions/download-artifact@v4
with:
name: workdir
path: .
- name: Extract workdir
run: tar -xzf workdir.tar.gz
- run: phing tests-unit
tests-integration:
name: "Integration tests"
runs-on: ubuntu-22.04
needs: workdir
steps:
- name: Download workdir
uses: actions/download-artifact@v4
with:
name: workdir
path: .
- name: Extract workdir
run: tar -xzpf workdir.tar.gz
- name: Run tests
run: docker compose run -T -u www-data app-test phing tests-integration
code-coverage:
name: "Code coverage"
if: github.ref == 'refs/heads/master'
runs-on: ubuntu-22.04
needs: workdir
steps:
- name: Download workdir
uses: actions/download-artifact@v4
with:
name: workdir
path: .
- name: Extract workdir
run: tar -xzpf workdir.tar.gz
- name: Run tests with coverage
run: docker compose run -T -u www-data app-test phing tests-with-coverage
- name: Upload code coverage
uses: codecov/codecov-action@v1
with:
token: ${{ secrets.CODECOV_TOKEN }}
file: tests/_output/coverage.xml
fail_ci_if_error: true
static-analysis:
name: "PHPStan analysis"
runs-on: ubuntu-22.04
container:
image: skaut/lebeda:8.3
needs: workdir
steps:
- name: Download workdir
uses: actions/download-artifact@v4
with:
name: workdir
path: .
- name: Extract workdir
run: tar -xzf workdir.tar.gz
- run: phing static-analysis
coding-standard:
name: "Coding standard"
runs-on: ubuntu-22.04
container:
image: skaut/lebeda:8.3
needs: workdir
steps:
- name: Download workdir
uses: actions/download-artifact@v4
with:
name: workdir
path: .
- name: Extract workdir
run: tar -xzf workdir.tar.gz
- run: phing coding-standard
doctrine-checks:
name: "Doctrine checks"
runs-on: ubuntu-22.04
container:
image: skaut/lebeda:8.3
services:
mysql-test:
image: mysql:8.0
env:
MYSQL_ROOT_PASSWORD: 'root'
MYSQL_DATABASE: srs
TZ: Europe/Paris
options: --health-cmd="mysqladmin ping" --health-interval=5s --health-timeout=2s --health-retries=3
needs: workdir
steps:
- name: Download workdir
uses: actions/download-artifact@v4
with:
name: workdir
path: .
- name: Extract workdir
run: tar -xzf workdir.tar.gz
- name: Create local.neon config
run: mv app/config/ci.local.neon app/config/local.neon
- name: Run migrations:migrate
run: php www/console.php migrations:migrate --no-interaction
- name: Run orm:validate
run: php www/console.php orm:validate