-
Notifications
You must be signed in to change notification settings - Fork 133
86 lines (83 loc) · 3.16 KB
/
test.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
name: Test
on:
push:
branches:
- main
- stable*
pull_request:
permissions:
contents: read
jobs:
test-api:
runs-on: ubuntu-latest
strategy:
matrix:
version: [min, max]
fail-fast: false
env:
SERVER_BRANCH: master
steps:
- name: Checkout
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332
- name: Determine PHP version
env:
VERSION_MINMAX: ${{ matrix.version }}
run: echo "PHP_VERSION=$(php tests/nextcloud-version.php --php-$VERSION_MINMAX)" >> $GITHUB_ENV
- name: Set up PHP ${{ env.PHP_VERSION }}
uses: shivammathur/setup-php@v2
with:
php-version: ${{ env.PHP_VERSION }}
extensions: pdo_mysql, zip, gd
tools: phpunit:9
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Install latest dev Nextcloud PHP API (max only)
if: matrix.version == 'max'
run: composer require --prefer-dist --dev nextcloud/ocp:dev-master
- name: Install Dependencies
run: composer install --prefer-dist
- name: Prepare MySQL database
run: |
sudo systemctl start mysql
mysql -u root -proot -e "CREATE DATABASE nextcloud;"
mysql -u root -proot -e "CREATE USER 'nextcloud'@'localhost' IDENTIFIED WITH mysql_native_password BY '';"
mysql -u root -proot -e "GRANT ALL ON nextcloud.* TO 'nextcloud'@'localhost';"
- name: Select stable Nextcloud server branch
if: matrix.version == 'min'
run: echo "SERVER_BRANCH=$(php tests/nextcloud-version.php --serverbranch)" >> $GITHUB_ENV
- name: Prepare Nextcloud server using ${{ env.SERVER_BRANCH }}
working-directory: ../
run: |
git clone https://github.com/nextcloud/server.git --recursive --depth 1 -b ${SERVER_BRANCH} server
cp -r notes server/apps/
- name: Setup Nextcloud server
working-directory: ../server/
run: |
php occ maintenance:install --database-name nextcloud --database-user nextcloud --admin-user admin --admin-pass admin --database mysql --database-pass=''
php occ -V
OC_PASS=test php occ user:add --password-from-env --display-name="Test" test
OC_PASS=test php occ user:add --password-from-env --display-name="QuotaTest" quotatest
php occ user:setting quotatest files quota "0"
- name: Setup Notes app
working-directory: ../server/
run: php occ app:enable notes
- name: Create some reference notes
working-directory: ../
run: |
mkdir -p server/data/test/files/
mkdir -p server/data/quotatest/files/
cp -r notes/tests/reference-notes server/data/test/files/Notes
cp -r notes/tests/reference-notes server/data/quotatest/files/Notes
chmod 444 server/data/test/files/Notes/ReadOnly/ReadOnly-Note.txt
php server/occ files:scan --all
- name: Start Nextcloud server
working-directory: ../server/
run: "php -S localhost:8080 > data/php.log 2>&1 &"
- name: Test API
run: make test-api
- name: Show nextcloud.log
if: always()
run: "cat ../server/data/nextcloud.log"
- name: Show php.log
if: always()
run: "cat ../server/data/php.log"