Skip to content

Rework script to run automated tests #1137

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 7 commits into from
Aug 4, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/actions/run-tests/.gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
/volumes/
/venv/
195 changes: 27 additions & 168 deletions .github/actions/run-tests/README.md

Large diffs are not rendered by default.

55 changes: 29 additions & 26 deletions .github/actions/run-tests/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ inputs:
phpVersion:
description: The PHP version to use for the tests
required: false
default: '7'
default: '8.0'
db:
description: The db type to use
required: true
Expand All @@ -18,45 +18,48 @@ inputs:
coreVersion:
description: The version of the NC server core to test against.
required: true
allowFailure:
installUntested:
description: The test may fail
required: false
default: false
default: "false"
runCodeChecker:
description: Setting to true or false to decide if the code checker should run
required: false
default: "true"
outputs:
silentFail:
description: If the test failed but was allowed to do so
value: ${{ steps.run.outputs.silent-fail }}
value: ${{ steps.test.outputs.silent-fail }}

runs:
using: 'composite'
steps:
- name: Trigger the tests
- name: Prepare folder for installation
shell: bash
run: mkdir -p vendor
- name: Run all tests
shell: bash
id: tests
run: >-
mkdir -p vendor &&
if [ "${{inputs.db}}" = 'pgsql' ]; then PARAM=''; else PARAM='--use-db-dump'; fi &&
if [ "${{ inputs.installUntested }}" = 'true' ]; then PARAM="$PARAM --install-untested"; fi &&
if [ "${{ inputs.runCodeChecker }}" = 'true' ]; then PARAM="$PARAM --run-code-checker"; fi &&
cd .github/actions/run-tests &&
export ALLOW_FAILURE=${{ inputs.allowFailure }} &&
export INPUT_DB=${{ inputs.db }} &&
export PHP_VERSION=${{ inputs.phpVersion }} &&
export HTTP_SERVER=${{ inputs.server }} &&
export COMPOSE_DOCKER_CLI_BUILD=1 &&
./run-locally.sh
./run-locally.py
$PARAM
--pull
--create-images
--start-helpers
--setup-environment ${{ inputs.coreVersion }}
--create-env-dump
--create-plain-dump plain
--install-composer-deps
--run-unit-tests --run-integration-tests --run-migration-tests
--input-db ${{ inputs.db }}
--http-server ${{ inputs.server }}
--php-version ${{ inputs.phpVersion }}
--create-fixture default ${{ inputs.coreVersion }}
--activate-fixture default
--run-unit-tests
--run-integration-tests
--run-migration-tests
--extract-code-coverage
--shutdown-helpers || { failed=$?; } ;
if [ -n "$failed" ]; then
echo "test_result=$failed" >> $GITHUB_ENV;
else
echo "test_result=0" >> $GITHUB_ENV;
fi;
shell: bash
id: run
--install-composer-deps;
echo "test_result=$?" >> $GITHUB_ENV

- name: Export the annotations of unit tests to github
shell: bash
Expand Down
15 changes: 12 additions & 3 deletions .github/actions/run-tests/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,20 @@ version: "3.2"

services:
mysql:
build: mysql
build:
context: ./mysql
cache_from:
- cookbook_unittesting_mysql
volumes:
- ./volumes/mysql:/var/lib/mysql
env_file:
- mysql.env

postgres:
image: postgres:alpine
build:
context: ./postgres
cache_from:
- cookbook_unittesting_postgres
env_file:
- postgres.env
volumes:
Expand Down Expand Up @@ -63,10 +69,13 @@ services:
- ./volumes/nextcloud:/nextcloud
- ./volumes/data:/nextcloud/data
- ./volumes/cookbook:/nextcloud/custom_apps/cookbook
- ./volumes/dumps:/dumps
- ./volumes/dumps:/dumps:ro
- ./volumes/coverage:/coverage
- ./volumes/www/:/www
- ./volumes/output:/output
- /var/run/docker.sock:/var/run/docker.sock
- ./volumes/mysql:/db/mysql
- ./volumes/postgres:/db/postgres

occ:
<<: *dut
Expand Down
11 changes: 9 additions & 2 deletions .github/actions/run-tests/mysql/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,12 @@ FROM mariadb:10.5

LABEL maintainer="Christian Wolf <[email protected]>"

HEALTHCHECK --interval=5s --timeout=5s --retries=24 \
CMD mysqladmin ping --silent
RUN apt-get update >/dev/null && \
apt-get install -y --no-install-recommends eatmydata > /dev/null && \
apt-get clean

HEALTHCHECK --interval=1s --timeout=1s --retries=24 \
CMD mysqladmin ping --silent --socket /run/mysqld/mysqld.sock -ppass_root

COPY docker-entrypoint.sh /usr/local/bin
# CMD ["eatmydata", "mysqld"]
Loading