Skip to content

Commit 35c87d5

Browse files
committed
Update phpunit workflows
Signed-off-by: John Molakvoæ <skjnldsv@protonmail.com>
1 parent 003c404 commit 35c87d5

7 files changed

Lines changed: 462 additions & 266 deletions

File tree

.github/workflows/oci.yml

Lines changed: 0 additions & 66 deletions
This file was deleted.
Lines changed: 120 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,120 @@
1+
# This workflow is provided via the organization template repository
2+
#
3+
# https://github.com/nextcloud/.github
4+
# https://docs.github.com/en/actions/learn-github-actions/sharing-workflows-with-your-organization
5+
6+
name: PHPUnit
7+
8+
on:
9+
pull_request:
10+
push:
11+
branches:
12+
- master
13+
- stable*
14+
15+
env:
16+
# Location of the phpunit.xml and phpunit.integration.xml files
17+
PHPUNIT_CONFIG: ./tests/phpunit.xml
18+
PHPUNIT_INTEGRATION_CONFIG: ./tests/phpunit.integration.xml
19+
20+
jobs:
21+
phpunit-mysql:
22+
runs-on: ubuntu-latest
23+
24+
strategy:
25+
matrix:
26+
php-versions: ['7.4', '8.0', '8.1']
27+
server-versions: ["${{ github.base_ref }}"]
28+
29+
services:
30+
mysql:
31+
image: mariadb:10.5
32+
ports:
33+
- 4444:3306/tcp
34+
env:
35+
MYSQL_ROOT_PASSWORD: rootpassword
36+
options: --health-cmd="mysqladmin ping" --health-interval 5s --health-timeout 2s --health-retries 5
37+
38+
steps:
39+
- name: Set app env
40+
run: |
41+
# Split and keep last
42+
echo "APP_NAME=${GITHUB_REPOSITORY##*/}" >> $GITHUB_ENV
43+
44+
- name: Enable ONLY_FULL_GROUP_BY MySQL option
45+
run: |
46+
echo "SET GLOBAL sql_mode=(SELECT CONCAT(@@sql_mode,',ONLY_FULL_GROUP_BY'));" | mysql -h 127.0.0.1 -P 4444 -u root -prootpassword
47+
echo "SELECT @@sql_mode;" | mysql -h 127.0.0.1 -P 4444 -u root -prootpassword
48+
49+
- name: Checkout server
50+
uses: actions/checkout@v3
51+
with:
52+
submodules: true
53+
repository: nextcloud/server
54+
ref: ${{ matrix.server-versions }}
55+
56+
- name: Checkout app
57+
uses: actions/checkout@v3
58+
with:
59+
path: apps/${{ env.APP_NAME }}
60+
61+
- name: Set up php ${{ matrix.php-versions }}
62+
uses: shivammathur/setup-php@v2
63+
with:
64+
php-version: ${{ matrix.php-versions }}
65+
tools: phpunit
66+
extensions: mbstring, iconv, fileinfo, intl, mysql, pdo_mysql
67+
coverage: none
68+
69+
- name: Set up PHPUnit
70+
working-directory: apps/${{ env.APP_NAME }}
71+
run: composer i
72+
73+
- name: Set up Nextcloud
74+
env:
75+
DB_PORT: 4444
76+
run: |
77+
mkdir data
78+
./occ maintenance:install --verbose --database=mysql --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
79+
./occ app:enable ${{ env.APP_NAME }}
80+
81+
- name: Check PHPUnit config file existence
82+
id: check_phpunit
83+
uses: andstor/file-existence-action@v1
84+
with:
85+
files: apps/${{ env.APP_NAME }}/${{ env.PHPUNIT_CONFIG }}
86+
87+
- name: PHPUnit
88+
# Only run if phpunit config file exists
89+
if: steps.check_phpunit.outputs.files_exists == 'true'
90+
working-directory: apps/${{ env.APP_NAME }}
91+
run: ./vendor/phpunit/phpunit/phpunit -c ${{ env.PHPUNIT_CONFIG }}
92+
93+
- name: Check PHPUnit integration config file existence
94+
id: check_integration
95+
uses: andstor/file-existence-action@v1
96+
with:
97+
files: apps/${{ env.APP_NAME }}/${{ env.PHPUNIT_INTEGRATION_CONFIG }}
98+
99+
- name: Run Nextcloud
100+
# Only run if phpunit integration config file exists
101+
if: steps.check_integration.outputs.files_exists == 'true'
102+
run: php -S localhost:8080 &
103+
104+
- name: PHPUnit integration
105+
# Only run if phpunit integration config file exists
106+
if: steps.check_integration.outputs.files_exists == 'true'
107+
working-directory: apps/${{ env.APP_NAME }}
108+
run: ./vendor/phpunit/phpunit/phpunit -c ${{ env.PHPUNIT_INTEGRATION_CONFIG }}
109+
110+
summary:
111+
runs-on: ubuntu-latest
112+
needs: phpunit-mysql
113+
114+
if: always()
115+
116+
name: phpunit-mysql-summary
117+
118+
steps:
119+
- name: Summary status
120+
run: if ${{ needs.phpunit-mysql.result != 'success' }}; then exit 1; fi

.github/workflows/phpunit-oci.yml

Lines changed: 112 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,112 @@
1+
# This workflow is provided via the organization template repository
2+
#
3+
# https://github.com/nextcloud/.github
4+
# https://docs.github.com/en/actions/learn-github-actions/sharing-workflows-with-your-organization
5+
6+
name: PHPUnit
7+
8+
on:
9+
pull_request:
10+
push:
11+
branches:
12+
- master
13+
- stable*
14+
15+
env:
16+
# Location of the phpunit.xml and phpunit.integration.xml files
17+
PHPUNIT_CONFIG: ./tests/phpunit.xml
18+
PHPUNIT_INTEGRATION_CONFIG: ./tests/phpunit.integration.xml
19+
20+
jobs:
21+
phpunit-oci:
22+
runs-on: ubuntu-20.04
23+
24+
strategy:
25+
matrix:
26+
php-versions: ['8.0']
27+
server-versions: ["${{ github.base_ref }}"]
28+
29+
services:
30+
oracle:
31+
image: deepdiver/docker-oracle-xe-11g # 'wnameless/oracle-xe-11g-r2'
32+
ports:
33+
- 1521:1521/tcp
34+
35+
steps:
36+
- name: Set app env
37+
run: |
38+
# Split and keep last
39+
echo "APP_NAME=${GITHUB_REPOSITORY##*/}" >> $GITHUB_ENV
40+
41+
- name: Checkout server
42+
uses: actions/checkout@v3
43+
with:
44+
submodules: true
45+
repository: nextcloud/server
46+
ref: ${{ matrix.server-versions }}
47+
48+
- name: Checkout app
49+
uses: actions/checkout@v3
50+
with:
51+
path: apps/${{ env.APP_NAME }}
52+
53+
- name: Set up php ${{ matrix.php-versions }}
54+
uses: shivammathur/setup-php@v2
55+
with:
56+
php-version: ${{ matrix.php-versions }}
57+
extensions: mbstring, fileinfo, intl, sqlite, pdo_sqlite, oci8
58+
tools: phpunit
59+
coverage: none
60+
61+
- name: Set up PHPUnit
62+
working-directory: apps/${{ env.APP_NAME }}
63+
run: composer i
64+
65+
- name: Set up Nextcloud
66+
env:
67+
DB_PORT: 1521
68+
run: |
69+
mkdir data
70+
./occ maintenance:install --verbose --database=oci --database-name=XE --database-host=127.0.0.1 --database-port=$DB_PORT --database-user=autotest --database-pass=owncloud --admin-user admin --admin-pass admin
71+
./occ app:enable ${{ env.APP_NAME }}
72+
73+
- name: Check PHPUnit config file existence
74+
id: check_phpunit
75+
uses: andstor/file-existence-action@v1
76+
with:
77+
files: apps/${{ env.APP_NAME }}/${{ env.PHPUNIT_CONFIG }}
78+
79+
- name: PHPUnit
80+
# Only run if phpunit config file exists
81+
if: steps.check_phpunit.outputs.files_exists == 'true'
82+
working-directory: apps/${{ env.APP_NAME }}
83+
run: ./vendor/phpunit/phpunit/phpunit -c ${{ env.PHPUNIT_CONFIG }}
84+
85+
- name: Check PHPUnit integration config file existence
86+
id: check_integration
87+
uses: andstor/file-existence-action@v1
88+
with:
89+
files: apps/${{ env.APP_NAME }}/${{ env.PHPUNIT_INTEGRATION_CONFIG }}
90+
91+
- name: Run Nextcloud
92+
# Only run if phpunit integration config file exists
93+
if: steps.check_integration.outputs.files_exists == 'true'
94+
run: php -S localhost:8080 &
95+
96+
- name: PHPUnit integration
97+
# Only run if phpunit integration config file exists
98+
if: steps.check_integration.outputs.files_exists == 'true'
99+
working-directory: apps/${{ env.APP_NAME }}
100+
run: ./vendor/phpunit/phpunit/phpunit -c ${{ env.PHPUNIT_INTEGRATION_CONFIG }}
101+
102+
summary:
103+
runs-on: ubuntu-latest
104+
needs: phpunit-oci
105+
106+
if: always()
107+
108+
name: phpunit-oci-summary
109+
110+
steps:
111+
- name: Summary status
112+
run: if ${{ needs.phpunit-oci.result != 'success' }}; then exit 1; fi

0 commit comments

Comments
 (0)