Skip to content

Commit 10d0f15

Browse files
committed
phpunit setup
Signed-off-by: Robin Appelman <robin@icewind.nl>
1 parent 28d132f commit 10d0f15

6 files changed

Lines changed: 2459 additions & 350 deletions

File tree

.github/workflows/phpunit.yml

Lines changed: 193 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,193 @@
1+
name: PHPUnit
2+
on: [push, pull_request]
3+
4+
env:
5+
APP_NAME: notify_push
6+
7+
jobs:
8+
php:
9+
runs-on: ubuntu-latest
10+
11+
strategy:
12+
# do not stop on another job's failure
13+
fail-fast: false
14+
matrix:
15+
php-versions: ['7.4']
16+
databases: ['sqlite']
17+
server-versions: ['stable21', 'stable22', 'master']
18+
19+
name: php${{ matrix.php-versions }}-${{ matrix.databases }}-${{ matrix.server-versions }}
20+
21+
steps:
22+
- name: Checkout server
23+
uses: actions/checkout@v2
24+
with:
25+
repository: nextcloud/server
26+
ref: ${{ matrix.server-versions }}
27+
28+
- name: Checkout submodules
29+
shell: bash
30+
run: |
31+
auth_header="$(git config --local --get http.https://github.com/.extraheader)"
32+
git submodule sync --recursive
33+
git -c "http.extraheader=$auth_header" -c protocol.version=2 submodule update --init --force --recursive --depth=1
34+
- name: Checkout app
35+
uses: actions/checkout@v2
36+
with:
37+
path: apps/${{ env.APP_NAME }}
38+
39+
- name: Set up php ${{ matrix.php-versions }}
40+
uses: shivammathur/setup-php@v2
41+
with:
42+
php-version: ${{ matrix.php-versions }}
43+
tools: phpunit
44+
extensions: mbstring, iconv, fileinfo, intl, sqlite, pdo_sqlite, zip, gd, inotify
45+
46+
- name: Set up PHPUnit
47+
working-directory: apps/${{ env.APP_NAME }}
48+
run: composer i
49+
50+
- name: Set up Nextcloud
51+
env:
52+
DB_PORT: 4444
53+
run: |
54+
mkdir data
55+
./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
56+
./occ app:enable --force files_external
57+
./occ app:enable --force ${{ env.APP_NAME }}
58+
php -S localhost:8080 &
59+
- name: PHPUnit
60+
working-directory: apps/${{ env.APP_NAME }}
61+
run: ./vendor/phpunit/phpunit/phpunit -c tests/phpunit.xml
62+
63+
mysql:
64+
runs-on: ubuntu-latest
65+
66+
strategy:
67+
# do not stop on another job's failure
68+
fail-fast: false
69+
matrix:
70+
php-versions: ['7.4']
71+
databases: ['mysql']
72+
server-versions: ['master']
73+
74+
name: php${{ matrix.php-versions }}-${{ matrix.databases }}-${{ matrix.server-versions }}
75+
76+
services:
77+
mysql:
78+
image: mariadb:10.5
79+
ports:
80+
- 4444:3306/tcp
81+
env:
82+
MYSQL_ROOT_PASSWORD: rootpassword
83+
options: --health-cmd="mysqladmin ping" --health-interval 5s --health-timeout 2s --health-retries 5
84+
85+
steps:
86+
- name: Checkout server
87+
uses: actions/checkout@v2
88+
with:
89+
repository: nextcloud/server
90+
ref: ${{ matrix.server-versions }}
91+
92+
- name: Checkout submodules
93+
shell: bash
94+
run: |
95+
auth_header="$(git config --local --get http.https://github.com/.extraheader)"
96+
git submodule sync --recursive
97+
git -c "http.extraheader=$auth_header" -c protocol.version=2 submodule update --init --force --recursive --depth=1
98+
- name: Checkout app
99+
uses: actions/checkout@v2
100+
with:
101+
path: apps/${{ env.APP_NAME }}
102+
103+
- name: Set up php ${{ matrix.php-versions }}
104+
uses: shivammathur/setup-php@v2
105+
with:
106+
php-version: ${{ matrix.php-versions }}
107+
tools: phpunit
108+
extensions: mbstring, iconv, fileinfo, intl, mysql, pdo_mysql, zip, gd, inotify
109+
coverage: none
110+
111+
- name: Set up PHPUnit
112+
working-directory: apps/${{ env.APP_NAME }}
113+
run: composer i
114+
115+
- name: Set up Nextcloud
116+
env:
117+
DB_PORT: 4444
118+
run: |
119+
mkdir data
120+
./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
121+
./occ app:enable --force files_external
122+
./occ app:enable --force ${{ env.APP_NAME }}
123+
php -S localhost:8080 &
124+
- name: PHPUnit
125+
working-directory: apps/${{ env.APP_NAME }}
126+
run: ./vendor/phpunit/phpunit/phpunit -c tests/phpunit.xml
127+
128+
pgsql:
129+
runs-on: ubuntu-latest
130+
131+
strategy:
132+
# do not stop on another job's failure
133+
fail-fast: false
134+
matrix:
135+
php-versions: ['7.4']
136+
databases: ['pgsql']
137+
server-versions: ['master']
138+
139+
name: php${{ matrix.php-versions }}-${{ matrix.databases }}-${{ matrix.server-versions }}
140+
141+
services:
142+
postgres:
143+
image: postgres
144+
ports:
145+
- 4444:5432/tcp
146+
env:
147+
POSTGRES_USER: root
148+
POSTGRES_PASSWORD: rootpassword
149+
POSTGRES_DB: nextcloud
150+
options: --health-cmd pg_isready --health-interval 5s --health-timeout 2s --health-retries 5
151+
152+
steps:
153+
- name: Checkout server
154+
uses: actions/checkout@v2
155+
with:
156+
repository: nextcloud/server
157+
ref: ${{ matrix.server-versions }}
158+
159+
- name: Checkout submodules
160+
shell: bash
161+
run: |
162+
auth_header="$(git config --local --get http.https://github.com/.extraheader)"
163+
git submodule sync --recursive
164+
git -c "http.extraheader=$auth_header" -c protocol.version=2 submodule update --init --force --recursive --depth=1
165+
- name: Checkout app
166+
uses: actions/checkout@v2
167+
with:
168+
path: apps/${{ env.APP_NAME }}
169+
170+
- name: Set up php ${{ matrix.php-versions }}
171+
uses: shivammathur/setup-php@v2
172+
with:
173+
php-version: ${{ matrix.php-versions }}
174+
tools: phpunit
175+
extensions: mbstring, iconv, fileinfo, intl, pgsql, pdo_pgsql, zip, gd, inotify
176+
coverage: none
177+
178+
- name: Set up PHPUnit
179+
working-directory: apps/${{ env.APP_NAME }}
180+
run: composer i
181+
182+
- name: Set up Nextcloud
183+
env:
184+
DB_PORT: 4444
185+
run: |
186+
mkdir data
187+
./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
188+
./occ app:enable --force files_external
189+
./occ app:enable --force ${{ env.APP_NAME }}
190+
php -S localhost:8080 &
191+
- name: PHPUnit
192+
working-directory: apps/${{ env.APP_NAME }}
193+
run: ./vendor/phpunit/phpunit/phpunit -c tests/phpunit.xml

composer.json

Lines changed: 25 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,27 @@
11
{
2-
"name": "nextcloud/text",
3-
"type": "project",
4-
"require-dev": {
5-
"roave/security-advisories": "dev-master",
6-
"christophwurst/nextcloud": "dev-master",
7-
"php-parallel-lint/php-parallel-lint": "^1.0.0",
8-
"nextcloud/coding-standard": "^0.4.0",
9-
"psalm/phar": "^4.3"
10-
},
11-
"license": "AGPLv3",
12-
"authors": [
13-
{
14-
"name": "Julius Härtl",
15-
"email": "jus@bitgrid.net"
16-
}
17-
],
18-
"require": {},
19-
"scripts": {
20-
"lint": "parallel-lint --exclude src --exclude vendor --exclude target --exclude build .",
21-
"cs:check": "php-cs-fixer fix --dry-run --diff",
22-
"cs:fix": "php-cs-fixer fix",
23-
"psalm": "psalm.phar"
24-
}
2+
"name": "nextcloud/text",
3+
"type": "project",
4+
"require-dev": {
5+
"roave/security-advisories": "dev-master",
6+
"christophwurst/nextcloud": "dev-master",
7+
"php-parallel-lint/php-parallel-lint": "^1.0.0",
8+
"phpunit/phpunit": "^8",
9+
"nextcloud/coding-standard": "^0.4.0",
10+
"psalm/phar": "^4.3",
11+
"psr/cache": "^1.0.1"
12+
},
13+
"license": "AGPLv3",
14+
"authors": [
15+
{
16+
"name": "Julius Härtl",
17+
"email": "jus@bitgrid.net"
18+
}
19+
],
20+
"require": {},
21+
"scripts": {
22+
"lint": "parallel-lint --exclude src --exclude vendor --exclude target --exclude build .",
23+
"cs:check": "php-cs-fixer fix --dry-run --diff",
24+
"cs:fix": "php-cs-fixer fix",
25+
"psalm": "psalm.phar"
26+
}
2527
}

0 commit comments

Comments
 (0)