Skip to content

Commit

Permalink
Merge pull request #238 from nextcloud/feat/only-run-node-tests-if-re…
Browse files Browse the repository at this point in the history
…quired

feat(node-tests): Only run if required
  • Loading branch information
susnux authored Oct 22, 2023
2 parents 70aa598 + 2b1f63c commit 77dbde4
Showing 1 changed file with 34 additions and 2 deletions.
36 changes: 34 additions & 2 deletions workflow-templates/node-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,37 @@ 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
continue-on-error: true
with:
filters: |
src:
- '.github/workflows/**'
- '__tests__/**'
- '__mocks__/**'
- 'src/**'
- 'appinfo/info.xml'
- 'package.json'
- 'package-lock.json'
- 'tsconfig.json'
- '**.js'
- '**.ts'
- '**.vue'
test:
runs-on: ubuntu-latest

needs: changes
if: needs.changes.outputs.src != 'false'

steps:
- name: Checkout
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
Expand Down Expand Up @@ -57,11 +85,15 @@ jobs:
files: ./coverage/lcov.info

summary:
permissions:
contents: none
runs-on: ubuntu-latest
needs: test
needs: [changes, test]

if: always()

name: test-summary

steps:
- name: Summary status
run: if ${{ needs.test.result != 'success' && needs.test.result != 'skipped' }}; then exit 1; fi
run: if ${{ needs.changes.outputs.src != 'false' && needs.test.result != 'success' }}; then exit 1; fi

0 comments on commit 77dbde4

Please sign in to comment.