Skip to content

Commit 54dfe31

Browse files
authored
Merge branch 'main' into notif-ws
2 parents 915febd + 2484bde commit 54dfe31

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+1344
-827
lines changed

.github/workflows/ci.yml

Lines changed: 139 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,154 @@
1-
# This workflow will do a clean install of node dependencies, build the source
2-
# code and run tests across different versions of node
3-
# For more information see:
4-
# https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions
1+
---
2+
name: Solid Test Suites
53

6-
name: CI
4+
env:
5+
# Docker Hub digest (i.e. hash) of the used Docker Images that do not have a version tag.
6+
PUBSUB_TAG: latest@sha256:35166933e3d30bde801fd156bd2f21ebba9cdeca464ebd574c6be4cdb14d35cd
7+
COOKIE_TAG: latest@sha256:c71a3947f97d96ce09823743182582e0d919738be0d4ef5c8c55a9c22c615b91
78

89
on:
910
push:
10-
branches: [ main ]
11+
branches:
12+
- main
1113
pull_request:
1214
branches: [ main ]
15+
# Allow manually triggering the workflow.
16+
workflow_dispatch:
17+
18+
# Cancels all previous workflow runs for the same branch that have not yet completed.
19+
concurrency:
20+
# The concurrency group contains the workflow name and the branch name.
21+
group: ${{ github.workflow }}-${{ github.ref }}
22+
cancel-in-progress: true
1323

1424
jobs:
15-
build:
25+
# @TODO: Instead of building the docker image here, take a pre-build image and mount the code?
26+
# (only build when the Dockerfile changes) Or only push when tagged/main?
27+
build-docker-nextcloud:
28+
runs-on: ubuntu-latest
29+
strategy:
30+
matrix:
31+
# For the latest version information see: https://github.com/nextcloud/server/wiki/Maintenance-and-Release-Schedule
32+
# Versions before 22 are not tested as they run on PHP versions lower than 8.0
33+
# Versions before 24 are not tested as they do not support `.well-known` entries
34+
# Version 24 comes with PHP 8.0, which is no longer supported;
35+
# Latest is not tested here, as that could cause failures unrelated to project changes
36+
nextcloud_version:
37+
- 28
38+
- 29
39+
- 30
40+
41+
steps:
42+
- name: Create docker tag from git reference
43+
# A tag name may only contain lower- and uppercase letters, digits, underscores, periods and dashes.
44+
run: |
45+
echo "TAG=$(echo -n "${{ github.ref_name }}-${{ matrix.nextcloud_version }}" \
46+
| tr --complement --squeeze-repeats '[:alnum:]._-' '_')" \
47+
>> "${GITHUB_ENV}"
48+
49+
- uses: actions/cache@v3
50+
id: cache-solid-nextcloud-docker
51+
with:
52+
path: cache/solid-nextcloud
53+
key: solid-nextcloud-docker-${{ matrix.nextcloud_version }}-${{ github.sha }}
54+
55+
- uses: actions/checkout@v3
56+
57+
- uses: docker/login-action@v2
58+
with:
59+
registry: ghcr.io
60+
username: ${{ github.actor }}
61+
password: ${{ secrets.GITHUB_TOKEN }}
62+
63+
- name: Build Solid-Nextcloud Docker image from NC-${{ matrix.nextcloud_version }}
64+
run: |
65+
docker build \
66+
--tag "solid-nextcloud:${{ env.TAG }}" \
67+
--tag "ghcr.io/pdsinterop/solid-nextcloud:${{ env.TAG }}" \
68+
--build-arg 'NEXTCLOUD_VERSION=${{ matrix.nextcloud_version }}' \
69+
.
70+
docker push "ghcr.io/pdsinterop/solid-nextcloud:${{ env.TAG }}"
71+
mkdir -p cache/solid-nextcloud
72+
docker image save solid-nextcloud:${{ env.TAG }} --output ./cache/solid-nextcloud/${{ github.sha }}-${{ matrix.nextcloud_version }}.tar
73+
74+
solid-testsuite:
75+
timeout-minutes: 30
76+
needs:
77+
- build-docker-nextcloud
1678

17-
runs-on: ${{ matrix.os }}
79+
runs-on: ubuntu-latest
1880

1981
strategy:
82+
fail-fast: false
2083
matrix:
21-
os: [ ubuntu-latest ]
84+
nextcloud_version:
85+
- 28
86+
- 29
87+
- 30
88+
test:
89+
- 'solidtestsuite/solid-crud-tests:v7.0.5'
90+
- 'solidtestsuite/web-access-control-tests:v7.1.0'
91+
- 'solidtestsuite/webid-provider-tests:v2.1.0'
92+
93+
# Prevent EOL or non-stable versions of Nextcloud to fail the test-suite
94+
continue-on-error: ${{ contains(fromJson('[28,29,30]'), matrix.nextcloud_version) == false }}
2295

2396
steps:
24-
- uses: actions/checkout@v2
25-
# Run the Solid test-suite
26-
- name: Run the Solid test suite
27-
shell: 'script -q -e -c "bash {0}"'
97+
- name: Create docker tag from git reference
98+
# A tag name may only contain lower- and uppercase letters, digits, underscores, periods and dashes.
2899
run: |
29-
bash ./run-solid-test-suite.sh
100+
echo "TAG=$(echo -n "${{ github.ref_name }}-${{ matrix.nextcloud_version }}" \
101+
| tr --complement --squeeze-repeats '[:alnum:]._-' '_')" \
102+
>> "${GITHUB_ENV}"
103+
104+
- uses: actions/checkout@v3
105+
106+
- uses: actions/cache@v3
107+
id: cache-solid-nextcloud-docker
108+
with:
109+
path: cache/solid-nextcloud
110+
key: solid-nextcloud-docker-${{ matrix.nextcloud_version }}-${{ github.sha }}
111+
112+
- uses: docker/login-action@v2
113+
with:
114+
registry: ghcr.io
115+
username: ${{ github.actor }}
116+
password: ${{ secrets.GITHUB_TOKEN }}
117+
118+
# FIXME: The `docker pull` should be moved to a previous step and cached
119+
- name: Pull docker Images
120+
run: |
121+
docker image load --input ./cache/solid-nextcloud/${{ github.sha }}-${{ matrix.nextcloud_version }}.tar
122+
docker pull michielbdejong/nextcloud-cookie:${{ env.COOKIE_TAG }}
123+
docker pull ${{ matrix.test }}
124+
docker pull ghcr.io/pdsinterop/php-solid-pubsub-server:${{ env.PUBSUB_TAG }}
125+
126+
- name: Start Docker Containers
127+
run: |
128+
docker network create testnet
129+
docker run \
130+
--detach \
131+
--interactive \
132+
--name 'pubsub' \
133+
--network=testnet \
134+
"ghcr.io/pdsinterop/php-solid-pubsub-server:${{ env.PUBSUB_TAG }}"
135+
136+
source ./run-solid-test-suite.sh
137+
startSolidNextcloud 'server' "solid-nextcloud:${{ env.TAG }}" ${{ matrix.test }}
138+
startSolidNextcloud 'thirdparty' "solid-nextcloud:${{ env.TAG }}" ${{ matrix.test }}
139+
140+
echo "COOKIE_server=${COOKIE_server}" >> "${GITHUB_ENV}"
141+
echo "COOKIE_thirdparty=${COOKIE_thirdparty}" >> "${GITHUB_ENV}"
142+
143+
- name: Run tests - ${{ matrix.test }}
144+
run: |
145+
export COOKIE_server="${{ env.COOKIE_server }}"
146+
export COOKIE_thirdparty="${{ env.COOKIE_thirdparty }}"
147+
148+
docker run -i --rm --network=testnet \
149+
--name tester \
150+
--env COOKIE="$COOKIE_server" \
151+
--env COOKIE_ALICE="$COOKIE_server" \
152+
--env COOKIE_BOB="$COOKIE_thirdparty" \
153+
--env-file ./env-vars-testers.list \
154+
${{ matrix.test }}

.github/workflows/dependancy-security-check.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ jobs:
2020

2121
strategy:
2222
matrix:
23-
php: ['8.0', '8.1']
23+
php: ['8.1']
2424

2525
steps:
2626
- name: Checkout code

.github/workflows/php-version-sniff.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ jobs:
1717
php-codesniffer:
1818
strategy:
1919
matrix:
20-
php: [ '8.0', '8.1' ]
20+
php: [ '8.1' ]
2121
runs-on: ubuntu-20.04
2222
steps:
2323
- uses: actions/checkout@v3

Dockerfile

Lines changed: 24 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,27 @@
1-
FROM nextcloud:24.0.1
2-
COPY site.conf /etc/apache2/sites-enabled/000-default.conf
3-
RUN a2enmod ssl
4-
RUN mkdir /tls
5-
RUN openssl req -new -x509 -days 365 -nodes \
6-
-out /tls/server.cert \
7-
-keyout /tls/server.key \
8-
-subj "/C=RO/ST=Bucharest/L=Bucharest/O=IT/CN=www.example.ro"
1+
ARG NEXTCLOUD_VERSION
2+
FROM nextcloud:${NEXTCLOUD_VERSION}
3+
94
RUN apt-get update && apt-get install -yq \
10-
git \
11-
vim \
12-
sudo
13-
WORKDIR /install
14-
RUN php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
15-
RUN php composer-setup.php
16-
RUN php -r "unlink('composer-setup.php');"
17-
ADD ./solid /usr/src/nextcloud/apps/solid
18-
# Run composer:
19-
WORKDIR /usr/src/nextcloud/apps/solid
20-
RUN ls
21-
RUN php /install/composer.phar update
22-
RUN php /install/composer.phar install --no-dev --prefer-dist
5+
git \
6+
sudo \
7+
vim \
8+
zip \
9+
&& rm -rf /var/lib/apt/lists/* \
10+
&& a2enmod ssl \
11+
&& mkdir /tls \
12+
&& openssl req -new -x509 -days 365 -nodes \
13+
-keyout /tls/server.key \
14+
-out /tls/server.cert \
15+
-subj "/C=RO/ST=Bucharest/L=Bucharest/O=IT/CN=www.example.ro"
16+
17+
COPY solid/ /usr/src/nextcloud/apps/solid
18+
COPY init.sh /
19+
COPY init-live.sh /
20+
COPY site.conf /etc/apache2/sites-enabled/000-default.conf
21+
22+
COPY --from=composer:latest /usr/bin/composer /usr/local/bin/composer
23+
RUN composer install --working-dir=/usr/src/nextcloud/apps/solid --no-dev --prefer-dist \
24+
&& rm /usr/local/bin/composer
25+
2326
WORKDIR /var/www/html
24-
ADD init.sh /
25-
ADD init-live.sh /
2627
EXPOSE 443

INSTALL.md

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
11
# Installing this app to your Nextcloud
22

33
If you have installed Nextcloud [using snap](https://www.digitalocean.com/community/tutorials/how-to-install-and-configure-nextcloud-on-ubuntu-22-04)
4-
you should be able to run the latest version of this app.
4+
you should be able to run the latest version of this app. You can find it in the Nextcloud app store as `Solid`, or by running `sudo nextcloud.occ app:install solid`.
55

66
## Building from source
7-
In the future you will be able to install the app just from the app store, or by running `sudo nextcloud.occ app:install solid`.
8-
But currently (September 2022) that still installs version 0.0.3, which means you need to install from source. To switch the version of your Solid app from the "store-bought" version to the latest unreleased version, you will need to build from source:
7+
To switch the version of your Solid app from the "store-bought" version to the latest unreleased version, you will need to build from source:
98
```
109
sudo /bin/bash
1110
cd /var/snap/nextcloud/current/nextcloud/extra-apps/

README.md

Lines changed: 3 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
A plugin to make Nextcloud compatible with Solid.
33

44
You can download it via the Nextcloud app store: https://apps.nextcloud.com/apps/solid
5-
IMPORTANT: Follow the [install instructions!](https://github.com/pdsinterop/solid-nextcloud/blob/main/INSTALL.md).
65

76
## Development install
87
Clone https://github.com/pdsinterop/test-suites, cd into it, and run:
@@ -21,40 +20,14 @@ docker exec -u root -it server service apache2 reload
2120
Now visit https://localhost and log in as alice / alice123.
2221

2322
## Manual install
24-
Pleas follow the [install instructions](https://github.com/pdsinterop/solid-nextcloud/blob/main/INSTALL.md).
23+
Please follow the [install instructions](https://github.com/pdsinterop/solid-nextcloud/blob/main/INSTALL.md).
2524

2625
## Unattended testing
2726
There is a [GitHub Action](https://github.com/pdsinterop/solid-nextcloud/actions/workflows/ci.yml) that runs a [Docker-based test script](https://github.com/pdsinterop/solid-nextcloud/blob/585b968/.github/workflows/ci.yml#L29).
2827

2928
## Manual testing
3029
You can try out the various Solid apps that show up in the Solid App GUI inside the Nextcloud GUI on first use.
3130

32-
# Publishing to the Nextcloud app store
31+
### Build / Deploy
3332

34-
* `git checkout main`
35-
* `git pull`
36-
* Tag v0.0.X in solid/appinfo/info.xml
37-
* `git tag`
38-
* `git tag v0.0.X`
39-
* `git push --follow-tags`
40-
* `git checkout publish`
41-
* `git pull`
42-
* `git merge main`
43-
* `cd solid`
44-
* `php ../composer.phar update`
45-
* `php ../composer.phar install --no-dev --prefer-dist`
46-
* `git commit -am"built"` (at least `vendor/composer/installed.php` will have changed)
47-
* `git push`
48-
* `cd ..`
49-
* create a release on github from the tag you just pushed
50-
* `tar -cf solid.tar solid/`
51-
* `gzip solid.tar`
52-
* `git checkout main`
53-
* edit the release and upload `solid.tar.gz` as a binary attachment
54-
* make sure transfer/solid.key and transfer/solid.crt exist
55-
* `openssl dgst -sha512 -sign ./transfer/solid.key ./solid.tar.gz | openssl base64`
56-
* visit https://apps.nextcloud.com/developer/apps/releases/new
57-
* go into the developer tools browser console to change the `<a>` element around the form to a `<p>` element. This makes it possible to fill in values in this form without being redirected.
58-
* fill in for instance `https://github.com/pdsinterop/solid-nextcloud/releases/download/v0.0.2/solid.tar.gz` and the base64 signature from the openssl command
59-
* click 'uploaden'
60-
* good luck!
33+
For publishing to the Nextcloud app store see [the deploy instructions](docs/deploy.md).

0 commit comments

Comments
 (0)