summaryrefslogtreecommitdiffstats
path: root/.github
diff options
context:
space:
mode:
authorJoas Schilling <coding@schilljs.com>2023-10-10 08:47:01 +0200
committerJoas Schilling <coding@schilljs.com>2023-10-10 10:43:26 +0200
commite4c2803895609a95d18691bca91dcd0376bcf47e (patch)
tree728afc9bc8c0983f0e9ed68b8624613bd403d6df /.github
parent6cd1d72d066c6d477a383dd8d949ac65e876548a (diff)
chore(CI): Use new phpunit templates
Signed-off-by: Joas Schilling <coding@schilljs.com>
Diffstat (limited to '.github')
-rw-r--r--.github/workflows/phpunit-mysql.yml52
-rw-r--r--.github/workflows/phpunit-oci.yml48
-rw-r--r--.github/workflows/phpunit-pgsql.yml48
-rw-r--r--.github/workflows/phpunit-sqlite.yml48
-rw-r--r--.github/workflows/phpunit-summary-when-unrelated.yml143
5 files changed, 124 insertions, 215 deletions
diff --git a/.github/workflows/phpunit-mysql.yml b/.github/workflows/phpunit-mysql.yml
index 0dc0b9bef..0015431f3 100644
--- a/.github/workflows/phpunit-mysql.yml
+++ b/.github/workflows/phpunit-mysql.yml
@@ -7,18 +7,6 @@ name: PHPUnit mysql
on:
pull_request:
- paths:
- - '.github/workflows/**'
- - 'appinfo/**'
- - 'lib/**'
- - 'templates/**'
- - 'tests/**'
- - 'vendor/**'
- - 'vendor-bin/**'
- - '.php-cs-fixer.dist.php'
- - 'composer.json'
- - 'composer.lock'
-
push:
branches:
- main
@@ -33,9 +21,35 @@ concurrency:
cancel-in-progress: true
jobs:
+ changes:
+ runs-on: ubuntu-latest
+
+ outputs:
+ src: ${{ steps.changes.outputs.src}}
+
+ steps:
+ - uses: dorny/paths-filter@4512585405083f25c027a35db413c2b3b9006d50 # v2.11.1
+ id: changes
+ with:
+ filters: |
+ src:
+ - '.github/workflows/**'
+ - 'appinfo/**'
+ - 'lib/**'
+ - 'templates/**'
+ - 'tests/**'
+ - 'vendor/**'
+ - 'vendor-bin/**'
+ - '.php-cs-fixer.dist.php'
+ - 'composer.json'
+ - 'composer.lock'
+
phpunit-mysql:
runs-on: ubuntu-latest
+ needs: changes
+ if: needs.changes.outputs.src == 'true'
+
strategy:
matrix:
php-versions: ['8.0', '8.1', '8.2', '8.3']
@@ -57,23 +71,19 @@ jobs:
echo "APP_NAME=${GITHUB_REPOSITORY##*/}" >> $GITHUB_ENV
- name: Checkout server
- uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2
+ uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3.6.0
with:
submodules: true
repository: nextcloud/server
ref: ${{ matrix.server-versions }}
- - name: Patch version check for nightly PHP
- if: ${{ matrix.php-versions == '8.4' }}
- run: echo "<?php" > lib/versioncheck.php
-
- name: Checkout app
- uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2
+ uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3.6.0
with:
path: apps/${{ env.APP_NAME }}
- name: Set up php ${{ matrix.php-versions }}
- uses: shivammathur/setup-php@c5fc0d8281aba02c7fda07d3a70cc5371548067d # v2
+ uses: shivammathur/setup-php@4bd44f22a98a19e0950cbad5f31095157cc9621b # v2
with:
php-version: ${{ matrix.php-versions }}
# https://docs.nextcloud.com/server/stable/admin_manual/installation/source_installation.html#prerequisites-for-manual-installation
@@ -155,7 +165,7 @@ jobs:
permissions:
contents: none
runs-on: ubuntu-latest
- needs: phpunit-mysql
+ needs: [changes, phpunit-mysql]
if: always()
@@ -163,4 +173,4 @@ jobs:
steps:
- name: Summary status
- run: if ${{ needs.phpunit-mysql.result != 'success' }}; then exit 1; fi
+ run: if ${{ needs.changes.outputs.src == 'true' && needs.phpunit-mysql.result != 'success' }}; then exit 1; fi
diff --git a/.github/workflows/phpunit-oci.yml b/.github/workflows/phpunit-oci.yml
index e6f064ebf..7b5ce4422 100644
--- a/.github/workflows/phpunit-oci.yml
+++ b/.github/workflows/phpunit-oci.yml
@@ -7,18 +7,6 @@ name: PHPUnit OCI
on:
pull_request:
- paths:
- - '.github/workflows/**'
- - 'appinfo/**'
- - 'lib/**'
- - 'templates/**'
- - 'tests/**'
- - 'vendor/**'
- - 'vendor-bin/**'
- - '.php-cs-fixer.dist.php'
- - 'composer.json'
- - 'composer.lock'
-
push:
branches:
- main
@@ -33,9 +21,35 @@ concurrency:
cancel-in-progress: true
jobs:
+ changes:
+ runs-on: ubuntu-latest
+
+ outputs:
+ src: ${{ steps.changes.outputs.src}}
+
+ steps:
+ - uses: dorny/paths-filter@4512585405083f25c027a35db413c2b3b9006d50 # v2.11.1
+ id: changes
+ with:
+ filters: |
+ src:
+ - '.github/workflows/**'
+ - 'appinfo/**'
+ - 'lib/**'
+ - 'templates/**'
+ - 'tests/**'
+ - 'vendor/**'
+ - 'vendor-bin/**'
+ - '.php-cs-fixer.dist.php'
+ - 'composer.json'
+ - 'composer.lock'
+
phpunit-oci:
runs-on: ubuntu-22.04
+ needs: changes
+ if: needs.changes.outputs.src == 'true'
+
strategy:
matrix:
php-versions: ['8.0']
@@ -69,19 +83,19 @@ jobs:
echo "APP_NAME=${GITHUB_REPOSITORY##*/}" >> $GITHUB_ENV
- name: Checkout server
- uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2
+ uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3.6.0
with:
submodules: true
repository: nextcloud/server
ref: ${{ matrix.server-versions }}
- name: Checkout app
- uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2
+ uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3.6.0
with:
path: apps/${{ env.APP_NAME }}
- name: Set up php ${{ matrix.php-versions }}
- uses: shivammathur/setup-php@c5fc0d8281aba02c7fda07d3a70cc5371548067d # v2
+ uses: shivammathur/setup-php@4bd44f22a98a19e0950cbad5f31095157cc9621b # v2
with:
php-version: ${{ matrix.php-versions }}
# https://docs.nextcloud.com/server/stable/admin_manual/installation/source_installation.html#prerequisites-for-manual-installation
@@ -158,7 +172,7 @@ jobs:
permissions:
contents: none
runs-on: ubuntu-latest
- needs: phpunit-oci
+ needs: [changes, phpunit-oci]
if: always()
@@ -166,4 +180,4 @@ jobs:
steps:
- name: Summary status
- run: if ${{ needs.phpunit-oci.result != 'success' }}; then exit 1; fi
+ run: if ${{ needs.changes.outputs.src == 'true' && needs.phpunit-oci.result != 'success' }}; then exit 1; fi
diff --git a/.github/workflows/phpunit-pgsql.yml b/.github/workflows/phpunit-pgsql.yml
index 5e66fd2c4..bca6ddb2c 100644
--- a/.github/workflows/phpunit-pgsql.yml
+++ b/.github/workflows/phpunit-pgsql.yml
@@ -7,18 +7,6 @@ name: PHPUnit pgsql
on:
pull_request:
- paths:
- - '.github/workflows/**'
- - 'appinfo/**'
- - 'lib/**'
- - 'templates/**'
- - 'tests/**'
- - 'vendor/**'
- - 'vendor-bin/**'
- - '.php-cs-fixer.dist.php'
- - 'composer.json'
- - 'composer.lock'
-
push:
branches:
- main
@@ -33,9 +21,35 @@ concurrency:
cancel-in-progress: true
jobs:
+ changes:
+ runs-on: ubuntu-latest
+
+ outputs:
+ src: ${{ steps.changes.outputs.src}}
+
+ steps:
+ - uses: dorny/paths-filter@4512585405083f25c027a35db413c2b3b9006d50 # v2.11.1
+ id: changes
+ with:
+ filters: |
+ src:
+ - '.github/workflows/**'
+ - 'appinfo/**'
+ - 'lib/**'
+ - 'templates/**'
+ - 'tests/**'
+ - 'vendor/**'
+ - 'vendor-bin/**'
+ - '.php-cs-fixer.dist.php'
+ - 'composer.json'
+ - 'composer.lock'
+
phpunit-pgsql:
runs-on: ubuntu-latest
+ needs: changes
+ if: needs.changes.outputs.src == 'true'
+
strategy:
matrix:
php-versions: ['8.0']
@@ -59,19 +73,19 @@ jobs:
echo "APP_NAME=${GITHUB_REPOSITORY##*/}" >> $GITHUB_ENV
- name: Checkout server
- uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2
+ uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3.6.0
with:
submodules: true
repository: nextcloud/server
ref: ${{ matrix.server-versions }}
- name: Checkout app
- uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2
+ uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3.6.0
with:
path: apps/${{ env.APP_NAME }}
- name: Set up php ${{ matrix.php-versions }}
- uses: shivammathur/setup-php@c5fc0d8281aba02c7fda07d3a70cc5371548067d # v2
+ uses: shivammathur/setup-php@4bd44f22a98a19e0950cbad5f31095157cc9621b # v2
with:
php-version: ${{ matrix.php-versions }}
# https://docs.nextcloud.com/server/stable/admin_manual/installation/source_installation.html#prerequisites-for-manual-installation
@@ -148,7 +162,7 @@ jobs:
permissions:
contents: none
runs-on: ubuntu-latest
- needs: phpunit-pgsql
+ needs: [changes, phpunit-pgsql]
if: always()
@@ -156,4 +170,4 @@ jobs:
steps:
- name: Summary status
- run: if ${{ needs.phpunit-pgsql.result != 'success' }}; then exit 1; fi
+ run: if ${{ needs.changes.outputs.src == 'true' && needs.phpunit-pgsql.result != 'success' }}; then exit 1; fi
diff --git a/.github/workflows/phpunit-sqlite.yml b/.github/workflows/phpunit-sqlite.yml
index d613117fa..e441c5261 100644
--- a/.github/workflows/phpunit-sqlite.yml
+++ b/.github/workflows/phpunit-sqlite.yml
@@ -7,18 +7,6 @@ name: PHPUnit sqlite
on:
pull_request:
- paths:
- - '.github/workflows/**'
- - 'appinfo/**'
- - 'lib/**'
- - 'templates/**'
- - 'tests/**'
- - 'vendor/**'
- - 'vendor-bin/**'
- - '.php-cs-fixer.dist.php'
- - 'composer.json'
- - 'composer.lock'
-
push:
branches:
- main
@@ -33,9 +21,35 @@ concurrency:
cancel-in-progress: true
jobs:
+ changes:
+ runs-on: ubuntu-latest
+
+ outputs:
+ src: ${{ steps.changes.outputs.src}}
+
+ steps:
+ - uses: dorny/paths-filter@4512585405083f25c027a35db413c2b3b9006d50 # v2.11.1
+ id: changes
+ with:
+ filters: |
+ src:
+ - '.github/workflows/**'
+ - 'appinfo/**'
+ - 'lib/**'
+ - 'templates/**'
+ - 'tests/**'
+ - 'vendor/**'
+ - 'vendor-bin/**'
+ - '.php-cs-fixer.dist.php'
+ - 'composer.json'
+ - 'composer.lock'
+
phpunit-sqlite:
runs-on: ubuntu-latest
+ needs: changes
+ if: needs.changes.outputs.src == 'true'
+
strategy:
matrix:
php-versions: ['8.0']
@@ -48,19 +62,19 @@ jobs:
echo "APP_NAME=${GITHUB_REPOSITORY##*/}" >> $GITHUB_ENV
- name: Checkout server
- uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2
+ uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3.6.0
with:
submodules: true
repository: nextcloud/server
ref: ${{ matrix.server-versions }}
- name: Checkout app
- uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2
+ uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3.6.0
with:
path: apps/${{ env.APP_NAME }}
- name: Set up php ${{ matrix.php-versions }}
- uses: shivammathur/setup-php@c5fc0d8281aba02c7fda07d3a70cc5371548067d # v2
+ uses: shivammathur/setup-php@4bd44f22a98a19e0950cbad5f31095157cc9621b # v2
with:
php-version: ${{ matrix.php-versions }}
# https://docs.nextcloud.com/server/stable/admin_manual/installation/source_installation.html#prerequisites-for-manual-installation
@@ -137,7 +151,7 @@ jobs:
permissions:
contents: none
runs-on: ubuntu-latest
- needs: phpunit-sqlite
+ needs: [changes, phpunit-sqlite]
if: always()
@@ -145,4 +159,4 @@ jobs:
steps:
- name: Summary status
- run: if ${{ needs.phpunit-sqlite.result != 'success' }}; then exit 1; fi
+ run: if ${{ needs.changes.outputs.src == 'true' && needs.phpunit-sqlite.result != 'success' }}; then exit 1; fi
diff --git a/.github/workflows/phpunit-summary-when-unrelated.yml b/.github/workflows/phpunit-summary-when-unrelated.yml
deleted file mode 100644
index 24c35d344..000000000
--- a/.github/workflows/phpunit-summary-when-unrelated.yml
+++ /dev/null
@@ -1,143 +0,0 @@
-# This workflow is provided via the organization template repository
-#
-# https://github.com/nextcloud/.github
-# https://docs.github.com/en/actions/learn-github-actions/sharing-workflows-with-your-organization
-
-name: PHPUnit summary
-
-on:
- pull_request:
- paths-ignore:
- - '.github/workflows/**'
- - 'appinfo/**'
- - 'lib/**'
- - 'templates/**'
- - 'tests/**'
- - 'vendor/**'
- - 'vendor-bin/**'
- - '.php-cs-fixer.dist.php'
- - 'composer.json'
- - 'composer.lock'
-
-env:
- PATHS_IGNORE: '.github/workflows/**;appinfo/**;lib/**;templates/**;tests/**;vendor/**;vendor-bin/**;.php-cs-fixer.dist.php;composer.json;composer.lock'
-
-permissions:
- contents: read
-
-jobs:
- action-no-summary:
- permissions:
- contents: none
- runs-on: ubuntu-latest
-
- name: action-not-src
- outputs:
- found_file: ${{ steps.confirm-negative-list.outputs.result }}
-
- steps:
- - uses: actions/checkout@v3
- with:
- fetch-depth: ${{ github.event_name == 'pull_request' && 2 || 0 }}
-
- - name: Get changed files from diff
- id: changed-files
- run: |
- if ${{ github.event_name == 'pull_request' }}; then
- echo "changed_files=$(git diff --name-only -r HEAD^1 HEAD | xargs)" >> $GITHUB_OUTPUT
- else
- echo "changed_files=$(git diff --name-only ${{ github.event.before }} ${{ github.event.after }} | xargs)" >> $GITHUB_OUTPUT
- fi
-
- - name: Set up node 20
- uses: actions/setup-node@e33196f7422957bea03ed53f6fbb155025ffc7b8 # v3
- with:
- node-version: 20
-
- - name: Install minimatch
- run: npm i minimatch
-
- - name: Check if a file is in paths-ignored
- id: confirm-negative-list
- uses: actions/github-script@v5
- with:
- github-token: ${{secrets.GITHUB_TOKEN}}
- result-encoding: string
- script: |
- const { minimatch } = require('minimatch')
- const changedPaths = "${{ steps.changed-files.outputs.changed_files }}".split(' ')
-
- let matched = ''
- process.env.PATHS_IGNORE.split(';').every(pattern => {
- changedPaths.every(path => {
- console.info('Testing ' + path + ' for pattern ' + pattern)
- if (minimatch(path, pattern)) {
- console.info(path + ' matched, aborting "unrelated summary"')
- matched = '1'
- return false
- }
- return true
- })
- return !matched
- })
- return matched
-
- summary-mysql:
- permissions:
- contents: none
- runs-on: ubuntu-latest
-
- needs: action-no-summary
-
- name: phpunit-mysql-summary
-
- if: needs.action-no-summary.outputs.found_file == ''
-
- steps:
- - name: Summary status
- run: 'echo "No PHP files changed, skipped PHPUnit"'
-
- summary-oci:
- permissions:
- contents: none
- runs-on: ubuntu-latest
-
- needs: action-no-summary
-
- name: phpunit-oci-summary
-
- if: needs.action-no-summary.outputs.found_file == ''
-
- steps:
- - name: Summary status
- run: 'echo "No PHP files changed, skipped PHPUnit"'
-
- summary-pgsql:
- permissions:
- contents: none
- runs-on: ubuntu-latest
-
- needs: action-no-summary
-
- name: phpunit-pgsql-summary
-
- if: needs.action-no-summary.outputs.found_file == ''
-
- steps:
- - name: Summary status
- run: 'echo "No PHP files changed, skipped PHPUnit"'
-
- summary-sqlite:
- permissions:
- contents: none
- runs-on: ubuntu-latest
-
- needs: action-no-summary
-
- name: phpunit-sqlite-summary
-
- if: needs.action-no-summary.outputs.found_file == ''
-
- steps:
- - name: Summary status
- run: 'echo "No PHP files changed, skipped PHPUnit"'