-
Notifications
You must be signed in to change notification settings - Fork 9
118 lines (116 loc) · 4.03 KB
/
phpunit.yml
File metadata and controls
118 lines (116 loc) · 4.03 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
name: PHPUnit
on:
workflow_call:
inputs:
extensionName:
description: "Your extension name"
required: true
type: string
shopwareVersion:
description: |
With the default `.auto`, the workflow tries to find a shopware version using the shopware-version action.
For example, if the current ref is next-1234, it will try to find the ref next-1234 in shopware/shopware. If there's no matching ref, it will use shopwareVersionFallback
required: false
type: string
default: ".auto"
shopwareVersionFallback:
required: false
type: string
default: trunk
shopware-repository:
description: The shopware repository to checkout
type: string
default: shopware/shopware
phpVersion:
required: false
type: string
default: "8.2"
mysqlVersion:
required: false
type: string
default: "builtin"
composerRootVersion:
required: false
type: string
default: ".auto"
dependencies:
required: false
type: string
uploadCoverage:
description: "Upload coverage to codecov"
required: false
type: boolean
default: false
runner:
required: false
type: string
default: ubuntu-latest
filterName:
description: "PHPUnit 11 requires a testsuite filter"
required: false
type: string
default: ""
secrets:
codecovToken:
description: "Codecov token"
required: false
env:
description: "ENV variables to substitute in to plugin repository urls"
required: false
jobs:
run:
name: Tests
runs-on: ${{ inputs.runner }}
steps:
- uses: shopware/github-actions/shopware-version@main
with:
fallback: ${{ inputs.shopwareVersionFallback }}
repo: ${{ inputs.shopware-repository }}
id: version
if: ${{ inputs.shopwareVersion == '.auto' || inputs.shopwareVersion == '' }}
- name: Setup Shopware
uses: shopware/setup-shopware@main
with:
shopware-version: ${{ steps.version.outputs.shopware-version || inputs.shopwareVersion }}
shopware-repository: ${{ inputs.shopware-repository }}
php-version: ${{ inputs.phpVersion }}
mysql-version: ${{ inputs.mysqlVersion }}
composer-root-version: ${{ inputs.composerRootVersion }}
php-extensions: pcov
- name: Clone Extension
uses: actions/checkout@v6
with:
path: custom/plugins/${{ inputs.extensionName }}
- name: Clone Dependencies
if: inputs.dependencies
env:
DEPS: ${{ inputs.dependencies }}
run: |
IFS=$'\n'
for token in $(echo "${{secrets.env}}"); do
export $token
done
for dep in $(echo "$DEPS" | envsubst | jq -c '.[]'); do
dep_name=$(echo "$dep" | jq -r '.name')
dep_repo=$(echo "$dep" | jq -r '.repo')
git clone "$dep_repo" "custom/plugins/$dep_name"
done
- name: Install extension with Composer
run: composer require $(composer -d custom/plugins/${{ inputs.extensionName }} config name)
- name: Run PHPUnit
working-directory: custom/plugins/${{ inputs.extensionName }}
run: |
if [ -n "${{ inputs.filterName }}" ]; then
${{ github.workspace }}/vendor/bin/phpunit --testsuite ${{ inputs.filterName }} --coverage-clover clover.xml
else
${{ github.workspace }}/vendor/bin/phpunit --coverage-clover clover.xml
fi
- name: Upload Coverage
if: inputs.uploadCoverage == true
uses: codecov/codecov-action@v5
env:
CODECOV_TOKEN: ${{ secrets.codecovToken }}
with:
root_dir: ${{ github.workspace }}/custom/plugins/${{ inputs.extensionName }}
working-directory: ${{ github.workspace }}/custom/plugins/${{ inputs.extensionName }}
files: ./clover.xml