This repository was archived by the owner on Oct 17, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
145 lines (115 loc) · 3.92 KB
/
Copy pathunit.yml
File metadata and controls
145 lines (115 loc) · 3.92 KB
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
name: PHPUnit Tests
on:
push:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ github.ref != 'refs/heads/main' }}
jobs:
build-cache:
runs-on: ubuntu-latest
name: Build Cache
steps:
- uses: actions/checkout@v2
- name: Get composer cache directory
id: composer-cache
working-directory: ./core
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
- name: Cache Composer dependencies
uses: actions/cache@v2
id: cache
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-${{ hashFiles('./api/composer.lock') }}-${{ hashFiles('./core/composer.lock') }}
- name: Setup PHP
if: steps.cache.outputs.cache-hit != 'true'
uses: shivammathur/setup-php@v2
with:
php-version: '7.4'
coverage: none
tools: composer:v1
- name: Install dependencies (core)
if: steps.cache.outputs.cache-hit != 'true'
working-directory: ./core
run: composer install
- name: Install dependencies (api)
if: steps.cache.outputs.cache-hit != 'true'
working-directory: ./api
run: composer install
phpunitCore:
name: PHPUnit (Core)
needs: build-cache
uses: christopher-learningpool/github-actions/.github/workflows/workflow_unit.yml@main
with:
directory: core
testsuites: '["Project-Test-Suite"]'
coverage: true
phpunitAPI:
name: PHPUnit (API)
needs: build-cache
uses: christopher-learningpool/github-actions/.github/workflows/workflow_unit.yml@main
with:
directory: api
testsuites: '["api-testsuite-1","api-testsuite-2"]'
coverage: true
coverage-report:
name: Coverage Reporting
needs: [phpunitCore, phpunitAPI]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- run: mkdir coveragetmp
- uses: actions/download-artifact@v3
with:
name: coverage-report
path: ./coveragetmp
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '7.4'
tools: composer:v1
- name: Get composer cache directory
id: composer-cache
working-directory: ./core
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
- name: Cache Composer dependencies
uses: actions/cache@v2
id: cache
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-${{ hashFiles('./coveragetmp/composer.lock') }} }}
- working-directory: ./coveragetmp
run: composer require --dev phpunit/phpcov:7.0.2
- run: ./coveragetmp/vendor/bin/phpcov merge --html ./coveragetmp/report ./coveragetmp
- name: Upload full coverage artifact
uses: actions/upload-artifact@v3
with:
name: Core-API-HTML-Coverage-Report
path: ./coveragetmp/report
retention-days: 2
release:
if: github.ref == 'refs/heads/main'
name: Release
runs-on: ubuntu-latest
timeout-minutes: 20
steps:
- uses: actions/checkout@v3
with:
token: ${{ secrets.CI_GH_TOKEN }}
- uses: actions/setup-node@v3
with:
node-version: '16'
cache: 'npm'
- run: npm ci
- run: npx semantic-release
env:
GITHUB_TOKEN: ${{ secrets.CI_GH_TOKEN }}
# - name: Generate Slack Report
# working-directory: ./coveragetmp
# id: slack-report
# run: |
# echo "::set-output name=summary::$(./vendor/bin/phpcov merge --text -- ./ |
# sed -ne '/Code Coverage Report:/,$p' |
# sed -n 5,7p | sed 's/ //g' |
# sed 's/:(/: (/g' | jq -R -sc 'split("\n")[:-1]')"
# - run: echo '${{fromJSON(steps.slack-report.outputs.summary)[0]}}'
# - run: echo '${{ github }}'