Skip to content

Commit

Permalink
setup a matrix build (#56)
Browse files Browse the repository at this point in the history
* setup a matrix build

---------

Co-authored-by: Max <[email protected]>
(cherry picked from commit 264e0df)
  • Loading branch information
unglaublicherdude authored and lennartdohmann committed Jun 25, 2024
1 parent 10d7eb0 commit 78109a5
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 2 deletions.
15 changes: 14 additions & 1 deletion .github/workflows/release-app.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,21 @@ on:
branches: ["*"]

jobs:
define-matrix:
runs-on: ubuntu-latest
outputs:
nextcloud_versions: ${{ steps.get-matrix.outputs.nextcloud_versions }}
steps:
- uses: actions/checkout@v4
- id: get-matrix
run: echo "nextcloud_versions=$(./get-matrix.sh)" | tee -a "$GITHUB_OUTPUT"

test:
runs-on: ubuntu-latest
needs: define-matrix
strategy:
matrix:
nextcloud_version: ${{fromJson(needs.define-matrix.outputs.nextcloud_versions)}}
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
Expand All @@ -34,7 +47,7 @@ jobs:
env:
CLIENT_ID: ${{ secrets.VAAS_CLIENT_ID }}
CLIENT_SECRET: ${{ secrets.VAAS_CLIENT_SECRET }}
run: ./install.sh
run: ./install.sh ${{ matrix.nextcloud_version }}

- name: run tests
env:
Expand Down
14 changes: 14 additions & 0 deletions get-matrix.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#!/bin/bash

MIN_VERSION=$([[ $(cat appinfo/info.xml) =~ $(echo '<nextcloud[^>]*min-version=[^[0-9]]*([0-9]+).*') ]] && echo ${BASH_REMATCH[1]})
MAX_VERSION=$([[ $(cat appinfo/info.xml) =~ $(echo '<nextcloud[^>]*max-version=[^[0-9]]*([0-9]+).*') ]] && echo ${BASH_REMATCH[1]})

[ -z "$MIN_VERSION" ] && [ -z "$MAX_VERSION" ] && echo 'A version constraint should be set' && exit 1

MIN_VERSION=${MIN_VERSION:-$MAX_VERSION}
MAX_VERSION=${MAX_VERSION:-$MIN_VERSION}

[ "$MIN_VERSION" -gt "$MAX_VERSION" ] && echo 'Min version should be less or equal to max version' && exit 1

echo "[$(echo "\"$(seq -s '","' $MIN_VERSION $MAX_VERSION)\"")]"

4 changes: 3 additions & 1 deletion install.sh
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
#!/bin/bash

NEXTCLOUD_VERSION=${1:-29}

source .env-local || echo "No .env-local file found."

setup_nextcloud () {
echo "setup nextcloud"
docker stop nextcloud-container || echo "No container to stop"
sleep 1
docker run -d --name nextcloud-container --rm --publish 80:80 nextcloud:29
docker run -d --name nextcloud-container --rm --publish 80:80 nextcloud:$NEXTCLOUD_VERSION

until docker exec --user www-data -i nextcloud-container php occ status | grep "installed: false"
do
Expand Down

0 comments on commit 78109a5

Please sign in to comment.