From 71c73f7fb3c9b1ce40e9be819a6f8ed8b2ae50ec Mon Sep 17 00:00:00 2001 From: cytopia Date: Sun, 27 Mar 2022 16:05:51 +0200 Subject: [PATCH] Test re-usable workflows --- .../workflows/{ => old}/ci-smoke-linux.yml | 0 .../{ => old}/ci-smoke-macos.yml.off | 0 .github/workflows/{ => old}/documentation.yml | 0 .github/workflows/{ => old}/lint.yml | 0 .github/workflows/{ => old}/test-config.yml | 0 .github/workflows/old/test-versions.yml | 287 ++++++++++++++++++ .github/workflows/params-versions.yml | 125 ++++++++ .github/workflows/test-versions.yml | 275 +---------------- .github/workflows/zzz-reuse-tests.yml | 256 ++++++++++++++++ 9 files changed, 682 insertions(+), 261 deletions(-) rename .github/workflows/{ => old}/ci-smoke-linux.yml (100%) rename .github/workflows/{ => old}/ci-smoke-macos.yml.off (100%) rename .github/workflows/{ => old}/documentation.yml (100%) rename .github/workflows/{ => old}/lint.yml (100%) rename .github/workflows/{ => old}/test-config.yml (100%) create mode 100644 .github/workflows/old/test-versions.yml create mode 100644 .github/workflows/params-versions.yml create mode 100644 .github/workflows/zzz-reuse-tests.yml diff --git a/.github/workflows/ci-smoke-linux.yml b/.github/workflows/old/ci-smoke-linux.yml similarity index 100% rename from .github/workflows/ci-smoke-linux.yml rename to .github/workflows/old/ci-smoke-linux.yml diff --git a/.github/workflows/ci-smoke-macos.yml.off b/.github/workflows/old/ci-smoke-macos.yml.off similarity index 100% rename from .github/workflows/ci-smoke-macos.yml.off rename to .github/workflows/old/ci-smoke-macos.yml.off diff --git a/.github/workflows/documentation.yml b/.github/workflows/old/documentation.yml similarity index 100% rename from .github/workflows/documentation.yml rename to .github/workflows/old/documentation.yml diff --git a/.github/workflows/lint.yml b/.github/workflows/old/lint.yml similarity index 100% rename from .github/workflows/lint.yml rename to .github/workflows/old/lint.yml diff --git a/.github/workflows/test-config.yml b/.github/workflows/old/test-config.yml similarity index 100% rename from .github/workflows/test-config.yml rename to .github/workflows/old/test-config.yml diff --git a/.github/workflows/old/test-versions.yml b/.github/workflows/old/test-versions.yml new file mode 100644 index 00000000..f3a69bd6 --- /dev/null +++ b/.github/workflows/old/test-versions.yml @@ -0,0 +1,287 @@ +--- + +# ------------------------------------------------------------------------------------------------- +# Job Name +# ------------------------------------------------------------------------------------------------- +name: Versions + + +# ------------------------------------------------------------------------------------------------- +# When to run +# ------------------------------------------------------------------------------------------------- +on: + # Runs on Pull Requests + pull_request: + + # Runs on master Branch and Tags + push: + branches: + - master + tags: + - '[0-9]+.[0-9]+*' + + +# ------------------------------------------------------------------------------------------------- +# What to run +# ------------------------------------------------------------------------------------------------- +jobs: + smoke_version: + + runs-on: ubuntu-latest + + strategy: + fail-fast: false + matrix: + version: + - "MYSQL_SERVER=mysql-5.5" + - "MYSQL_SERVER=mysql-5.6" + - "MYSQL_SERVER=mysql-5.7" + - "MYSQL_SERVER=mysql-8.0" + - "MYSQL_SERVER=mariadb-5.5" + - "MYSQL_SERVER=mariadb-10.0" + - "MYSQL_SERVER=mariadb-10.1" + - "MYSQL_SERVER=mariadb-10.2" + - "MYSQL_SERVER=mariadb-10.3" + - "MYSQL_SERVER=mariadb-10.4" + - "MYSQL_SERVER=mariadb-10.5" + - "MYSQL_SERVER=mariadb-10.6" + - "MYSQL_SERVER=mariadb-10.7" + - "MYSQL_SERVER=mariadb-10.8" + - "MYSQL_SERVER=percona-5.5" + - "MYSQL_SERVER=percona-5.6" + - "MYSQL_SERVER=percona-5.7" + - "MYSQL_SERVER=percona-8.0" + + - "PGSQL_SERVER=9.0" + - "PGSQL_SERVER=9.1" + - "PGSQL_SERVER=9.2" + - "PGSQL_SERVER=9.2-alpine" + - "PGSQL_SERVER=9.3" + - "PGSQL_SERVER=9.3-alpine" + - "PGSQL_SERVER=9.4" + - "PGSQL_SERVER=9.4-alpine" + - "PGSQL_SERVER=9.5" + - "PGSQL_SERVER=9.5-alpine" + - "PGSQL_SERVER=9.6" + - "PGSQL_SERVER=9.6-alpine" + - "PGSQL_SERVER=10" + - "PGSQL_SERVER=10-alpine" + - "PGSQL_SERVER=11" + - "PGSQL_SERVER=11-alpine" + - "PGSQL_SERVER=12" + - "PGSQL_SERVER=12-alpine" + - "PGSQL_SERVER=13" + - "PGSQL_SERVER=13-alpine" + - "PGSQL_SERVER=14" + - "PGSQL_SERVER=14-alpine" + - "PGSQL_SERVER=latest" + - "PGSQL_SERVER=alpine" + + - "REDIS_SERVER=2.8" + - "REDIS_SERVER=3.0" + - "REDIS_SERVER=3.0-alpine" + - "REDIS_SERVER=3.2" + - "REDIS_SERVER=3.2-alpine" + - "REDIS_SERVER=4.0" + - "REDIS_SERVER=4.0-alpine" + - "REDIS_SERVER=5.0" + - "REDIS_SERVER=5.0-alpine" + - "REDIS_SERVER=6.0" + - "REDIS_SERVER=6.0-alpine" + - "REDIS_SERVER=6.2" + - "REDIS_SERVER=6.2-alpine" + - "REDIS_SERVER=latest" + - "REDIS_SERVER=alpine" + + - "MEMCD_SERVER=1.4" + - "MEMCD_SERVER=1.4-alpine" + - "MEMCD_SERVER=1.5" + - "MEMCD_SERVER=1.5-alpine" + - "MEMCD_SERVER=1.6" + - "MEMCD_SERVER=1.6-alpine" + - "MEMCD_SERVER=latest" + - "MEMCD_SERVER=alpine" + + - "MONGO_SERVER=2.8" + - "MONGO_SERVER=3.0" + - "MONGO_SERVER=3.2" + - "MONGO_SERVER=3.4" + - "MONGO_SERVER=3.6" + - "MONGO_SERVER=4.0" + - "MONGO_SERVER=4.2" + - "MONGO_SERVER=4.4" + - "MONGO_SERVER=5.0" + - "MONGO_SERVER=latest" + name: "[${{ matrix.version }}]" + steps: + + # ------------------------------------------------------------ + # Checkout repository + # ------------------------------------------------------------ + - name: Checkout repository + uses: actions/checkout@v1 + + - name: Show environment + shell: bash + run: | + env + + - name: Show network + shell: bash + run: | + netstat -an || true + ss -tlun || true + + - name: Show Docker version + shell: bash + run: | + docker version + + # ------------------------------------------------------------ + # Setup + # ------------------------------------------------------------ + - name: Configure + shell: bash + run: | + cd .tests/ + # Set the matrix version + make configure KEY="${VERSION//=*/}" VAL="${VERSION//*=}" + # 3306 is taken, so chose another one + make configure KEY=HOST_PORT_MYSQL VAL=3307 + env: + VERSION: ${{ matrix.version }} + + - name: Pull images + shell: bash + run: | + cd .tests/ + make pull + + - name: Startup + shell: bash + run: | + cd .tests/ + make start + + - name: Docker logs + shell: bash + run: | + cd .tests/ + make logs + + # ------------------------------------------------------------ + # Run tests + # ------------------------------------------------------------ + - name: Test Modules + shell: bash + run: | + cd .tests/ + make test-smoke-modules + if: success() || failure() + + - name: Test Config + shell: bash + run: | + cd .tests/ + make test-smoke-config + if: success() || failure() + + - name: Test Intranet + shell: bash + run: | + cd .tests/ + make test-smoke-intranet + if: success() || failure() + + - name: Test Vendors + shell: bash + run: | + cd .tests/ + make test-smoke-vendors + if: success() || failure() + + - name: Test Vhosts + shell: bash + run: | + cd .tests/ + make test-smoke-vhosts + if: success() || failure() + + - name: Test Reverse Proxy + shell: bash + run: | + cd .tests/ + make test-smoke-rproxies + if: success() || failure() + + - name: Test SSL + shell: bash + run: | + cd .tests/ + make test-smoke-ssl + if: success() || failure() + + - name: Test Bind + shell: bash + run: | + cd .tests/ + make test-smoke-bind + if: success() || failure() + + - name: Test Autostart + shell: bash + run: | + cd .tests/ + make test-smoke-autostart + if: success() || failure() + + - name: "Test Framework: CakePHP" + shell: bash + run: | + cd .tests/ + make test-smoke-framework-cakephp + if: success() || failure() + + - name: "Test Framework: Drupal" + shell: bash + run: | + cd .tests/ + make test-smoke-framework-drupal + if: success() || failure() + + - name: "Test Framework: Wordpress" + shell: bash + run: | + cd .tests/ + make test-smoke-framework-wordpress + if: success() || failure() + + - name: "Test Container" + shell: bash + run: | + retry() { + for n in $(seq 5); do + echo "[${n}/5] ${*}"; + if eval "${*}"; then + echo "[SUCC] ${n}/t"; + return 0; + fi; + sleep 5; + echo "[FAIL] ${n}/5"; + done; + return 1; + } + cd .tests/ + retry make test-smoke-container + if: success() || failure() + + # ------------------------------------------------------------ + # Finish + # ------------------------------------------------------------ + + - name: "Finish: Docker logs" + shell: bash + run: | + cd .tests/ + make logs + if: success() || failure() diff --git a/.github/workflows/params-versions.yml b/.github/workflows/params-versions.yml new file mode 100644 index 00000000..cf806189 --- /dev/null +++ b/.github/workflows/params-versions.yml @@ -0,0 +1,125 @@ +--- + +# ------------------------------------------------------------------------------------------------- +# Job Name +# ------------------------------------------------------------------------------------------------- +name: params + + +# ------------------------------------------------------------------------------------------------- +# Custom Variables +# ------------------------------------------------------------------------------------------------- +env: + MATRIX: >- + [ + {"MYSQL_SERVER": "mysql-5.5"}, + {"MYSQL_SERVER": "mysql-5.6"}, + {"MYSQL_SERVER": "mysql-5.7"}, + {"MYSQL_SERVER": "mysql-8.0"}, + {"MYSQL_SERVER": "percona-5.5"}, + {"MYSQL_SERVER": "percona-5.6"}, + {"MYSQL_SERVER": "percona-5.7"}, + {"MYSQL_SERVER": "percona-8.0"}, + {"MYSQL_SERVER": "mariadb-5.5"}, + {"MYSQL_SERVER": "mariadb-10.0"}, + {"MYSQL_SERVER": "mariadb-10.1"}, + {"MYSQL_SERVER": "mariadb-10.2"}, + {"MYSQL_SERVER": "mariadb-10.3"}, + {"MYSQL_SERVER": "mariadb-10.4"}, + {"MYSQL_SERVER": "mariadb-10.5"}, + {"MYSQL_SERVER": "mariadb-10.6"}, + {"MYSQL_SERVER": "mariadb-10.7"}, + {"MYSQL_SERVER": "mariadb-10.8"}, + + {"PGSQL_SERVER": "PgSQL 9.0"}, + {"PGSQL_SERVER": "PgSQL 9.1"}, + {"PGSQL_SERVER": "PgSQL 9.2"}, + {"PGSQL_SERVER": "PgSQL 9.2-alpine"}, + {"PGSQL_SERVER": "PgSQL 9.3"}, + {"PGSQL_SERVER": "PgSQL 9.3-alpine"}, + {"PGSQL_SERVER": "PgSQL 9.4"}, + {"PGSQL_SERVER": "PgSQL 9.4-alpine"}, + {"PGSQL_SERVER": "PgSQL 9.5"}, + {"PGSQL_SERVER": "PgSQL 9.5-alpine"}, + {"PGSQL_SERVER": "PgSQL 9.6"}, + {"PGSQL_SERVER": "PgSQL 9.6-alpine"}, + {"PGSQL_SERVER": "PgSQL 10"}, + {"PGSQL_SERVER": "PgSQL 10-alpine"}, + {"PGSQL_SERVER": "PgSQL 11"}, + {"PGSQL_SERVER": "PgSQL 11-alpine"}, + {"PGSQL_SERVER": "PgSQL 12"}, + {"PGSQL_SERVER": "PgSQL 12-alpine"}, + {"PGSQL_SERVER": "PgSQL 13"}, + {"PGSQL_SERVER": "PgSQL 13-alpine"}, + {"PGSQL_SERVER": "PgSQL 14"}, + {"PGSQL_SERVER": "PgSQL 14-alpine"}, + {"PGSQL_SERVER": "PgSQL latest"}, + {"PGSQL_SERVER": "PgSQL alpine"}, + + {"REDIS_SERVER": "Redis 2.8"}, + {"REDIS_SERVER": "Redis 3.0"}, + {"REDIS_SERVER": "Redis 3.0-alpine"}, + {"REDIS_SERVER": "Redis 3.2"}, + {"REDIS_SERVER": "Redis 3.2-alpine"}, + {"REDIS_SERVER": "Redis 4.0"}, + {"REDIS_SERVER": "Redis 4.0-alpine"}, + {"REDIS_SERVER": "Redis 5.0"}, + {"REDIS_SERVER": "Redis 5.0-alpine"}, + {"REDIS_SERVER": "Redis 6.0"}, + {"REDIS_SERVER": "Redis 6.0-alpine"}, + {"REDIS_SERVER": "Redis 6.2"}, + {"REDIS_SERVER": "Redis 6.2-alpine"}, + {"REDIS_SERVER": "Redis latest"}, + {"REDIS_SERVER": "Redis alpine"}, + + {"MEMCD_SERVER": "Memcd 1.4"}, + {"MEMCD_SERVER": "Memcd 1.4-alpine"}, + {"MEMCD_SERVER": "Memcd 1.5"}, + {"MEMCD_SERVER": "Memcd 1.5-alpine"}, + {"MEMCD_SERVER": "Memcd 1.6"}, + {"MEMCD_SERVER": "Memcd 1.6-alpine"}, + {"MEMCD_SERVER": "Memcd latest"}, + {"MEMCD_SERVER": "Memcd alpine"}, + + {"MONGO_SERVER": "Mongo 2.8"}, + {"MONGO_SERVER": "Mongo 3.0"}, + {"MONGO_SERVER": "Mongo 3.2"}, + {"MONGO_SERVER": "Mongo 3.4"}, + {"MONGO_SERVER": "Mongo 3.6"}, + {"MONGO_SERVER": "Mongo 4.0"}, + {"MONGO_SERVER": "Mongo 4.2"}, + {"MONGO_SERVER": "Mongo 4.4"}, + {"MONGO_SERVER": "Mongo 5.0"}, + {"MONGO_SERVER": "Mongo latest"} + ] + + +# ------------------------------------------------------------------------------------------------- +# When to run +# ------------------------------------------------------------------------------------------------- +on: + workflow_call: + outputs: + matrix: + description: "The determined version matrix" + value: ${{ jobs.params.outputs.matrix }} + +jobs: + params: + runs-on: ubuntu-latest + + outputs: + matrix: ${{ steps.set-matrix.outputs.matrix }} + + steps: + - name: "[Set-Output] Matrix" + id: set-matrix + run: | + echo "::set-output name=matrix::$( echo '${{ env.MATRIX }}' | jq -M -c )" + + - name: "[DEBUG] Show settings'" + run: | + echo 'Matrix' + echo '--------------------' + echo '${{ steps.set-matrix.outputs.matrix }}' + echo diff --git a/.github/workflows/test-versions.yml b/.github/workflows/test-versions.yml index f3a69bd6..ad780b54 100644 --- a/.github/workflows/test-versions.yml +++ b/.github/workflows/test-versions.yml @@ -21,267 +21,20 @@ on: - '[0-9]+.[0-9]+*' -# ------------------------------------------------------------------------------------------------- -# What to run -# ------------------------------------------------------------------------------------------------- jobs: - smoke_version: + # ----------------------------------------------------------------------------------------------- + # (1/2) Determine parameter settings + # ----------------------------------------------------------------------------------------------- + params: + uses: ./.github/workflows/params-versions.yml - runs-on: ubuntu-latest - strategy: - fail-fast: false - matrix: - version: - - "MYSQL_SERVER=mysql-5.5" - - "MYSQL_SERVER=mysql-5.6" - - "MYSQL_SERVER=mysql-5.7" - - "MYSQL_SERVER=mysql-8.0" - - "MYSQL_SERVER=mariadb-5.5" - - "MYSQL_SERVER=mariadb-10.0" - - "MYSQL_SERVER=mariadb-10.1" - - "MYSQL_SERVER=mariadb-10.2" - - "MYSQL_SERVER=mariadb-10.3" - - "MYSQL_SERVER=mariadb-10.4" - - "MYSQL_SERVER=mariadb-10.5" - - "MYSQL_SERVER=mariadb-10.6" - - "MYSQL_SERVER=mariadb-10.7" - - "MYSQL_SERVER=mariadb-10.8" - - "MYSQL_SERVER=percona-5.5" - - "MYSQL_SERVER=percona-5.6" - - "MYSQL_SERVER=percona-5.7" - - "MYSQL_SERVER=percona-8.0" - - - "PGSQL_SERVER=9.0" - - "PGSQL_SERVER=9.1" - - "PGSQL_SERVER=9.2" - - "PGSQL_SERVER=9.2-alpine" - - "PGSQL_SERVER=9.3" - - "PGSQL_SERVER=9.3-alpine" - - "PGSQL_SERVER=9.4" - - "PGSQL_SERVER=9.4-alpine" - - "PGSQL_SERVER=9.5" - - "PGSQL_SERVER=9.5-alpine" - - "PGSQL_SERVER=9.6" - - "PGSQL_SERVER=9.6-alpine" - - "PGSQL_SERVER=10" - - "PGSQL_SERVER=10-alpine" - - "PGSQL_SERVER=11" - - "PGSQL_SERVER=11-alpine" - - "PGSQL_SERVER=12" - - "PGSQL_SERVER=12-alpine" - - "PGSQL_SERVER=13" - - "PGSQL_SERVER=13-alpine" - - "PGSQL_SERVER=14" - - "PGSQL_SERVER=14-alpine" - - "PGSQL_SERVER=latest" - - "PGSQL_SERVER=alpine" - - - "REDIS_SERVER=2.8" - - "REDIS_SERVER=3.0" - - "REDIS_SERVER=3.0-alpine" - - "REDIS_SERVER=3.2" - - "REDIS_SERVER=3.2-alpine" - - "REDIS_SERVER=4.0" - - "REDIS_SERVER=4.0-alpine" - - "REDIS_SERVER=5.0" - - "REDIS_SERVER=5.0-alpine" - - "REDIS_SERVER=6.0" - - "REDIS_SERVER=6.0-alpine" - - "REDIS_SERVER=6.2" - - "REDIS_SERVER=6.2-alpine" - - "REDIS_SERVER=latest" - - "REDIS_SERVER=alpine" - - - "MEMCD_SERVER=1.4" - - "MEMCD_SERVER=1.4-alpine" - - "MEMCD_SERVER=1.5" - - "MEMCD_SERVER=1.5-alpine" - - "MEMCD_SERVER=1.6" - - "MEMCD_SERVER=1.6-alpine" - - "MEMCD_SERVER=latest" - - "MEMCD_SERVER=alpine" - - - "MONGO_SERVER=2.8" - - "MONGO_SERVER=3.0" - - "MONGO_SERVER=3.2" - - "MONGO_SERVER=3.4" - - "MONGO_SERVER=3.6" - - "MONGO_SERVER=4.0" - - "MONGO_SERVER=4.2" - - "MONGO_SERVER=4.4" - - "MONGO_SERVER=5.0" - - "MONGO_SERVER=latest" - name: "[${{ matrix.version }}]" - steps: - - # ------------------------------------------------------------ - # Checkout repository - # ------------------------------------------------------------ - - name: Checkout repository - uses: actions/checkout@v1 - - - name: Show environment - shell: bash - run: | - env - - - name: Show network - shell: bash - run: | - netstat -an || true - ss -tlun || true - - - name: Show Docker version - shell: bash - run: | - docker version - - # ------------------------------------------------------------ - # Setup - # ------------------------------------------------------------ - - name: Configure - shell: bash - run: | - cd .tests/ - # Set the matrix version - make configure KEY="${VERSION//=*/}" VAL="${VERSION//*=}" - # 3306 is taken, so chose another one - make configure KEY=HOST_PORT_MYSQL VAL=3307 - env: - VERSION: ${{ matrix.version }} - - - name: Pull images - shell: bash - run: | - cd .tests/ - make pull - - - name: Startup - shell: bash - run: | - cd .tests/ - make start - - - name: Docker logs - shell: bash - run: | - cd .tests/ - make logs - - # ------------------------------------------------------------ - # Run tests - # ------------------------------------------------------------ - - name: Test Modules - shell: bash - run: | - cd .tests/ - make test-smoke-modules - if: success() || failure() - - - name: Test Config - shell: bash - run: | - cd .tests/ - make test-smoke-config - if: success() || failure() - - - name: Test Intranet - shell: bash - run: | - cd .tests/ - make test-smoke-intranet - if: success() || failure() - - - name: Test Vendors - shell: bash - run: | - cd .tests/ - make test-smoke-vendors - if: success() || failure() - - - name: Test Vhosts - shell: bash - run: | - cd .tests/ - make test-smoke-vhosts - if: success() || failure() - - - name: Test Reverse Proxy - shell: bash - run: | - cd .tests/ - make test-smoke-rproxies - if: success() || failure() - - - name: Test SSL - shell: bash - run: | - cd .tests/ - make test-smoke-ssl - if: success() || failure() - - - name: Test Bind - shell: bash - run: | - cd .tests/ - make test-smoke-bind - if: success() || failure() - - - name: Test Autostart - shell: bash - run: | - cd .tests/ - make test-smoke-autostart - if: success() || failure() - - - name: "Test Framework: CakePHP" - shell: bash - run: | - cd .tests/ - make test-smoke-framework-cakephp - if: success() || failure() - - - name: "Test Framework: Drupal" - shell: bash - run: | - cd .tests/ - make test-smoke-framework-drupal - if: success() || failure() - - - name: "Test Framework: Wordpress" - shell: bash - run: | - cd .tests/ - make test-smoke-framework-wordpress - if: success() || failure() - - - name: "Test Container" - shell: bash - run: | - retry() { - for n in $(seq 5); do - echo "[${n}/5] ${*}"; - if eval "${*}"; then - echo "[SUCC] ${n}/t"; - return 0; - fi; - sleep 5; - echo "[FAIL] ${n}/5"; - done; - return 1; - } - cd .tests/ - retry make test-smoke-container - if: success() || failure() - - # ------------------------------------------------------------ - # Finish - # ------------------------------------------------------------ - - - name: "Finish: Docker logs" - shell: bash - run: | - cd .tests/ - make logs - if: success() || failure() + # ----------------------------------------------------------------------------------------------- + # (2/2) Configure Build and Deploy Matrices + # ----------------------------------------------------------------------------------------------- + test: + needs: [params] + uses: ./.github/workflows/zzz-reuse-tests.yml + with: + matrix: ${{ needs.params.outputs.matrix }} + custom_config: false diff --git a/.github/workflows/zzz-reuse-tests.yml b/.github/workflows/zzz-reuse-tests.yml new file mode 100644 index 00000000..1f2532af --- /dev/null +++ b/.github/workflows/zzz-reuse-tests.yml @@ -0,0 +1,256 @@ +--- +name: Reusable worfklow for tests + +on: + workflow_call: + ### + ### Variables + ### + inputs: + matrix: + description: 'The test matrix' + required: true + type: string + custom_config: + description: 'Apply customized .env configuration?' + required: true + type: boolean + +jobs: + # ----------------------------------------------------------------------------------------------- + # JOB: BUILD + # ----------------------------------------------------------------------------------------------- + test: + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + include: ${{ fromJson(inputs.matrix) }} + steps: + + # ------------------------------------------------------------ + # Setup repository + # ------------------------------------------------------------ + - name: "[SETUP] Checkout repository (current)" + uses: actions/checkout@v3 + with: + fetch-depth: 0 + + - name: "[DEBUG] Show Matrix configuration" + run: | + echo '${{ toJson(matrix) }}' | jq -r + + - name: "[DEBUG] Show environment" + shell: bash + run: | + env + + - name: "[DEBUG] Show network" + shell: bash + run: | + netstat -an || true + ss -tlun || true + + - name: "[DEBUG] Show Docker version" + shell: bash + run: | + docker version + + # ------------------------------------------------------------ + # Configure + # ------------------------------------------------------------ + - name: "[Configure] Configure customized configuration" + run: | + cd "${GITHUB_WORKSPACE}/.tests/" + + # Test full customization + make configure KEY=DEBUG_COMPOSE_ENTRYPOINT VAL="$(( RANDOM % 3 ))" + make configure KEY=DOCKER_LOGS VAL="$(( RANDOM % 1 ))" + make configure KEY=TLD_SUFFIX VAL=loc2 + make configure KEY=TIMEZONE VAL='Europe/Berlin' + make configure KEY=PHP_MODULES_DISABLE VAL= + make configure KEY=HTTPD_TEMPLATE_DIR VAL=.config + make configure KEY=HOST_PORT_HTTPD VAL=8080 + make configure KEY=HOST_PORT_HTTPD_SSL VAL=8443 + make configure KEY=MYSQL_ROOT_PASSWORD VAL=mysqlpass + make configure KEY=PGSQL_ROOT_USER VAL=pgroot + make configure KEY=PGSQL_ROOT_PASSWORD VAL=pgsqlpass + make configure KEY=DEVILBOX_VENDOR_PHPMYADMIN_AUTOLOGIN VAL=0 + if: inputs.custom_config + + - name: "[Configure] Configure versions" + run: | + # (1/3) Change to .tests/ directory + cd "${GITHUB_WORKSPACE}/.tests/" + + # (2/3) Change MySQL port 3306 to 3307 (3306 is already taken) + make configure KEY=HOST_PORT_MYSQL VAL=3307 + + # (3/3) Loop over configured values + while IFS= read -r line; do + KEY="${line}" + VAL="$( echo '${{ toJson(matrix) }}' | jq -r ".${KEY}" | awk '{print $NF}' )" + echo "KEY: ${KEY}" + echo "VAL: ${VAL}" + + # Set the matrix version + make configure KEY="${KEY}" VAL="${VAL}" + done <<< "$( echo '${{ toJson(matrix) }}' | jq -r 'keys[]' )" + + # ------------------------------------------------------------ + # Startup + # ------------------------------------------------------------ + - name: "[Startup] Pull images" + uses: cytopia/shell-command-retry-action@v0.1.3 + with: + retries: 3 + workdir: "${{ github.workspace }}/.tests/" + command: | + make pull + + - name: "[Startup] Start Devilbox" + uses: cytopia/shell-command-retry-action@v0.1.3 + with: + retries: 3 + workdir: "${{ github.workspace }}/.tests/" + command: | + make start + + - name: "[Startup] Show Docker logs" + uses: cytopia/shell-command-retry-action@v0.1.3 + with: + retries: 3 + workdir: "${{ github.workspace }}/.tests/" + command: | + make logs + + # ------------------------------------------------------------ + # Run tests + # ------------------------------------------------------------ + - name: Test Modules + uses: cytopia/shell-command-retry-action@v0.1.3 + with: + retries: 3 + workdir: "${{ github.workspace }}/.tests/" + command: | + make test-smoke-modules + + - name: Test Config + uses: cytopia/shell-command-retry-action@v0.1.3 + with: + retries: 3 + workdir: "${{ github.workspace }}/.tests/" + command: | + make test-smoke-config + if: success() || failure() + + - name: Test Intranet + uses: cytopia/shell-command-retry-action@v0.1.3 + with: + retries: 3 + workdir: "${{ github.workspace }}/.tests/" + command: | + make test-smoke-intranet + if: success() || failure() + + - name: Test Vendors + uses: cytopia/shell-command-retry-action@v0.1.3 + with: + retries: 3 + workdir: "${{ github.workspace }}/.tests/" + command: | + make test-smoke-vendors + if: success() || failure() + + - name: Test Vhosts + uses: cytopia/shell-command-retry-action@v0.1.3 + with: + retries: 3 + workdir: "${{ github.workspace }}/.tests/" + command: | + make test-smoke-vhosts + if: success() || failure() + + - name: Test Reverse Proxy + uses: cytopia/shell-command-retry-action@v0.1.3 + with: + retries: 3 + workdir: "${{ github.workspace }}/.tests/" + command: | + make test-smoke-rproxies + if: success() || failure() + + - name: Test SSL + uses: cytopia/shell-command-retry-action@v0.1.3 + with: + retries: 3 + workdir: "${{ github.workspace }}/.tests/" + command: | + make test-smoke-ssl + if: success() || failure() + + - name: Test Bind + uses: cytopia/shell-command-retry-action@v0.1.3 + with: + retries: 3 + workdir: "${{ github.workspace }}/.tests/" + command: | + make test-smoke-bind + if: success() || failure() + + - name: Test Autostart + uses: cytopia/shell-command-retry-action@v0.1.3 + with: + retries: 3 + workdir: "${{ github.workspace }}/.tests/" + command: | + make test-smoke-autostart + if: success() || failure() + + - name: "Test Framework: CakePHP" + uses: cytopia/shell-command-retry-action@v0.1.3 + with: + retries: 3 + workdir: "${{ github.workspace }}/.tests/" + command: | + make test-smoke-framework-cakephp + if: success() || failure() + + - name: "Test Framework: Drupal" + uses: cytopia/shell-command-retry-action@v0.1.3 + with: + retries: 3 + workdir: "${{ github.workspace }}/.tests/" + command: | + make test-smoke-framework-drupal + if: success() || failure() + + - name: "Test Framework: Wordpress" + uses: cytopia/shell-command-retry-action@v0.1.3 + with: + retries: 3 + workdir: "${{ github.workspace }}/.tests/" + command: | + make test-smoke-framework-wordpress + if: success() || failure() + + - name: "Test Container" + uses: cytopia/shell-command-retry-action@v0.1.3 + with: + retries: 3 + workdir: "${{ github.workspace }}/.tests/" + command: | + make test-smoke-container + if: success() || failure() + + # ------------------------------------------------------------ + # Finish + # ------------------------------------------------------------ + - name: "Finish: Docker logs" + uses: cytopia/shell-command-retry-action@v0.1.3 + with: + retries: 3 + workdir: "${{ github.workspace }}/.tests/" + command: | + make logs + if: success() || failure()