Skip to content

Commit d45ecf0

Browse files
Fix ci workflow (#385)
* Add CI steps to create database. * Create MariaDB and test database as part of the test workflow. * Update ci.yml * Update .env.test * Update ci.yml * Update ci.yml * Install dependencies and run encore to create needed files for integration tests. * Update ci.yml * Update ci.yml * Update ci.yml * Updating ci.yml to use * Updating ci.yml to use * Updating ci.yml to use $GITHUB_OUTPUT * Updating ci.yml to use $GITHUB_OUTPUT * Updating ci.yml to use $GITHUB_OUTPUT * Ignore SignupController for infection (mutating integration tests is meaningless). * Enabling infection run. * Update ci.yml * Update ci.yml * Update infection.json5.dist * Update ci.yml
1 parent 17fa126 commit d45ecf0

File tree

4 files changed

+60
-27
lines changed

4 files changed

+60
-27
lines changed

.env.test

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ MANTICORE_HOST="127.0.0.1"
55
MANTICORE_PORT="9308"
66
DB_HOST="127.0.0.1"
77
DB_PORT="3306"
8-
DB_USER="root"
9-
DB_PASS=""
10-
DB_NAME="bewelcome_test"
11-
DATABASE_URL="mysql://${DB_USER}:${DB_PASS}@${DB_HOST}:${DB_PORT}/${DB_NAME}?serverVersion=10.11.2-MariaDB&charset=utf8mb4"
8+
DB_USER="bewelcome"
9+
DB_PASS="bewelcome"
10+
DB_NAME="bewelcome"
11+
DATABASE_URL="mysql://${DB_USER}:${DB_PASS}@${DB_HOST}:${DB_PORT}/${DB_NAME}?serverVersion=10.11.2-MariaDB&charset=utf8mb4"

.github/workflows/ci.yml

Lines changed: 52 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ jobs:
3333

3434
- name: Get Composer Cache Directory
3535
id: composer-cache
36-
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
36+
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
3737

3838
- name: Cache dependencies
3939
uses: actions/cache@0400d5f644dc74513175e3cd8d07132dd4860809 # tag=v4.2.4
@@ -48,8 +48,8 @@ jobs:
4848
- name: Run phpcpd tests
4949
run: vendor/bin/phpcpd src --exclude=src/Entity --exclude=src/Repository
5050

51-
phpunit:
52-
name: PHPUnit
51+
tests:
52+
name: Tests
5353
runs-on: ubuntu-latest
5454
steps:
5555
- name: Checkout
@@ -64,7 +64,7 @@ jobs:
6464

6565
- name: Get Composer Cache Directory
6666
id: composer-cache
67-
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
67+
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
6868

6969
- name: Cache dependencies
7070
uses: actions/cache@0400d5f644dc74513175e3cd8d07132dd4860809 # tag=v4.2.4
@@ -77,19 +77,38 @@ jobs:
7777
run: composer install --prefer-dist --no-progress --no-suggest --no-interaction --no-scripts
7878

7979
- name: Run phpunit tests
80-
run: bin/phpunit --coverage-text --coverage-xml=build/logs/phpunit/coverage-xml --coverage-clover=build/logs/phpunit/clover.xml --log-junit=build/logs/phpunit/unit.xml --colors=never --order-by=random --exclude-group=integration
80+
run: bin/phpunit --coverage-text --coverage-xml=build/logs/phpunit/coverage-xml --coverage-clover=build/logs/phpunit/clover.xml --log-junit=build/logs/phpunit/junit.xml --colors=never --order-by=random --exclude-group=integration
8181

82-
# - name: Run Infection tests
83-
# run: vendor/bin/infection --coverage=build/logs/phpunit --min-covered-msi=85 --threads=30
82+
- name: Run Infection tests
83+
run: vendor/bin/infection --skip-initial-tests --coverage=build/logs/phpunit --min-covered-msi=80 --threads=30
8484

85-
# - name: Run Integration tests
86-
# run: bin/phpunit --log-junit=build/logs/phpunit/integration.xml --colors=never --order-by=random --group=integration
85+
- name: Install MariaDB
86+
uses: getong/mariadb-action@v1.11
87+
with:
88+
mysql database: 'bewelcome_test'
89+
mysql user: 'bewelcome'
90+
mysql password: 'bewelcome'
8791

88-
# - uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # tag=v4.6.2
89-
# if: ${{ always() }}
90-
# with:
91-
# name: infection.log
92-
# path: infection.log
92+
- name: Create test database
93+
run: bin/console test:database:create --env=test
94+
95+
- name: Setup Yarn
96+
uses: threeal/setup-yarn-action@v2.0.0
97+
with:
98+
version: latest
99+
cache: false
100+
101+
- name: Install yarn dependencies and run webpack
102+
run: yarn install --frozen-lock ; yarn encore dev
103+
104+
- name: Run Integration tests
105+
run: bin/phpunit --log-junit=build/logs/phpunit/integration.xml --colors=never --order-by=random --group=integration
106+
107+
- uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # tag=v4.6.2
108+
if: ${{ always() }}
109+
with:
110+
name: infection.log
111+
path: infection.log
93112

94113
phploc:
95114
name: PHPLoc
@@ -106,7 +125,7 @@ jobs:
106125

107126
- name: Get Composer Cache Directory
108127
id: composer-cache
109-
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
128+
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
110129

111130
- name: Cache dependencies
112131
uses: actions/cache@0400d5f644dc74513175e3cd8d07132dd4860809 # tag=v4.2.4
@@ -137,7 +156,7 @@ jobs:
137156

138157
- name: Get Composer Cache Directory
139158
id: composer-cache
140-
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
159+
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
141160

142161
- name: Cache dependencies
143162
uses: actions/cache@0400d5f644dc74513175e3cd8d07132dd4860809 # tag=v4.2.4
@@ -168,7 +187,7 @@ jobs:
168187
#
169188
# - name: Get Composer Cache Directory
170189
# id: composer-cache
171-
# run: echo "::set-output name=dir::$(composer config cache-files-dir)"
190+
# run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
172191
#
173192
# - name: Cache dependencies
174193
# uses: actions/cache@0400d5f644dc74513175e3cd8d07132dd4860809 # tag=v4.2.4
@@ -198,7 +217,7 @@ jobs:
198217

199218
- name: Get Composer Cache Directory
200219
id: composer-cache
201-
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
220+
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
202221

203222
- name: Cache dependencies
204223
uses: actions/cache@0400d5f644dc74513175e3cd8d07132dd4860809 # tag=v4.2.4
@@ -228,7 +247,7 @@ jobs:
228247

229248
- name: Get Composer Cache Directory
230249
id: composer-cache
231-
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
250+
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
232251

233252
- name: Cache dependencies
234253
uses: actions/cache@0400d5f644dc74513175e3cd8d07132dd4860809 # tag=v4.2.4
@@ -258,7 +277,7 @@ jobs:
258277

259278
- name: Get Composer Cache Directory
260279
id: composer-cache
261-
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
280+
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
262281

263282
- name: Cache dependencies
264283
uses: actions/cache@0400d5f644dc74513175e3cd8d07132dd4860809 # tag=v4.2.4
@@ -288,7 +307,7 @@ jobs:
288307

289308
- name: Get Composer Cache Directory
290309
id: composer-cache
291-
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
310+
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
292311

293312
- name: Cache dependencies
294313
uses: actions/cache@0400d5f644dc74513175e3cd8d07132dd4860809 # tag=v4.2.4
@@ -322,7 +341,7 @@ jobs:
322341

323342
- name: Get Composer Cache Directory
324343
id: composer-cache
325-
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
344+
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
326345

327346
- name: Cache dependencies
328347
uses: actions/cache@0400d5f644dc74513175e3cd8d07132dd4860809 # tag=v4.2.4
@@ -341,3 +360,14 @@ jobs:
341360

342361
- name: Run JS security checker
343362
run: yarn audit --groups dependencies
363+
364+
365+
366+
367+
368+
369+
370+
371+
372+
373+

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ int-test:
8888
"./bin/phpunit" --log-junit=build/logs/phpunit/junit.xml --colors=never --order-by=random --group=integration
8989

9090
infection: phpunit
91-
"./vendor/bin/infection" --coverage=build/logs/phpunit --min-covered-msi=85 --threads=30
91+
"./vendor/bin/infection" --skip-initial-tests --coverage=build/logs/phpunit --min-covered-msi=80 --threads=30
9292

9393
#behat: encore
9494
# bin/console doctrine:database:create --env=test --if-not-exists

infection.json5.dist

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@
22
"source": {
33
"directories": [
44
"src/Model"
5+
],
6+
"excludes": [
7+
"src/Controller/SignupController"
58
]
69
},
710
"timeout": 30,

0 commit comments

Comments
 (0)