-
Notifications
You must be signed in to change notification settings - Fork 11
156 lines (133 loc) · 5.82 KB
/
ci.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
---
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:35166933e3d30bde801fd156bd2f21ebba9cdeca464ebd574c6be4cdb14d35cd
COOKIE_TAG: latest@sha256:c71a3947f97d96ce09823743182582e0d919738be0d4ef5c8c55a9c22c615b91
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:
# @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:
- 25
- 26
- 27
- 28
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@v3
id: cache-solid-nextcloud-docker
with:
path: cache/solid-nextcloud
key: solid-nextcloud-docker-${{ matrix.nextcloud_version }}-${{ github.sha }}
- uses: actions/checkout@v3
- uses: docker/login-action@v2
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/pdsinterop/solid-nextcloud:${{ env.TAG }}" \
--build-arg 'NEXTCLOUD_VERSION=${{ matrix.nextcloud_version }}' \
.
docker push "ghcr.io/pdsinterop/solid-nextcloud:${{ env.TAG }}"
mkdir -p cache/solid-nextcloud
docker image save solid-nextcloud:${{ env.TAG }} --output ./cache/solid-nextcloud/${{ github.sha }}-${{ matrix.nextcloud_version }}.tar
solid-testsuite:
timeout-minutes: 30
needs:
- build-docker-nextcloud
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
nextcloud_version:
- 25
- 26
- 27
- 28
test:
- 'solidtestsuite/solid-crud-tests:v7.0.5'
- 'solidtestsuite/web-access-control-tests:v7.1.0'
- 'solidtestsuite/webid-provider-tests:v2.1.0'
# Prevent EOL or non-stable versions of Nextcloud to fail the test-suite
continue-on-error: ${{ contains(fromJson('[25,26,27,28]'), 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@v3
- uses: actions/cache@v3
id: cache-solid-nextcloud-docker
with:
path: cache/solid-nextcloud
key: solid-nextcloud-docker-${{ matrix.nextcloud_version }}-${{ github.sha }}
- uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
# FIXME: The `docker pull` should be moved to a previous step and cached
- name: Pull docker Images
run: |
docker image load --input ./cache/solid-nextcloud/${{ github.sha }}-${{ matrix.nextcloud_version }}.tar
docker pull michielbdejong/nextcloud-cookie:${{ env.COOKIE_TAG }}
docker pull ${{ matrix.test }}
docker pull ghcr.io/pdsinterop/php-solid-pubsub-server:${{ env.PUBSUB_TAG }}
- name: Start Docker Containers
run: |
docker network create testnet
docker run \
--detach \
--interactive \
--name 'pubsub' \
--network=testnet \
"ghcr.io/pdsinterop/php-solid-pubsub-server:${{ env.PUBSUB_TAG }}"
source ./run-solid-test-suite.sh
startSolidNextcloud 'server' "solid-nextcloud:${{ env.TAG }}" ${{ matrix.test }}
startSolidNextcloud 'thirdparty' "solid-nextcloud:${{ env.TAG }}" ${{ matrix.test }}
echo "COOKIE_server=${COOKIE_server}" >> "${GITHUB_ENV}"
echo "COOKIE_thirdparty=${COOKIE_thirdparty}" >> "${GITHUB_ENV}"
- name: Run tests - ${{ matrix.test }}
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 }}