|
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 |
5 | 3 |
|
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 |
7 | 8 |
|
8 | 9 | on: |
9 | 10 | push: |
10 | | - branches: [ main ] |
| 11 | + branches: |
| 12 | + - main |
11 | 13 | pull_request: |
12 | 14 | 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 |
13 | 23 |
|
14 | 24 | 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 |
16 | 78 |
|
17 | | - runs-on: ${{ matrix.os }} |
| 79 | + runs-on: ubuntu-latest |
18 | 80 |
|
19 | 81 | strategy: |
| 82 | + fail-fast: false |
20 | 83 | 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 }} |
22 | 95 |
|
23 | 96 | 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. |
28 | 99 | 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 }} |
0 commit comments