Skip to content

Commit

Permalink
Applied changes as per maintainer's feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
AdityaP700 committed Jan 25, 2025
2 parents 735aefc + 72756af commit 2f7eb4f
Showing 1 changed file with 28 additions and 24 deletions.
52 changes: 28 additions & 24 deletions .github/workflows/pr-testing-with-test-project.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#This workflow runs the tests in the test projects to make sure the generator works as a library where it is a Node dependency along with the template.
name: Test using test project

on:
Expand All @@ -6,32 +7,14 @@ on:
paths:
- 'package.json'
- 'package-lock.json'
- 'apps/**'
- 'packages/**'
- '.github/workflows/**'
- '!**/*.md'
- 'apps/'
- 'packages/'
- '.github/workflows/'
- '!/*.md'
- '!docs/**'

jobs:
should-test:
runs-on: ubuntu-latest
outputs:
run_tests: ${{ steps.check.outputs.run_tests }}
steps:
- name: Check if tests should run
id: check
run: |
# Skip for bot PRs with specific titles
if [[ "${{ github.actor }}" == "asyncapi-bot" && "${{ github.event.pull_request.title }}" =~ ^(ci:\ update|chore\(release\):) ]] || \
[[ "${{ github.actor }}" == "allcontributors[bot]" && "${{ github.event.pull_request.title }}" =~ ^docs: ]]; then
echo "run_tests=false" >> $GITHUB_OUTPUT
else
echo "run_tests=true" >> $GITHUB_OUTPUT
fi
test:
needs: should-test
if: needs.should-test.outputs.run_tests == 'true' && github.event.pull_request.draft == false
name: Test generator as dependency with Node ${{ matrix.node }}
runs-on: ubuntu-latest
strategy:
Expand All @@ -40,7 +23,28 @@ jobs:
steps:
- name: Checkout repository
uses: actions/checkout@v3

- name: Run test

- 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):')
)) ||
(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):')
)) ||
(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

0 comments on commit 2f7eb4f

Please sign in to comment.