-
Notifications
You must be signed in to change notification settings - Fork 7
194 lines (169 loc) · 7.54 KB
/
tests-deploy.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
181
182
183
184
185
186
187
188
189
190
191
192
193
194
name: Tests - Deploy
on:
pull_request:
paths:
- '.github/workflows/tests-deploy.yml'
- 'lib/**'
push:
branches: [main]
paths:
- '.github/workflows/tests-deploy.yml'
- 'lib/**'
workflow_dispatch:
jobs:
nc-host-app-docker:
runs-on: ubuntu-22.04
name: NC In Host • ${{ matrix.server-version }} • 🐘${{ matrix.php-version }}
strategy:
fail-fast: false
matrix:
php-version: [ '8.1' ]
server-version: [ 'stable27' ]
include:
- server-version: "master"
php-version: "8.2"
services:
postgres:
image: ghcr.io/nextcloud/continuous-integration-postgres-14:latest
ports:
- 4444:5432/tcp
env:
POSTGRES_USER: root
POSTGRES_PASSWORD: rootpassword
POSTGRES_DB: nextcloud
options: --health-cmd pg_isready --health-interval 5s --health-timeout 2s --health-retries 5
steps:
- name: Set app env
run: echo "APP_NAME=${GITHUB_REPOSITORY##*/}" >> $GITHUB_ENV
- name: Checkout server
uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
with:
submodules: true
repository: nextcloud/server
ref: ${{ matrix.server-version }}
- name: Checkout AppEcosystemV2
uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
with:
path: apps/${{ env.APP_NAME }}
- name: Set up php ${{ matrix.php-versions }}
uses: shivammathur/setup-php@4bd44f22a98a19e0950cbad5f31095157cc9621b # v2
with:
php-version: ${{ matrix.php-versions }}
extensions: bz2, ctype, curl, dom, fileinfo, gd, iconv, intl, json, libxml, mbstring, openssl, pcntl, posix, session, simplexml, xmlreader, xmlwriter, zip, zlib, pgsql, pdo_pgsql
coverage: none
ini-file: development
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Check composer file existence
id: check_composer
uses: andstor/file-existence-action@20b4d2e596410855db8f9ca21e96fbe18e12930b # v2
with:
files: apps/${{ env.APP_NAME }}/composer.json
- name: Set up dependencies
if: steps.check_composer.outputs.files_exists == 'true'
working-directory: apps/${{ env.APP_NAME }}
run: composer i
- name: Set up & run Nextcloud
env:
DB_PORT: 4444
run: |
mkdir data
./occ maintenance:install --verbose --database=pgsql --database-name=nextcloud --database-host=127.0.0.1 --database-port=$DB_PORT --database-user=root --database-pass=rootpassword --admin-user admin --admin-pass admin
./occ config:system:set loglevel --value=0 --type=integer
./occ config:system:set debug --value=true --type=boolean
./occ config:system:set allow_local_remote_servers --value true
./occ app:enable --force ${{ env.APP_NAME }}
- name: Test deploy
run: |
php -S localhost:8080 &
./occ app_ecosystem_v2:daemon:register docker-install Docker unix-socket /var/run/docker.sock http://localhost:8080/index.php
./occ app_ecosystem_v2:app:register \
"$(./occ app_ecosystem_v2:app:deploy app_python_skeleton 1 --info-xml https://raw.githubusercontent.com/cloud-py-api/py_app_v2-skeleton/main/appinfo/info.xml)"
./occ app_ecosystem_v2:app:enable app_python_skeleton
./occ app_ecosystem_v2:app:disable app_python_skeleton
- name: Check logs
run: |
fgrep -iq 'Hello from app_python_skeleton :)' data/nextcloud.log
fgrep -iq 'Bye bye from app_python_skeleton :(' data/nextcloud.log
- name: Save container ingo & logs
if: always()
run: |
docker inspect app_python_skeleton | json_pp > container.json
docker logs app_python_skeleton > container.log 2>&1
- name: Upload Container info
if: always()
uses: actions/upload-artifact@v3
with:
name: nc_host_app_docker_${{ matrix.server-version }}_${{ matrix.php-version }}_container.json
path: container.json
if-no-files-found: warn
- name: Upload Container logs
if: always()
uses: actions/upload-artifact@v3
with:
name: nc_host_app_docker_${{ matrix.server-version }}_${{ matrix.php-version }}_container.log
path: container.log
if-no-files-found: warn
- name: Upload NC logs
if: always()
uses: actions/upload-artifact@v3
with:
name: nc_host_app_docker_${{ matrix.server-version }}_${{ matrix.php-version }}_nextcloud.log
path: data/nextcloud.log
if-no-files-found: warn
nc-docker-app-docker:
runs-on: ubuntu-22.04
name: NC In Docker • ${{ docker-image }}
env:
docker-image: ghcr.io/juliushaertl/nextcloud-dev-php81:latest
steps:
- name: Create container
run: |
docker run --name nextcloud --rm -d -p 8080:80 -v /var/run/docker.sock:/var/run/docker.sock ${{ env.docker-image }}
sudo chmod /var/run/docker.sock 766
sleep 120s
- name: Install AppEcosystemV2
run: |
docker exec -w /var/www/html/apps nextcloud git clone https://github.com/cloud-py-api/app_ecosystem_v2.git
docker exec nextcloud patch -p 1 -i apps/app_ecosystem_v2/base_php.patch
docker exec nextcloud sudo -u www-data php occ app:enable app_ecosystem_v2
docker exec nextcloud sudo -u www-data php occ app_ecosystem_v2:daemon:register \
docker-install Docker unix-socket /var/run/docker.sock http://localhost:8080/index.php --net=bridge
docker exec nextcloud sudo -u www-data php occ app_ecosystem_v2:app:register
"$(./occ app_ecosystem_v2:app:deploy app_python_skeleton 1 --info-xml https://raw.githubusercontent.com/cloud-py-api/py_app_v2-skeleton/main/appinfo/info.xml)"
docker exec nextcloud sudo -u www-data php occ app_ecosystem_v2:app:enable app_python_skeleton
docker exec nextcloud sudo -u www-data php occ app_ecosystem_v2:app:disable app_python_skeleton
- name: Check logs
run: |
docker exec nextcloud sudo -u www-data fgrep -iq 'Hello from app_python_skeleton :)' data/nextcloud.log
docker exec nextcloud sudo -u www-data fgrep -iq 'Bye bye from app_python_skeleton :(' data/nextcloud.log
- name: Save container ingo & logs
if: always()
run: |
docker inspect app_python_skeleton | json_pp > container.json
docker logs app_python_skeleton > container.log 2>&1
docker cp /var/www/html/data/nextcloud.log nextcloud.log
- name: Upload Container info
if: always()
uses: actions/upload-artifact@v3
with:
name: nc_docker_app_docker_${{ matrix.server-version }}_${{ matrix.php-version }}_container.json
path: container.json
if-no-files-found: warn
- name: Upload Container logs
if: always()
uses: actions/upload-artifact@v3
with:
name: nc_docker_app_docker_${{ matrix.server-version }}_${{ matrix.php-version }}_container.log
path: container.log
if-no-files-found: warn
- name: Upload NC logs
if: always()
uses: actions/upload-artifact@v3
with:
name: nc_docker_app_docker_${{ matrix.server-version }}_${{ matrix.php-version }}_nextcloud.log
path: nextcloud.log
if-no-files-found: warn
- name: Setup tmate session
if: always()
uses: mxschmitt/action-tmate@v3