Skip to content

Centralize tooling configs in monorepo #5446

Centralize tooling configs in monorepo

Centralize tooling configs in monorepo #5446

Workflow file for this run

# 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: RTKQ OpenAPI Codegen
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'
- '.github/workflows/test-codegen.yml'
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: ${{ matrix.os }} + Node ${{ matrix.node-version }}'
strategy:
matrix:
node-version: ['20.x']
os: [ubuntu-latest]
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Setup Node ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
cache: 'yarn'
- name: Install dependencies
run: yarn install
- 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 -lR
test:
needs: build
defaults:
run:
working-directory: ./packages/rtk-query-codegen-openapi
name: 'Test build artifact: ${{ matrix.os }} + Node ${{ matrix.node-version }}'
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
node-version: [20.x]
os: [ubuntu-latest]
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Setup Node ${{ 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 install
- 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
env:
TEST_DIST: true
- name: Did we fail?
if: failure()
run: ls -R
are-the-types-wrong:
name: Check package definition with are-the-types-wrong
needs: [build]
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
node-version: [20.x]
steps:
- name: Checkout repo
uses: actions/checkout@v4
- name: Use node ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
cache: 'yarn'
- name: Install deps
run: yarn install
- name: Download artifact
id: download-artifact
uses: actions/download-artifact@v4
with:
path: ./packages/rtk-query-codegen-openapi
name: package
- name: Run are-the-types-wrong
run: yarn dlx @arethetypeswrong/cli@latest ./package.tgz --format table