diff options
author | Joas Schilling <coding@schilljs.com> | 2023-10-12 09:56:07 +0200 |
---|---|---|
committer | Joas Schilling <coding@schilljs.com> | 2023-10-12 09:56:07 +0200 |
commit | bd1a3a6c350f5372631e70b2bb4438d9fcf44a20 (patch) | |
tree | 2de1fc54e751c0dfe5477acc743c5564be858437 /.github/workflows | |
parent | a3009bbeeda07ffd56162a728ab9a947a9c9f12d (diff) |
fix(CI): Fix conditions when to wait for integration tests results like with PHPUnit
Signed-off-by: Joas Schilling <coding@schilljs.com>
Diffstat (limited to '.github/workflows')
-rw-r--r-- | .github/workflows/integration-mysql.yml | 30 | ||||
-rw-r--r-- | .github/workflows/integration-oci.yml | 30 | ||||
-rw-r--r-- | .github/workflows/integration-pgsql.yml | 42 | ||||
-rw-r--r-- | .github/workflows/integration-sqlite.yml | 30 | ||||
-rw-r--r-- | .github/workflows/integration-summary-when-unrelated.yml | 143 |
5 files changed, 112 insertions, 163 deletions
diff --git a/.github/workflows/integration-mysql.yml b/.github/workflows/integration-mysql.yml index ca4ffb3f7..8df39f1d5 100644 --- a/.github/workflows/integration-mysql.yml +++ b/.github/workflows/integration-mysql.yml @@ -25,9 +25,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/integration/**' + - 'vendor/**' + - 'vendor-bin/**' + - '.php-cs-fixer.dist.php' + - 'composer.json' + - 'composer.lock' + integration-mysql: runs-on: ubuntu-latest + needs: changes + if: needs.changes.outputs.src == 'true' + strategy: fail-fast: false matrix: @@ -130,7 +156,7 @@ jobs: permissions: contents: none runs-on: ubuntu-latest - needs: integration-mysql + needs: [changes, integration-mysql] if: always() @@ -138,4 +164,4 @@ jobs: steps: - name: Summary status - run: if ${{ needs.integration-mysql.result != 'success' }}; then exit 1; fi + run: if ${{ needs.changes.outputs.src == 'true' && needs.integration-mysql.result != 'success' }}; then exit 1; fi diff --git a/.github/workflows/integration-oci.yml b/.github/workflows/integration-oci.yml index 4c41b23fd..61139ce44 100644 --- a/.github/workflows/integration-oci.yml +++ b/.github/workflows/integration-oci.yml @@ -25,9 +25,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/integration/**' + - 'vendor/**' + - 'vendor-bin/**' + - '.php-cs-fixer.dist.php' + - 'composer.json' + - 'composer.lock' + integration-oci: runs-on: ubuntu-22.04 + needs: changes + if: needs.changes.outputs.src == 'true' + strategy: fail-fast: false matrix: @@ -142,7 +168,7 @@ jobs: permissions: contents: none runs-on: ubuntu-latest - needs: integration-oci + needs: [changes, integration-oci] if: always() @@ -150,4 +176,4 @@ jobs: steps: - name: Summary status - run: if ${{ needs.integration-oci.result != 'success' }}; then exit 1; fi + run: if ${{ needs.changes.outputs.src == 'true' && needs.integration-oci.result != 'success' }}; then exit 1; fi diff --git a/.github/workflows/integration-pgsql.yml b/.github/workflows/integration-pgsql.yml index 9889d4713..37f0303b6 100644 --- a/.github/workflows/integration-pgsql.yml +++ b/.github/workflows/integration-pgsql.yml @@ -7,18 +7,6 @@ name: Integration pgsql on: pull_request: - paths: - - '.github/workflows/**' - - 'appinfo/**' - - 'lib/**' - - 'templates/**' - - 'tests/integration/**' - - '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/integration/**' + - 'vendor/**' + - 'vendor-bin/**' + - '.php-cs-fixer.dist.php' + - 'composer.json' + - 'composer.lock' + integration-pgsql: runs-on: ubuntu-latest + needs: changes + if: needs.changes.outputs.src == 'true' + strategy: fail-fast: false matrix: @@ -148,7 +162,7 @@ jobs: permissions: contents: none runs-on: ubuntu-latest - needs: integration-pgsql + needs: [changes, integration-pgsql] if: always() @@ -156,4 +170,4 @@ jobs: steps: - name: Summary status - run: if ${{ needs.integration-pgsql.result != 'success' }}; then exit 1; fi + run: if ${{ needs.changes.outputs.src == 'true' && needs.integration-pgsql.result != 'success' }}; then exit 1; fi diff --git a/.github/workflows/integration-sqlite.yml b/.github/workflows/integration-sqlite.yml index 9f5bd54f0..e8bc8bf4d 100644 --- a/.github/workflows/integration-sqlite.yml +++ b/.github/workflows/integration-sqlite.yml @@ -25,9 +25,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/integration/**' + - 'vendor/**' + - 'vendor-bin/**' + - '.php-cs-fixer.dist.php' + - 'composer.json' + - 'composer.lock' + integration-sqlite: runs-on: ubuntu-latest + needs: changes + if: needs.changes.outputs.src == 'true' + strategy: fail-fast: false matrix: @@ -121,7 +147,7 @@ jobs: permissions: contents: none runs-on: ubuntu-latest - needs: integration-sqlite + needs: [changes, integration-sqlite] if: always() @@ -129,4 +155,4 @@ jobs: steps: - name: Summary status - run: if ${{ needs.integration-sqlite.result != 'success' }}; then exit 1; fi + run: if ${{ needs.changes.outputs.src == 'true' && needs.integration-sqlite.result != 'success' }}; then exit 1; fi diff --git a/.github/workflows/integration-summary-when-unrelated.yml b/.github/workflows/integration-summary-when-unrelated.yml deleted file mode 100644 index e5186f93b..000000000 --- a/.github/workflows/integration-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: Integration summary - -on: - pull_request: - paths-ignore: - - '.github/workflows/**' - - 'appinfo/**' - - 'lib/**' - - 'templates/**' - - 'tests/integration/**' - - 'vendor/**' - - 'vendor-bin/**' - - '.php-cs-fixer.dist.php' - - 'composer.json' - - 'composer.lock' - -env: - PATHS_IGNORE: '.github/workflows/**;appinfo/**;lib/**;templates/**;tests/integration/**;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: integration-mysql-summary - - if: needs.action-no-summary.outputs.found_file == '' - - steps: - - name: Summary status - run: 'echo "No PHP files changed, skipped Integration tests"' - - summary-oci: - permissions: - contents: none - runs-on: ubuntu-latest - - needs: action-no-summary - - name: integration-oci-summary - - if: needs.action-no-summary.outputs.found_file == '' - - steps: - - name: Summary status - run: 'echo "No PHP files changed, skipped Integration tests"' - - summary-pgsql: - permissions: - contents: none - runs-on: ubuntu-latest - - needs: action-no-summary - - name: integration-pgsql-summary - - if: needs.action-no-summary.outputs.found_file == '' - - steps: - - name: Summary status - run: 'echo "No PHP files changed, skipped Integration tests"' - - summary-sqlite: - permissions: - contents: none - runs-on: ubuntu-latest - - needs: action-no-summary - - name: integration-sqlite-summary - - if: needs.action-no-summary.outputs.found_file == '' - - steps: - - name: Summary status - run: 'echo "No PHP files changed, skipped Integration tests"' |