Skip to content

Devcontainer and Workflow Performance #1

Devcontainer and Workflow Performance

Devcontainer and Workflow Performance #1

Workflow file for this run

# SPDX-FileCopyrightText: 2025 Lennart Dohmann <lennart.dohmann@gdata.de>
#
# SPDX-License-Identifier: AGPL-3.0-or-later
name: Tests
defaults:
run:
shell: bash
on:
push:
branches: ["main"]
tags: ["*"]
pull_request:
workflow_dispatch:
jobs:
define-version-matrix:
runs-on: ubuntu-latest
outputs:
nextcloud_versions: ${{ steps.get-nc-version-matrix.outputs.nextcloud_versions }}
steps:
- uses: actions/checkout@v4
- id: get-nc-version-matrix
run: echo "nextcloud_versions=$(./scripts/get-nc-version-matrix.sh)" | tee -a "$GITHUB_OUTPUT"
build-devcontainer:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Pre-build dev container image
uses: devcontainers/ci@v0.3
with:
imageName: ghcr.io/gdatasoftwareag/nextcloud/builder
cacheFrom: ghcr.io/gdatasoftwareag/nextcloud/builder
push: always
tests:
runs-on: ubuntu-latest
container:
image: ghcr.io/gdatasoftwareag/nextcloud/builder:latest
env:
IS_CI: 1
needs:
- define-version-matrix
- build-devcontainer
strategy:
matrix:
nextcloud_version: ${{fromJson(needs.define-version-matrix.outputs.nextcloud_versions)}}
steps:
- uses: actions/checkout@v4
- name: add composer bin to path
run: |
echo $(composer config home --global)/vendor/bin >> $GITHUB_PATH
- name: replace version in ./appinfo/info.xml
if: startsWith(github.ref, 'refs/tags/')
id: replace-version-in-info
run: |
RELEASE_VERSION=${GITHUB_REF#refs/tags/}
sed -i "s/<version>0.0.0<\/version>/<version>$RELEASE_VERSION<\/version>/g" ./appinfo/info.xml
- name: unittests
env:
CLIENT_ID: ${{ secrets.VAAS_CLIENT_ID }}
CLIENT_SECRET: ${{ secrets.VAAS_CLIENT_SECRET }}
run: |
composer install
./vendor/bin/phpunit --bootstrap tests/unittests/bootstrap.php tests/unittests/ --testdox
- name: install php-scoper
run: |
composer global require humbug/php-scoper
echo $(composer config home --global) >> $GITHUB_PATH
- name: install nextcloud
env:
CLIENT_ID: ${{ secrets.VAAS_CLIENT_ID }}
CLIENT_SECRET: ${{ secrets.VAAS_CLIENT_SECRET }}
run: ./scripts/run-app.sh ${{ matrix.nextcloud_version }} 1
- name: run tests
id: bats-tests
env:
CLIENT_ID: ${{ secrets.VAAS_CLIENT_ID }}
CLIENT_SECRET: ${{ secrets.VAAS_CLIENT_SECRET }}
run: |
if bats --verbose-run --timing --trace ./tests/bats; then
echo "bats_run=success" | tee -a "$GITHUB_OUTPUT";
else
echo "bats_run=fail" | tee -a "$GITHUB_OUTPUT";
fi
- name: fail if bats tests did fail
if: steps.bats-tests.outputs.bats_run == 'fail'
run: exit 1
- uses: actions/upload-artifact@master
with:
name: build-dir
path: build/