fix: adjust generator publish script to build react-sdk #3238
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # 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: | |
| pull_request: | |
| types: [opened, reopened, synchronize, ready_for_review] | |
| jobs: | |
| changes: | |
| runs-on: ubuntu-latest | |
| outputs: | |
| should_test: ${{ steps.should_run.outputs.shouldrun }} | |
| steps: | |
| - uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3 https://github.com/actions/checkout/releases/tag/v3 | |
| - name: Checks paths-filter | |
| uses: rohansingh/paths-filter@084ca29929a4e7e708a4aa8b790347facfd830c9 # fork with predicate-quantifier fix | |
| #TODO check if we can switch back to https://github.com/dorny/paths-filter in a month or 2 (today 17.03.2025) | |
| id: filter | |
| with: | |
| predicate-quantifier: 'some' | |
| filters: | | |
| modified_files: | |
| - 'package.json' | |
| - 'package-lock.json' | |
| - 'apps/**' | |
| - 'packages/**' | |
| - '.github/workflows/**' | |
| - '!**/*.md' | |
| - '!docs/**' | |
| - '!.all-contributorsrc' | |
| - name: Determine if tests should run | |
| id: should_run | |
| if: > | |
| steps.filter.outputs.modified_files == 'true' && | |
| !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 | |
| #this test job is responsible for running dedicated complex integration tests for the generator | |
| test: | |
| needs: changes | |
| 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@f43a0e5ff2bd294095638e18286ca9a3d1956744 | |
| - name: Log should_test value across jobs #it has to stay here for some time for debugging | |
| run: | | |
| echo "should_test value: ${{ needs.changes.outputs.should_test }}" | |
| - if: needs.changes.outputs.should_test == 'true' | |
| name: Run test | |
| run: NODE_VERSION=${{ matrix.node }} docker compose up --abort-on-container-exit --force-recreate | |
| working-directory: ./apps/generator/test/test-project | |
| #this test job runs acceptance tests that use microcks and check generated code against the asyncapi contract | |
| acceptance: | |
| needs: changes | |
| name: Acceptance tests for generated templates | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 | |
| - name: Log should_test value across jobs #it has to stay here for some time for debugging | |
| run: | | |
| echo "should_test value: ${{ needs.changes.outputs.should_test }}" | |
| - if: needs.changes.outputs.should_test == 'true' | |
| name: Use Node.js 20 | |
| uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4 | |
| with: | |
| node-version: 20 | |
| - if: needs.changes.outputs.should_test == 'true' | |
| name: Install dependencies | |
| run: npm ci | |
| - if: needs.changes.outputs.should_test == 'true' | |
| name: Run package tests to generate clients #TODO: remove this step as we have a way to run the generator as a library and instead of running all integration tests again better to generate required clients separately/independently | |
| run: npm run packages:test | |
| - if: needs.changes.outputs.should_test == 'true' | |
| name: Bundle AsyncAPI spec | |
| uses: asyncapi/cli@1b8a4d320bb0e58d19d250dfe69e630df0cac9cd | |
| with: | |
| custom_command: bundle packages/templates/clients/websocket/test/__fixtures__/asyncapi-hoppscotch-server.yml --output packages/templates/clients/websocket/test/__fixtures__/bundled.yml | |
| - if: needs.changes.outputs.should_test == 'true' | |
| name: Setup microcks environment | |
| run: docker compose -f ./microcks-setup/microcks-podman.yml --profile ci up -d --force-recreate | |
| working-directory: ./packages/templates/clients/websocket/test | |
| - if: needs.changes.outputs.should_test == 'true' | |
| name: Run JS acceptance tests | |
| run: docker compose -f ./microcks-setup/microcks-podman.yml --profile test-js up --abort-on-container-exit --force-recreate | |
| working-directory: ./packages/templates/clients/websocket/test | |
| - if: needs.changes.outputs.should_test == 'true' | |
| name: Run PY acceptance tests | |
| run: docker compose -f ./microcks-setup/microcks-podman.yml --profile test-py up --abort-on-container-exit --force-recreate | |
| working-directory: ./packages/templates/clients/websocket/test |