-
-
Notifications
You must be signed in to change notification settings - Fork 57
138 lines (127 loc) · 4.29 KB
/
phpunit.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
name: PHPUnit
on:
pull_request:
paths:
- '.github/workflows/**'
- 'appinfo/**'
- 'lib/**'
- 'templates/**'
- 'tests/**'
- 'vendor/**'
- 'vendor-bin/**'
- '.php-cs-fixer.dist.php'
- 'composer.json'
- 'composer.lock'
push:
branches:
- main
- master
- stable*
env:
APP_NAME: libresign
jobs:
phpunit:
runs-on: ubuntu-latest
strategy:
# do not stop on another job's failure
fail-fast: false
matrix:
php-versions: ['8.0', '8.1', '8.2']
databases: ['sqlite']
coverage: ['xdebug']
testsuite: [unit, api]
xdebug_mode: ['debug']
server-versions: ['stable28']
include:
- php-versions: '8.0'
databases: sqlite
coverage: xdebug
testsuite: default
xdebug_mode: debug
server-versions: stable28
name: php${{ matrix.php-versions }}-${{ matrix.databases }}-${{ matrix.server-versions }}-${{ matrix.testsuite }}
steps:
- name: Checkout server
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
with:
repository: nextcloud/server
ref: ${{ matrix.server-versions }}
- name: Checkout submodules
shell: bash
run: |
auth_header="$(git config --local --get http.https://github.com/.extraheader)"
git submodule sync --recursive
git -c "http.extraheader=$auth_header" -c protocol.version=2 submodule update --init --force --recursive --depth=1
- name: Checkout app
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
with:
path: apps/${{ env.APP_NAME }}
- name: Checkout site
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
with:
repository: libresign/libresign.github.io
path: 'apps/${{ env.APP_NAME }}/build/site'
- name: Set up php ${{ matrix.php-versions }}
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-versions }}
coverage: ${{ matrix.coverage }}
tools: phpunit
extensions: mbstring, iconv, fileinfo, intl, sqlite, pdo_sqlite
- name: Set up PHP dependencies
working-directory: apps/${{ env.APP_NAME }}
run: composer i
- name: Prevent Nextcloud OCP outdated
working-directory: apps/${{ env.APP_NAME }}
run: make updateocp
- name: Set up Nextcloud
env:
DB_PORT: 4444
run: |
mkdir data
./occ maintenance:install \
--verbose \
--database=${{ matrix.databases }} \
--database-name=nextcloud \
--database-host=127.0.0.1 \
--database-port=$DB_PORT \
--database-user=root \
--database-pass=rootpassword \
--admin-user=admin \
--admin-pass=password
- name: Enable app
run: |
./occ app:enable ${{ env.APP_NAME }}
- name: Start built in server
run: |
php -S localhost:8080 &
- name: Set up dependencies apps
run: |
./occ app:install --force --keep-disabled twofactor_gateway
./occ app:enable --force twofactor_gateway
- name: PHPUnit
working-directory: apps/${{ env.APP_NAME }}
env:
XDEBUG_MODE: ${{ matrix.xdebug_mode }}
run: ./vendor/bin/phpunit -c phpunit.xml --testsuite ${{ matrix.testsuite }}
upload-coverage:
needs: phpunit
runs-on: ubuntu-latest
steps:
- name: Upload coverage results to Coveralls
working-directory: apps/${{ env.APP_NAME }}
if: matrix.xdebug_mode == 'coverage'
env:
COVERALLS_REPO_TOKEN: ${{ secrets.GITHUB_TOKEN }}
COVERALLS_PARALLEL: true
COVERALLS_FLAG_NAME: php-${{ matrix.php-versions }}
run: vendor/bin/php-coveralls --coverage_clover=build/logs/clover.xml --json_path=build/logs/coveralls-upload.json -v
finish-coverage:
needs: upload-coverage
runs-on: ubuntu-latest
steps:
- name: Let Coveralls know that all tests have finished
uses: coverallsapp/github-action@v2.0.0
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
parallel-finished: true