Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix codegen-openapi tests #4307

Open
wants to merge 58 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
58 commits
Select commit Hold shift + click to select a range
9f6d565
Fix codegen tests
aryaemami59 Mar 27, 2024
61ab4ea
Fix minor typo in codegen CI
aryaemami59 Mar 27, 2024
1f8b9c5
Comment out code related to checking for changes in the codegen step
aryaemami59 Mar 27, 2024
8bd53a6
Refactor `afterEach` function in `cli.test.ts`
aryaemami59 Mar 27, 2024
36a7fa1
Add path alias for codegen
aryaemami59 Mar 27, 2024
095c96d
Add `vite-tsconfig-paths` to `devDependencies`
aryaemami59 Mar 27, 2024
a742da2
Use `vite-tsconfig-paths` for path aliases during tests
aryaemami59 Mar 27, 2024
91722a8
Remove unnecessary imports and aliases in `vitest.config.mts`
aryaemami59 Mar 27, 2024
412e674
Update cli path in test file
aryaemami59 Mar 27, 2024
c93281f
Update `test-codegen.yml` with steps for building and testing artifacts
aryaemami59 Mar 27, 2024
96e444d
Add `@remap-prod-remove-line` directive to `tsconfig.json`
aryaemami59 Mar 27, 2024
fe23320
Add working directory for codegen in `test-codegen.yml`
aryaemami59 Mar 27, 2024
40b1c44
Update artifact path in `test-codegen.yml`
aryaemami59 Mar 27, 2024
19e7267
Fix install dependencies step in `test-codegen.yml`
aryaemami59 Mar 27, 2024
ef0d413
Remove node 18 in `test-codegen.yml`
aryaemami59 Mar 27, 2024
74f5d2e
Revert back to `yarn install`
aryaemami59 Mar 27, 2024
7631dc0
Only test on ubuntu for now
aryaemami59 Mar 27, 2024
46729b6
Add `prepack` script to `package.json`
aryaemami59 Mar 27, 2024
f828f3c
Import `generateEndpoints` from `@rtk-query/codegen-openapi`
aryaemami59 Mar 27, 2024
7675b22
Remove unnecessary "prepare" script from `package.json`
aryaemami59 Mar 27, 2024
aadf18c
Update artifact path in `test-codegen.yml`
aryaemami59 Mar 27, 2024
53a6613
Add failure check in `test-codegen.yml`
aryaemami59 Mar 27, 2024
f88fb0e
Update `cliPath` in `cli.test.ts`
aryaemami59 Mar 27, 2024
006e8e3
Run CI for windows and macOS as well
aryaemami59 Mar 27, 2024
a582a93
Try focused installs during CI
aryaemami59 Mar 27, 2024
a205ecd
Remove unnecessary test setup in `cli.test.ts`
aryaemami59 Mar 27, 2024
0fb9c56
Fix tests in `generateEndpoints.test.ts`
aryaemami59 Mar 27, 2024
c2a3b3e
Update snapshots for `generateEndpoints.test.ts.snap`
aryaemami59 Mar 27, 2024
9c84f82
Update test pool to use threads
aryaemami59 Mar 27, 2024
6e4cdee
Disable `fileParallelism` for unit tests
aryaemami59 Mar 27, 2024
d4b0345
Move path aliases from the root `tsconfig.json` to `test/tsconfig.json`
aryaemami59 Mar 27, 2024
73a3236
Update `cliPath` in `cli.test.ts`
aryaemami59 Mar 27, 2024
db345a1
Enable `importHelpers` for codegen
aryaemami59 Mar 27, 2024
f4d6775
Sort fields in `test/tsconfig.json` of codegen
aryaemami59 Mar 27, 2024
cc44dd7
Add `noImplicitReturns` to `tsconfig.json`
aryaemami59 Mar 27, 2024
7d5d905
Make `test\tsconfig.json` extend the root `tsconfig.json`
aryaemami59 Mar 27, 2024
508120c
Rename `tsconfig.json` to `tsconfig.build.json`
aryaemami59 Mar 27, 2024
1f5d6e6
Rename `test/tsconfig.json` to `tsconfig.json`
aryaemami59 Mar 27, 2024
c0ddd38
Make `tsconfig.build.json` extend `tsconfig.json`
aryaemami59 Mar 27, 2024
88402cc
Update path alias in `tsconfig.json`
aryaemami59 Mar 27, 2024
b7691cd
Uncomment commented out code in `test-codegen.yml`
aryaemami59 Mar 27, 2024
abdf65d
Merge branch 'master' of https://github.com/reduxjs/redux-toolkit int…
aryaemami59 Apr 2, 2024
7650c15
Run CI build step only once
aryaemami59 Apr 2, 2024
2f719d2
Merge branch 'master' of https://github.com/reduxjs/redux-toolkit int…
aryaemami59 Apr 5, 2024
6367c17
Merge branch 'master' of https://github.com/reduxjs/redux-toolkit int…
aryaemami59 Apr 12, 2024
cc518e0
Merge branch 'master' of https://github.com/reduxjs/redux-toolkit int…
aryaemami59 Apr 16, 2024
36a084c
Merge branch 'master' of https://github.com/reduxjs/redux-toolkit int…
aryaemami59 Apr 17, 2024
0f38429
Merge branch 'master' of https://github.com/reduxjs/redux-toolkit int…
aryaemami59 May 1, 2024
5690d1a
Merge branch 'master' of https://github.com/reduxjs/redux-toolkit int…
aryaemami59 May 1, 2024
040e83c
Merge branch 'master' of https://github.com/reduxjs/redux-toolkit int…
aryaemami59 May 2, 2024
69c2406
Merge branch 'master' of https://github.com/reduxjs/redux-toolkit int…
aryaemami59 May 6, 2024
9736ab3
Merge branch 'master' of https://github.com/reduxjs/redux-toolkit int…
aryaemami59 May 7, 2024
6c4fc15
Merge branch 'master' of https://github.com/reduxjs/redux-toolkit int…
aryaemami59 May 9, 2024
1915021
Merge branch 'fix-codegen-tests' of https://github.com/aryaemami59/re…
aryaemami59 May 9, 2024
4a33316
Merge branch 'fix-codegen-tests' of https://github.com/aryaemami59/re…
aryaemami59 May 14, 2024
1dfcbaa
Merge branch 'master' of https://github.com/reduxjs/redux-toolkit int…
aryaemami59 May 16, 2024
1ab68d9
Merge branch 'master' of https://github.com/reduxjs/redux-toolkit int…
aryaemami59 May 16, 2024
e572d0c
Merge branch 'master' of https://github.com/reduxjs/redux-toolkit int…
aryaemami59 May 25, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
81 changes: 75 additions & 6 deletions .github/workflows/test-codegen.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,19 +28,88 @@ jobs:
needs: changes
if: ${{ needs.changes.outputs.codegen == 'true' }}

runs-on: ubuntu-latest
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:
- uses: actions/checkout@v4
- name: Use Node.js ${{ matrix.node-version }}
- name: Checkout repository
uses: actions/checkout@v4

- name: Setup Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node }}
node-version: ${{ matrix.node-version }}
cache: 'yarn'

- run: yarn install
- run: yarn test
- 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
5 changes: 3 additions & 2 deletions packages/rtk-query-codegen-openapi/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@
"rtk-query-codegen-openapi": "lib/bin/cli.js"
},
"scripts": {
"build": "yarn clean && tsc && chmod +x lib/bin/cli.js",
"build": "yarn clean && tsc -p tsconfig.build.json && chmod +x lib/bin/cli.js",
"clean": "rimraf lib",
"prepare": "yarn build && chmod +x lib/bin/cli.js",
"prepack": "yarn build",
"format": "prettier --write \"src/**/*.ts\"",
"test:update": "vitest --run --update",
"test:update:enum": "lib/bin/cli.js test/config.example.enum.ts",
Expand Down Expand Up @@ -52,6 +52,7 @@
"pretty-quick": "^4.0.0",
"rimraf": "^5.0.5",
"ts-node": "^10.9.2",
"vite-tsconfig-paths": "^4.3.2",
"vitest": "^1.2.2",
"yalc": "^1.0.0-pre.47"
},
Expand Down