Change GitHub Actions platform to latest Ubuntu version. #335
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
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-22.04 | |
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 | |
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-22.04 | |
strategy: | |
fail-fast: false | |
matrix: | |
nextcloud_version: | |
- 25 | |
- 26 | |
- 27 | |
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]'), 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 }} |