Skip to content

Commit

Permalink
ci: integrate dorny/paths-filter into PR test workflow (#1352)
Browse files Browse the repository at this point in the history
  • Loading branch information
AdityaP700 authored Feb 3, 2025
1 parent ee36155 commit 31851c7
Showing 1 changed file with 29 additions and 19 deletions.
48 changes: 29 additions & 19 deletions .github/workflows/pr-testing-with-test-project.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,47 +4,57 @@ name: Test using test project
on:
pull_request:
types: [opened, reopened, synchronize, ready_for_review]
paths:
- 'package.json'
- 'package-lock.json'
- 'apps/**'
- 'packages/**'
- '.github/workflows/**'
- '!**/*.md'
- '!docs/**'

jobs:
changes:
runs-on: ubuntu-latest
outputs:
should_test: ${{ steps.filter.outputs.changes }}
steps:
- uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3 https://github.com/actions/checkout/releases/tag/v3
- uses: dorny/paths-filter@de90cc6fb38fc0963ad72b210f1f284cd68cea36 # v3.0.2 https://github.com/dorny/paths-filter/releases/tag/v3.0.2
id: filter
with:
filters: |
changes:
- 'package.json'
- 'package-lock.json'
- 'apps/**'
- 'packages/**'
- '.github/workflows/**'
- '!**/*.md'
- '!docs/**'
test:
if: github.event.pull_request.draft == false
needs: changes
if: ${{ needs.changes.outputs.should_test == 'true' && github.event.pull_request.draft == false }}
name: Test generator as dependency with Node ${{ matrix.node }}
runs-on: ubuntu-latest
strategy:
matrix:
node: ["18", "20"]
steps:
- name: Checkout repository
uses: actions/checkout@v3

uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744
- name: Determine if tests should run
id: should_run
if: >
!github.event.pull_request.draft && !(
(github.actor == 'asyncapi-bot' && (
startsWith(github.event.pull_request.title, 'ci: update of files from global .github repo') ||
startsWith(github.event.pull_request.title, 'chore(release):')
startsWith(github.event.pull_request.title, 'ci: update of files from global .github repo') ||
startsWith(github.event.pull_request.title, 'chore(release):')
)) ||
(github.actor == 'asyncapi-bot-eve' && (
startsWith(github.event.pull_request.title, 'ci: update of files from global .github repo') ||
startsWith(github.event.pull_request.title, 'chore(release):')
startsWith(github.event.pull_request.title, 'ci: update of files from global .github repo') ||
startsWith(github.event.pull_request.title, 'chore(release):')
)) ||
(github.actor == 'allcontributors[bot]' &&
startsWith(github.event.pull_request.title, 'docs: add')
(github.actor == 'allcontributors[bot]' &&
startsWith(github.event.pull_request.title, 'docs: add')
)
)
run: echo "shouldrun=true" >> $GITHUB_OUTPUT
shell: bash

- if: steps.should_run.outputs.shouldrun == 'true'
name: Run test
run: NODE_IMAGE_TAG=${{ matrix.node }} docker compose up --abort-on-container-exit --remove-orphans --force-recreate
working-directory: ./apps/generator/test/test-project
working-directory: ./apps/generator/test/test-project

0 comments on commit 31851c7

Please sign in to comment.