-
Notifications
You must be signed in to change notification settings - Fork 28
66 lines (57 loc) · 2.21 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
name: '🔸 Run tests 🧪'
on:
workflow_call:
jobs:
test:
runs-on: ubuntu-22.04
permissions:
contents: read
packages: write
steps:
- uses: myparcelnl/actions/setup-app-credentials@v3
id: credentials
with:
app-id: ${{ secrets.MYPARCEL_APP_ID }}
private-key: ${{ secrets.MYPARCEL_APP_PRIVATE_KEY }}
- uses: actions/checkout@v3
if: github.actor != 'dependabot[bot]'
with:
token: ${{ steps.credentials.outputs.token }}
- name: 'Handle coverage cache'
if: github.actor != 'dependabot[bot]'
uses: actions/cache@v3
id: cache-coverage
with:
path: ./coverage.xml
key: ${{ runner.os }}-coverage-${{ hashFiles('./src/**', './test/**') }}
- uses: myparcelnl/actions/pull-docker-image@v3
if: github.actor != 'dependabot[bot]' && steps.cache-coverage.outputs.cache-hit != 'true'
id: docker
with:
image: ghcr.io/myparcelnl/php-xd:7.1
- name: 'Install composer dependencies'
if: github.actor != 'dependabot[bot]' && steps.cache-coverage.outputs.cache-hit != 'true'
run: |
docker run \
--volume $PWD:/app \
--volume $HOME/.composer:/root/.composer \
--env COMPOSER_CACHE_DIR=/root/.composer \
${{ steps.docker.outputs.image }} \
composer install --no-progress --no-scripts --no-plugins
- name: 'Run tests'
if: github.actor != 'dependabot[bot]' && steps.cache-coverage.outputs.cache-hit != 'true'
run: |
docker run \
--volume $PWD:/app \
--env CI=${CI} \
--env API_KEY_NL=${{ secrets.API_KEY_NL }} \
--env API_KEY_BE=${{ secrets.API_KEY_BE }} \
${{ steps.docker.outputs.image }} \
vendor/bin/phpunit --coverage-clover coverage.xml
- name: 'Get coverage file from container'
if: github.actor != 'dependabot[bot]' && steps.cache-coverage.outputs.cache-hit != 'true'
run: |
docker cp $(docker ps -alq):/app/coverage.xml .
- name: 'Update code coverage'
if: github.actor != 'dependabot[bot]'
uses: codecov/codecov-action@v3