Skip to content
This repository was archived by the owner on May 21, 2024. It is now read-only.

Commit 696ce94

Browse files
authored
Merge pull request #144 from nextcloud/install-check
Check installation of the app
2 parents 7d43273 + 4e3dbff commit 696ce94

File tree

1 file changed

+120
-0
lines changed

1 file changed

+120
-0
lines changed

.github/workflows/phpunit-sqlite.yml

+120
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+
- main
13+
- master
14+
- stable*
15+
16+
permissions:
17+
contents: read
18+
19+
env:
20+
# Location of the phpunit.xml and phpunit.integration.xml files
21+
PHPUNIT_CONFIG: ./tests/phpunit.xml
22+
PHPUNIT_INTEGRATION_CONFIG: ./tests/phpunit.integration.xml
23+
24+
jobs:
25+
phpunit-sqlite:
26+
runs-on: ubuntu-latest
27+
28+
strategy:
29+
matrix:
30+
php-versions: ['7.4', '8.0', '8.1']
31+
server-versions: ['master']
32+
33+
steps:
34+
- name: Set app env
35+
run: |
36+
# Split and keep last
37+
echo "APP_NAME=${GITHUB_REPOSITORY##*/}" >> $GITHUB_ENV
38+
39+
- name: Checkout server
40+
uses: actions/checkout@v3
41+
with:
42+
submodules: true
43+
repository: nextcloud/server
44+
ref: ${{ matrix.server-versions }}
45+
46+
- name: Checkout app
47+
uses: actions/checkout@v3
48+
with:
49+
path: apps/${{ env.APP_NAME }}
50+
51+
- name: Set up php ${{ matrix.php-versions }}
52+
uses: shivammathur/setup-php@v2
53+
with:
54+
php-version: ${{ matrix.php-versions }}
55+
tools: phpunit
56+
extensions: mbstring, iconv, fileinfo, intl, sqlite, pdo_sqlite
57+
coverage: none
58+
59+
- name: Check composer file existence
60+
id: check_composer
61+
uses: andstor/file-existence-action@v1
62+
with:
63+
files: apps/${{ env.APP_NAME }}/composer.json
64+
65+
- name: Set up PHPUnit
66+
# Only run if phpunit config file exists
67+
if: steps.check_composer.outputs.files_exists == 'true'
68+
working-directory: apps/${{ env.APP_NAME }}
69+
run: composer i
70+
71+
- name: Set up Nextcloud
72+
env:
73+
DB_PORT: 4444
74+
run: |
75+
mkdir data
76+
./occ maintenance:install --verbose --database=sqlite --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
77+
./occ app:enable ${{ env.APP_NAME }}
78+
79+
- name: Check PHPUnit config file existence
80+
id: check_phpunit
81+
uses: andstor/file-existence-action@v1
82+
with:
83+
files: apps/${{ env.APP_NAME }}/${{ env.PHPUNIT_CONFIG }}
84+
85+
- name: PHPUnit
86+
# Only run if phpunit config file exists
87+
if: steps.check_phpunit.outputs.files_exists == 'true'
88+
working-directory: apps/${{ env.APP_NAME }}
89+
run: ./vendor/phpunit/phpunit/phpunit -c ${{ env.PHPUNIT_CONFIG }}
90+
91+
- name: Check PHPUnit integration config file existence
92+
id: check_integration
93+
uses: andstor/file-existence-action@v1
94+
with:
95+
files: apps/${{ env.APP_NAME }}/${{ env.PHPUNIT_INTEGRATION_CONFIG }}
96+
97+
- name: Run Nextcloud
98+
# Only run if phpunit integration config file exists
99+
if: steps.check_integration.outputs.files_exists == 'true'
100+
run: php -S localhost:8080 &
101+
102+
- name: PHPUnit integration
103+
# Only run if phpunit integration config file exists
104+
if: steps.check_integration.outputs.files_exists == 'true'
105+
working-directory: apps/${{ env.APP_NAME }}
106+
run: ./vendor/phpunit/phpunit/phpunit -c ${{ env.PHPUNIT_INTEGRATION_CONFIG }}
107+
108+
summary:
109+
permissions:
110+
contents: none
111+
runs-on: ubuntu-latest
112+
needs: phpunit-sqlite
113+
114+
if: always()
115+
116+
name: phpunit-sqlite-summary
117+
118+
steps:
119+
- name: Summary status
120+
run: if ${{ needs.phpunit-sqlite.result != 'success' }}; then exit 1; fi

0 commit comments

Comments
 (0)