Fix codegen-openapi tests #4525
Workflow file for this run
This file contains 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 will do a clean install of node dependencies, build the source code and run tests across different versions of node | |
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions | |
name: RTK-Query OpenAPI Codegen Tests | |
defaults: | |
run: | |
working-directory: ./packages/rtk-query-codegen-openapi | |
on: [push, pull_request] | |
jobs: | |
changes: | |
name: Check for changes | |
runs-on: ubuntu-latest | |
outputs: | |
codegen: ${{ steps.filter.outputs.codegen }} | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: dorny/paths-filter@v3 | |
id: filter | |
with: | |
filters: | | |
codegen: | |
- 'packages/rtk-query-codegen-openapi/**' | |
- 'yarn.lock' | |
build: | |
needs: changes | |
if: ${{ needs.changes.outputs.codegen == 'true' }} | |
defaults: | |
run: | |
working-directory: ./packages/rtk-query-codegen-openapi | |
runs-on: ${{ matrix.os }} | |
name: Build artifact for ${{ matrix.os }} with Node.js ${{ matrix.node-version }} | |
strategy: | |
matrix: | |
node-version: ['20.x'] | |
os: [ubuntu-latest] | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Setup Node.js ${{ matrix.node-version }} | |
uses: actions/setup-node@v4 | |
with: | |
node-version: ${{ matrix.node-version }} | |
cache: 'yarn' | |
- name: Install dependencies | |
run: yarn workspaces focus @rtk-query/codegen-openapi | |
- name: Pack | |
run: yarn pack | |
- name: Upload artifact | |
uses: actions/upload-artifact@v4 | |
id: artifact-upload-step | |
with: | |
name: package | |
path: ./packages/rtk-query-codegen-openapi/package.tgz | |
- name: Did we fail? | |
if: failure() | |
run: ls -R | |
test: | |
needs: build | |
defaults: | |
run: | |
working-directory: ./packages/rtk-query-codegen-openapi | |
name: Test final build artifact with Node.js ${{ matrix.node-version }} on ${{ matrix.os }} | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
node-version: [20.x] | |
os: [ubuntu-latest, windows-latest, macos-latest] | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Setup Node.js ${{ matrix.node-version }} | |
uses: actions/setup-node@v4 | |
with: | |
node-version: ${{ matrix.node-version }} | |
cache: 'yarn' | |
- name: Download artifact | |
id: download-artifact | |
uses: actions/download-artifact@v4 | |
with: | |
path: ./packages/rtk-query-codegen-openapi | |
name: package | |
- name: Install dependencies | |
run: yarn workspaces focus @rtk-query/codegen-openapi | |
- name: Install build artifact | |
run: yarn add ./package.tgz | |
- name: Remove path alias | |
run: sed -i -e /@remap-prod-remove-line/d ./tsconfig.json | |
- name: Run tests | |
run: yarn test | |
- name: Did we fail? | |
if: failure() | |
run: ls -R |