-
Notifications
You must be signed in to change notification settings - Fork 11
297 lines (269 loc) · 12.9 KB
/
solid-tests-suites.yml
File metadata and controls
297 lines (269 loc) · 12.9 KB
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
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
---
name: Solid Test Suites
env:
# Docker Hub digest (i.e. hash) of the used Docker Images that do not have a version tag.
PUBSUB_TAG: latest@sha256:b73a2a5c98d2005bb667dfc69d1c859d704366024298b9caa24ea2e182c456c2
COOKIE_TAG: latest@sha256:b2815496a1291a8f0f8bf2524c42d6000a4a1d6a202b319fe01e1afacf1cec7d
on:
push:
branches:
- main
pull_request:
branches: [ main ]
# Allow manually triggering the workflow.
workflow_dispatch:
# Cancels all previous workflow runs for the same branch that have not yet completed.
concurrency:
# The concurrency group contains the workflow name and the branch name.
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
docker-images:
outputs:
COOKIE_IMAGE: ${{ steps.images.outputs.COOKIE_IMAGE}}
COOKIE_KEY: ${{ steps.keys.outputs.COOKIE_KEY }}
PUBSUB_IMAGE: ${{ steps.images.outputs.PUBSUB_IMAGE }}
PUBSUB_KEY: ${{ steps.keys.outputs.PUBSUB_KEY }}
SOLID_CRUD_TESTS_IMAGE: ${{steps.images.outputs.SOLID_CRUD_TESTS_IMAGE}}
SOLID_CRUD_TESTS_KEY: ${{ steps.keys.outputs.SOLID_CRUD_TESTS_KEY }}
WEB_ACCESS_CONTROL_TESTS_IMAGE: ${{steps.images.outputs.WEB_ACCESS_CONTROL_TESTS_IMAGE}}
WEB_ACCESS_CONTROL_TESTS_KEY: ${{ steps.keys.outputs.WEB_ACCESS_CONTROL_TESTS_KEY }}
WEBID_PROVIDER_TESTS_IMAGE: ${{steps.images.outputs.WEBID_PROVIDER_TESTS_IMAGE}}
WEBID_PROVIDER_TESTS_KEY: ${{ steps.keys.outputs.WEBID_PROVIDER_TESTS_KEY }}
runs-on: ubuntu-latest
steps:
- id: images
run: |
echo "COOKIE_IMAGE='michielbdejong/nextcloud-cookie:${{ env.COOKIE_TAG }}'" >> "${GITHUB_OUTPUT}"
echo "PUBSUB_IMAGE='ghcr.io/pdsinterop/php-solid-pubsub-server:${{ env.PUBSUB_TAG }}'" >> "${GITHUB_OUTPUT}"
echo "SOLID_CRUD_TESTS_IMAGE=solidtestsuite/solid-crud-tests:v7.0.5" >> "${GITHUB_OUTPUT}"
echo "WEB_ACCESS_CONTROL_TESTS_IMAGE=solidtestsuite/web-access-control-tests:v7.1.0" >> "${GITHUB_OUTPUT}"
echo "WEBID_PROVIDER_TESTS_IMAGE=solidtestsuite/webid-provider-tests:v2.1.1" >> "${GITHUB_OUTPUT}"
- id: keys
run: |
echo "COOKIE_KEY=$(echo "${{ steps.images.outputs.COOKIE_IMAGE }}" \
| tr --complement --squeeze-repeats '[:alnum:]._-' '_')" >> "${GITHUB_OUTPUT}"
echo "PUBSUB_KEY=$(echo "${{ steps.images.outputs.PUBSUB_IMAGE }}" \
| tr --complement --squeeze-repeats '[:alnum:]._-' '_')" >> "${GITHUB_OUTPUT}"
echo "SOLID_CRUD_TESTS_KEY=$(echo "${{ steps.images.outputs.SOLID_CRUD_TESTS_IMAGE }}" \
| tr --complement --squeeze-repeats '[:alnum:]._-' '_')" >> "${GITHUB_OUTPUT}"
echo "WEB_ACCESS_CONTROL_TESTS_KEY=$(echo "${{ steps.images.outputs.WEB_ACCESS_CONTROL_TESTS_IMAGE }}" \
| tr --complement --squeeze-repeats '[:alnum:]._-' '_')" >> "${GITHUB_OUTPUT}"
echo "WEBID_PROVIDER_TESTS_KEY=$(echo "${{ steps.images.outputs.WEBID_PROVIDER_TESTS_IMAGE }}" \
| tr --complement --squeeze-repeats '[:alnum:]._-' '_')" >> "${GITHUB_OUTPUT}";
# @TODO: Instead of building the docker image here, take a pre-build image and mount the code?
# (only build when the Dockerfile changes) Or only push when tagged/main?
build-docker-nextcloud:
runs-on: ubuntu-latest
strategy:
matrix:
# For the latest version information see: https://github.com/nextcloud/server/wiki/Maintenance-and-Release-Schedule
# Versions before 22 are not tested as they run on PHP versions lower than 8.0
# Versions before 24 are not tested as they do not support `.well-known` entries
# Version 24 comes with PHP 8.0, which is no longer supported;
# Latest is not tested here, as that could cause failures unrelated to project changes
nextcloud_version:
- 28
- 29
- 30
steps:
- name: Create docker tag from git reference
# A tag name may only contain lower- and uppercase letters, digits, underscores, periods and dashes.
run: |
echo "TAG=$(echo -n "${{ github.ref_name }}-${{ matrix.nextcloud_version }}" \
| tr --complement --squeeze-repeats '[:alnum:]._-' '_')" \
>> "${GITHUB_ENV}"
- uses: actions/cache@v4
id: cache-docker-solid-nextcloud
with:
path: cache/solid-nextcloud
key: solid-nextcloud-docker-${{ matrix.nextcloud_version }}-${{ github.sha }}
- uses: actions/checkout@v4
- uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build Solid-Nextcloud Docker image from NC-${{ matrix.nextcloud_version }}
run: |
docker build \
--tag "solid-nextcloud:${{ env.TAG }}" \
--tag "ghcr.io/${{ github.repository }}:${{ env.TAG }}" \
--build-arg 'NEXTCLOUD_VERSION=${{ matrix.nextcloud_version }}' \
.
docker push "ghcr.io/${{ github.repository }}:${{ env.TAG }}"
mkdir -p cache/solid-nextcloud
docker image save solid-nextcloud:${{ env.TAG }} \
--output ./cache/solid-nextcloud/${{ github.sha }}-${{ matrix.nextcloud_version }}.tar
pull-docker-cookie:
needs: docker-images
runs-on: ubuntu-latest
steps:
- uses: actions/cache@v4
id: cache-docker-cookie
with:
path: cache/cookie
key: ${{ needs.docker-images.outputs.COOKIE_KEY }}
- if: steps.cache-docker-cookie.outputs.cache-hit != 'true'
run: |
mkdir -p cache/cookie/
docker pull ${{ needs.docker-images.outputs.COOKIE_IMAGE }}
docker image save ${{ needs.docker-images.outputs.COOKIE_IMAGE }} \
--output ./cache/cookie/${{ needs.docker-images.outputs.COOKIE_KEY }}.tar
pull-docker-pubsub:
needs: docker-images
runs-on: ubuntu-latest
steps:
- uses: actions/cache@v4
id: cache-docker-pubsub
with:
path: cache/pubsub
key: ${{ needs.docker-images.outputs.PUBSUB_KEY }}
- if: steps.cache-docker-pubsub.outputs.cache-hit != 'true'
run: |
mkdir -p cache/pubsub/
docker pull ${{ needs.docker-images.outputs.PUBSUB_IMAGE }}
docker image save ${{ needs.docker-images.outputs.PUBSUB_IMAGE }} \
--output ./cache/pubsub/${{ needs.docker-images.outputs.PUBSUB_KEY }}.tar
pull-docker-solid-crud-tests:
needs: docker-images
runs-on: ubuntu-latest
steps:
- uses: actions/cache@v4
id: cache-docker-solid-crud-tests
with:
path: cache/tests
key: ${{ needs.docker-images.outputs.SOLID_CRUD_TESTS_KEY }}
- if: steps.cache-docker-solid-crud-tests.outputs.cache-hit != 'true'
run: |
mkdir -p cache/tests
docker pull ${{ needs.docker-images.outputs.SOLID_CRUD_TESTS_IMAGE }}
docker image save ${{ needs.docker-images.outputs.SOLID_CRUD_TESTS_IMAGE }} \
--output ./cache/tests/${{ needs.docker-images.outputs.SOLID_CRUD_TESTS_KEY }}.tar
pull-docker-web-access-control-tests:
needs: docker-images
runs-on: ubuntu-latest
steps:
- uses: actions/cache@v4
id: cache-docker-web-access-control-tests
with:
path: cache/tests
key: ${{ needs.docker-images.outputs.WEB_ACCESS_CONTROL_TESTS_KEY }}
- if: steps.cache-docker-web-access-control-tests.outputs.cache-hit != 'true'
run: |
mkdir -p cache/tests
docker pull ${{ needs.docker-images.outputs.WEB_ACCESS_CONTROL_TESTS_IMAGE }}
docker image save ${{ needs.docker-images.outputs.WEB_ACCESS_CONTROL_TESTS_IMAGE }} \
--output ./cache/tests/${{ needs.docker-images.outputs.WEB_ACCESS_CONTROL_TESTS_KEY }}.tar
pull-docker-webid-provider-tests:
needs: docker-images
runs-on: ubuntu-latest
steps:
- uses: actions/cache@v4
id: cache-docker-webid-provider-tests
with:
path: cache/tests
key: ${{ needs.docker-images.outputs.WEBID_PROVIDER_TESTS_KEY }}
- if: steps.cache-docker-webid-provider-tests.outputs.cache-hit != 'true'
run: |
mkdir -p cache/tests
docker pull ${{ needs.docker-images.outputs.WEBID_PROVIDER_TESTS_IMAGE }}
docker image save ${{ needs.docker-images.outputs.WEBID_PROVIDER_TESTS_IMAGE }} \
--output ./cache/tests/${{ needs.docker-images.outputs.WEBID_PROVIDER_TESTS_KEY }}.tar
solid-testsuite:
timeout-minutes: 30
needs:
- build-docker-nextcloud
- docker-images
- pull-docker-cookie
- pull-docker-pubsub
- pull-docker-solid-crud-tests
- pull-docker-web-access-control-tests
- pull-docker-webid-provider-tests
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
nextcloud_version:
- 28
- 29
- 30
test:
- image: ${{ needs.docker-images.outputs.SOLID_CRUD_TESTS_IMAGE }}
file: ${{ needs.docker-images.outputs.SOLID_CRUD_TESTS_KEY }}
- image: ${{ needs.docker-images.outputs.WEB_ACCESS_CONTROL_TESTS_IMAGE }}
file: ${{ needs.docker-images.outputs.WEB_ACCESS_CONTROL_TESTS_KEY }}
- image: ${{ needs.docker-images.outputs.WEBID_PROVIDER_TESTS_IMAGE }}
file: ${{ needs.docker-images.outputs.WEBID_PROVIDER_TESTS_KEY }}
# Prevent EOL or non-stable versions of Nextcloud to fail the test-suite
continue-on-error: ${{ contains(fromJson('[28,29,30]'), matrix.nextcloud_version) == false }}
steps:
- name: Create docker tag from git reference
# A tag name may only contain lower- and uppercase letters, digits, underscores, periods and dashes.
run: |
echo "TAG=$(echo -n "${{ github.ref_name }}-${{ matrix.nextcloud_version }}" \
| tr --complement --squeeze-repeats '[:alnum:]._-' '_')" >> "${GITHUB_ENV}"
- uses: actions/checkout@v4
- uses: actions/cache@v4
id: cache-docker-solid-nextcloud
with:
path: cache/solid-nextcloud
key: solid-nextcloud-docker-${{ matrix.nextcloud_version }}-${{ github.sha }}
- uses: actions/cache@v4
id: cache-docker-cookie
with: {path: cache/cookie, key: "${{ needs.docker-images.outputs.COOKIE_KEY }}"}
- uses: actions/cache@v4
id: cache-docker-pubsub
with: {path: cache/pubsub, key: "${{ needs.docker-images.outputs.PUBSUB_KEY }}"}
- uses: actions/cache@v4
id: cache-docker-solid-crud-tests
with: {path: cache/tests, key: "${{ needs.docker-images.outputs.SOLID_CRUD_TESTS_KEY }}"}
- uses: actions/cache@v4
id: cache-docker-web-access-control-tests
with: {path: cache/tests, key: "${{ needs.docker-images.outputs.WEB_ACCESS_CONTROL_TESTS_KEY }}"}
- uses: actions/cache@v4
id: cache-docker-webid-provider-tests
with: {path: cache/tests, key: "${{ needs.docker-images.outputs.WEBID_PROVIDER_TESTS_KEY }}"}
- uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Load docker Images
run: |
docker image load --input ./cache/cookie/${{ needs.docker-images.outputs.COOKIE_KEY }}.tar
docker image load --input ./cache/pubsub/${{ needs.docker-images.outputs.PUBSUB_KEY }}.tar
docker image load --input ./cache/solid-nextcloud/${{ github.sha }}-${{ matrix.nextcloud_version }}.tar
docker image load --input ./cache/tests/${{ matrix.test.file }}.tar
- name: Start Docker Containers
run: |
docker network create testnet
docker run \
--detach \
--interactive \
--name 'pubsub' \
--network=testnet \
${{ needs.docker-images.outputs.PUBSUB_IMAGE }}
source ./run-solid-test-suite.sh
startSolidNextcloud 'server' "solid-nextcloud:${{ env.TAG }}" ${{ matrix.test.image }}
startSolidNextcloud 'thirdparty' "solid-nextcloud:${{ env.TAG }}" ${{ matrix.test.image }}
echo "COOKIE_server=${COOKIE_server}" >> "${GITHUB_ENV}"
echo "COOKIE_thirdparty=${COOKIE_thirdparty}" >> "${GITHUB_ENV}"
- name: Run tests - ${{ matrix.test.image }}
run: |
export COOKIE_server="${{ env.COOKIE_server }}"
export COOKIE_thirdparty="${{ env.COOKIE_thirdparty }}"
docker run -i --rm --network=testnet \
--name tester \
--env COOKIE="$COOKIE_server" \
--env COOKIE_ALICE="$COOKIE_server" \
--env COOKIE_BOB="$COOKIE_thirdparty" \
--env-file ./env-vars-testers.list \
${{ matrix.test.image }}
# - name: Setup tmate session - ${{ matrix.test.image }}
# if: failure()
# uses: mxschmitt/action-tmate@v3
- name: Show nextcloud logs - ${{ matrix.test.image }}
if: always()
run: |
docker exec -i server cat /var/www/html/data/nextcloud.log