From 1bb27694b5c9c3616e21058b74ff4bfd113a8095 Mon Sep 17 00:00:00 2001 From: Robin Appelman Date: Thu, 2 Nov 2023 17:14:36 +0000 Subject: [PATCH] automatically determine php/server versions for phpunit Signed-off-by: Robin Appelman --- workflow-templates/phpunit-mariadb.yml | 18 +++++++++++++++--- workflow-templates/phpunit-mysql.yml | 18 +++++++++++++++--- workflow-templates/phpunit-oci.yml | 18 +++++++++++++++--- workflow-templates/phpunit-pgsql.yml | 18 +++++++++++++++--- workflow-templates/phpunit-sqlite.yml | 18 +++++++++++++++--- 5 files changed, 75 insertions(+), 15 deletions(-) diff --git a/workflow-templates/phpunit-mariadb.yml b/workflow-templates/phpunit-mariadb.yml index f1cb22e7..eeae1939 100644 --- a/workflow-templates/phpunit-mariadb.yml +++ b/workflow-templates/phpunit-mariadb.yml @@ -15,6 +15,18 @@ concurrency: cancel-in-progress: true jobs: + matrix: + runs-on: ubuntu-latest + outputs: + php-max: ${{ steps.versions.outputs.php-max-list }} + server-max: ${{ steps.versions.outputs.branches-max-list }} + steps: + - name: Checkout app + uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 + - name: Get version matrix + id: versions + uses: icewind1991/nextcloud-version-matrix@c2bf575a3516752db5ce2915499d3f694885e2c7 # v1.0.0 + changes: runs-on: ubuntu-latest @@ -42,14 +54,14 @@ jobs: phpunit-mariadb: runs-on: ubuntu-latest - needs: changes + needs: [changes, matrix] if: needs.changes.outputs.src != 'false' strategy: matrix: - php-versions: ['8.2'] + php-versions: ${{ fromJson(needs.matrix.outputs.php-max) }} + server-versions: ${{ fromJson(needs.matrix.outputs.server-max) }} mariadb-versions: ['10.6', '10.11'] - server-versions: ['master'] name: MariaDB ${{ matrix.mariadb-versions }} PHP ${{ matrix.php-versions }} Nextcloud ${{ matrix.server-versions }} diff --git a/workflow-templates/phpunit-mysql.yml b/workflow-templates/phpunit-mysql.yml index 237e715c..13590696 100644 --- a/workflow-templates/phpunit-mysql.yml +++ b/workflow-templates/phpunit-mysql.yml @@ -15,6 +15,18 @@ concurrency: cancel-in-progress: true jobs: + matrix: + runs-on: ubuntu-latest + outputs: + php-versions: ${{ steps.versions.outputs.php-versions }} + server-max: ${{ steps.versions.outputs.branches-max-list }} + steps: + - name: Checkout app + uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 + - name: Get version matrix + id: versions + uses: icewind1991/nextcloud-version-matrix@c2bf575a3516752db5ce2915499d3f694885e2c7 # v1.0.0 + changes: runs-on: ubuntu-latest @@ -42,13 +54,13 @@ jobs: phpunit-mysql: runs-on: ubuntu-latest - needs: changes + needs: [changes, matrix] if: needs.changes.outputs.src != 'false' strategy: matrix: - php-versions: ['8.0', '8.1', '8.2', '8.3'] - server-versions: ['master'] + php-versions: ${{fromJson(needs.matrix.outputs.php-versions)}} + server-versions: ${{ fromJson(needs.matrix.outputs.server-max) }} mysql-versions: ['8.1'] name: MySQL ${{ matrix.mysql-versions }} PHP ${{ matrix.php-versions }} Nextcloud ${{ matrix.server-versions }} diff --git a/workflow-templates/phpunit-oci.yml b/workflow-templates/phpunit-oci.yml index e20a9ba1..2ae80b60 100644 --- a/workflow-templates/phpunit-oci.yml +++ b/workflow-templates/phpunit-oci.yml @@ -15,6 +15,18 @@ concurrency: cancel-in-progress: true jobs: + matrix: + runs-on: ubuntu-latest + outputs: + php-max: ${{ steps.versions.outputs.php-max-list }} + server-max: ${{ steps.versions.outputs.branches-max-list }} + steps: + - name: Checkout app + uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 + - name: Get version matrix + id: versions + uses: icewind1991/nextcloud-version-matrix@c2bf575a3516752db5ce2915499d3f694885e2c7 # v1.0.0 + changes: runs-on: ubuntu-latest @@ -42,13 +54,13 @@ jobs: phpunit-oci: runs-on: ubuntu-22.04 - needs: changes + needs: [changes, matrix] if: needs.changes.outputs.src != 'false' strategy: matrix: - php-versions: ['8.2'] - server-versions: ['master'] + php-versions: ${{ fromJson(needs.matrix.outputs.php-max) }} + server-versions: ${{ fromJson(needs.matrix.outputs.server-max) }} services: oracle: diff --git a/workflow-templates/phpunit-pgsql.yml b/workflow-templates/phpunit-pgsql.yml index 96c097d3..f8ef7569 100644 --- a/workflow-templates/phpunit-pgsql.yml +++ b/workflow-templates/phpunit-pgsql.yml @@ -15,6 +15,18 @@ concurrency: cancel-in-progress: true jobs: + matrix: + runs-on: ubuntu-latest + outputs: + php-max: ${{ steps.versions.outputs.php-max-list }} + server-max: ${{ steps.versions.outputs.branches-max-list }} + steps: + - name: Checkout app + uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 + - name: Get version matrix + id: versions + uses: icewind1991/nextcloud-version-matrix@c2bf575a3516752db5ce2915499d3f694885e2c7 # v1.0.0 + changes: runs-on: ubuntu-latest @@ -42,13 +54,13 @@ jobs: phpunit-pgsql: runs-on: ubuntu-latest - needs: changes + needs: [changes, matrix] if: needs.changes.outputs.src != 'false' strategy: matrix: - php-versions: ['8.2'] - server-versions: ['master'] + php-versions: ${{ fromJson(needs.matrix.outputs.php-max) }} + server-versions: ${{ fromJson(needs.matrix.outputs.server-max) }} services: postgres: diff --git a/workflow-templates/phpunit-sqlite.yml b/workflow-templates/phpunit-sqlite.yml index 706ed48b..8bd69de0 100644 --- a/workflow-templates/phpunit-sqlite.yml +++ b/workflow-templates/phpunit-sqlite.yml @@ -15,6 +15,18 @@ concurrency: cancel-in-progress: true jobs: + matrix: + runs-on: ubuntu-latest + outputs: + php-max: ${{ steps.versions.outputs.php-max-list }} + server-max: ${{ steps.versions.outputs.branches-max-list }} + steps: + - name: Checkout app + uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 + - name: Get version matrix + id: versions + uses: icewind1991/nextcloud-version-matrix@c2bf575a3516752db5ce2915499d3f694885e2c7 # v1.0.0 + changes: runs-on: ubuntu-latest @@ -42,13 +54,13 @@ jobs: phpunit-sqlite: runs-on: ubuntu-latest - needs: changes + needs: [changes, matrix] if: needs.changes.outputs.src != 'false' strategy: matrix: - php-versions: ['8.2'] - server-versions: ['master'] + php-versions: ${{ fromJson(needs.matrix.outputs.php-max) }} + server-versions: ${{ fromJson(needs.matrix.outputs.server-max) }} steps: - name: Set app env