-
Notifications
You must be signed in to change notification settings - Fork 55
180 lines (151 loc) · 6.06 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
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
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
# SPDX-FileCopyrightText: 2020 Nextcloud GmbH and Nextcloud contributors
# SPDX-License-Identifier: MIT
name: Test
on:
pull_request:
branches:
- main
- master
- stable*
jobs:
unit-tests:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
php-version: [ "8.1" ]
nextcloud-version: [ 'master' ]
db: ['sqlite']
name: Nextcloud ${{ matrix.nextcloud-version }} php${{ matrix.php-version }} unit tests
steps:
- name: Set up php${{ matrix.php-version }}
uses: shivammathur/setup-php@7fdd3ece872ec7ec4c098ae5ab7637d5e0a96067 # v2
with:
php-version: ${{ matrix.php-version }}
extensions: ctype,curl,dom,gd,iconv,intl,json,mbstring,openssl,posix,sqlite,xml,zip
coverage: xdebug
- name: Checkout Nextcloud
run: git clone https://github.com/nextcloud/server.git --recursive --depth 1 -b ${{ matrix.nextcloud-version }} nextcloud
- name: Install Nextcloud
run: php -f nextcloud/occ maintenance:install --database-host 127.0.0.1 --database-name nextcloud --database-user nextcloud --database-pass nextcloud --admin-user admin --admin-pass admin --database ${{ matrix.db }}
- name: Checkout app
uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3
with:
path: nextcloud/apps/twofactor_totp
- name: Install dependencies
working-directory: nextcloud/apps/twofactor_totp
run: composer install
- name: Run tests
working-directory: nextcloud/apps/twofactor_totp
run: composer run test:unit
- name: Report coverage
uses: codecov/codecov-action@ab904c41d6ece82784817410c45d8b8c02684457 # v3
if: ${{ always() }}
with:
token: ${{ secrets.CODECOV_TOKEN }}
file: ./nextcloud/apps/twofactor_totp/tests/clover.xml
flags: unittests
fail_ci_if_error: true
acceptance-tests:
concurrency:
group: acceptance-tests-${{ github.head_ref || github.run_id }}
cancel-in-progress: true
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
php-version: [ "8.1" ]
nextcloud-version: [ 'master' ]
browser: [ 'firefox' ]
db: [ 'mysql' ]
name: Nextcloud ${{ matrix.nextcloud-version }} acceptance tests on php${{ matrix.php-version }}/${{ matrix.browser }}/${{ matrix.db }}
services:
mysql-service:
image: mariadb:10.11
env:
MYSQL_ROOT_PASSWORD: my-secret-pw
MYSQL_DATABASE: nextcloud
MYSQL_USER: nextcloud
MYSQL_PASSWORD: nextcloud
ports:
- 3306:3306
options: >-
--health-cmd="mysqladmin ping"
--health-interval=10s
--health-timeout=5s
--health-retries=3
postgres-service:
image: postgres:15
env:
POSTGRES_USER: nextcloud
POSTGRES_DB: nextcloud
POSTGRES_PASSWORD: nextcloud
ports:
- 5432:5432
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
steps:
- name: Set up php${{ matrix.php-version }}
uses: shivammathur/setup-php@7fdd3ece872ec7ec4c098ae5ab7637d5e0a96067 # v2
with:
php-version: ${{ matrix.php-version }}
extensions: ctype,curl,dom,gd,iconv,intl,json,mbstring,openssl,posix,sqlite,xml,zip
coverage: none
- name: Checkout Nextcloud
run: git clone https://github.com/nextcloud/server.git --recursive --depth 1 -b ${{ matrix.nextcloud-version }} nextcloud
- name: Checkout
uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3
with:
path: nextcloud/apps/twofactor_totp
- name: Read package.json node and npm engines version
uses: skjnldsv/read-package-engines-version-actions@0ce2ed60f6df073a62a77c0a4958dd0fc68e32e7 # v2.1
id: versions
with:
path: nextcloud/apps/twofactor_totp
fallbackNode: '^12'
fallbackNpm: '^6'
- name: Set up node ${{ steps.versions.outputs.nodeVersion }}
uses: actions/setup-node@1a4442cacd436585916779262731d5b162bc6ec7 # v3
with:
node-version: ${{ steps.versions.outputs.nodeVersion }}
- name: Set up npm ${{ steps.versions.outputs.npmVersion }}
run: npm i -g npm@"${{ steps.versions.outputs.npmVersion }}"
- name: Install Nextcloud
run: php -f nextcloud/occ maintenance:install --database-host 127.0.0.1 --database-name nextcloud --database-user nextcloud --database-pass nextcloud --admin-user admin --admin-pass admin --database ${{ matrix.db }}
- name: Checkout app
uses: actions/checkout@master
with:
path: nextcloud/apps/twofactor_totp
- name: Install dependencies
working-directory: nextcloud/apps/twofactor_totp
run: |
composer install
npm ci
- name: Build the app
working-directory: nextcloud/apps/twofactor_totp
run: npm run build
- name: Install the app
run: php -f nextcloud/occ app:enable twofactor_totp
- name: Start Nextcloud web server
working-directory: nextcloud
run: php -S 0.0.0.0:8080 &
- name: Connect to sauce
uses: saucelabs/sauce-connect-action@main
with:
username: ${{ secrets.SAUCE_USERNAME }}
accessKey: ${{ secrets.SAUCE_ACCESS_KEY }}
tunnelIdentifier: "${{ github.run_id }}-${{ matrix.nextcloud-version }}-php${{ matrix.php-version }}-${{ matrix.browser }}"
- name: Run tests
working-directory: nextcloud/apps/twofactor_totp
run: composer run test:acceptance
env:
SAUCE_USERNAME: ${{ secrets.SAUCE_USERNAME }}
SAUCE_ACCESS_KEY: ${{ secrets.SAUCE_ACCESS_KEY }}
SAUCE_TUNNEL_ID: "${{ github.run_id }}-${{ matrix.nextcloud-version }}-php${{ matrix.php-version }}-${{ matrix.browser }}"
SELENIUM_BROWSER: ${{ matrix.browser }}
env:
CI: true
TRAVIS: true