11# This workflow will do a clean install of node dependencies, build the source code and run tests across different versions of node
22# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions
33
4- name : RTK-Query OpenAPI Codegen Tests
4+ name : RTKQ OpenAPI Codegen
55defaults :
66 run :
77 working-directory : ./packages/rtk-query-codegen-openapi
@@ -23,24 +23,94 @@ jobs:
2323 codegen:
2424 - 'packages/rtk-query-codegen-openapi/**'
2525 - 'yarn.lock'
26+ - '.github/workflows/test-codegen.yml'
2627
2728 build :
2829 needs : changes
2930 if : ${{ needs.changes.outputs.codegen == 'true' }}
3031
31- runs-on : ubuntu-latest
32+ defaults :
33+ run :
34+ working-directory : ./packages/rtk-query-codegen-openapi
35+
36+ runs-on : ${{ matrix.os }}
37+
38+ name : Build artifact for ${{ matrix.os }} with Node ${{ matrix.node-version }}
3239
3340 strategy :
3441 matrix :
3542 node-version : ['20.x']
43+ os : [ubuntu-latest]
3644
3745 steps :
38- - uses : actions/checkout@v4
39- - name : Use Node.js ${{ matrix.node-version }}
46+ - name : Checkout repository
47+ uses : actions/checkout@v4
48+
49+ - name : Setup Node ${{ matrix.node-version }}
4050 uses : actions/setup-node@v4
4151 with :
42- node-version : ${{ matrix.node }}
52+ node-version : ${{ matrix.node-version }}
4353 cache : ' yarn'
4454
45- - run : yarn install
46- - run : yarn test
55+ - name : Install dependencies
56+ run : yarn install
57+
58+ - name : Pack
59+ run : yarn pack
60+
61+ - name : Upload artifact
62+ uses : actions/upload-artifact@v4
63+ id : artifact-upload-step
64+ with :
65+ name : package
66+ path : ./packages/rtk-query-codegen-openapi/package.tgz
67+
68+ - name : Did we fail?
69+ if : failure()
70+ run : ls -R
71+
72+ test :
73+ needs : build
74+ defaults :
75+ run :
76+ working-directory : ./packages/rtk-query-codegen-openapi
77+ name : Test final build artifact with Node.js ${{ matrix.node-version }} on ${{ matrix.os }}
78+ runs-on : ${{ matrix.os }}
79+ strategy :
80+ fail-fast : false
81+ matrix :
82+ node-version : [20.x]
83+ os : [ubuntu-latest]
84+
85+ steps :
86+ - name : Checkout repository
87+ uses : actions/checkout@v4
88+
89+ - name : Setup Node ${{ matrix.node-version }}
90+ uses : actions/setup-node@v4
91+ with :
92+ node-version : ${{ matrix.node-version }}
93+ cache : ' yarn'
94+
95+ - name : Download artifact
96+ id : download-artifact
97+ uses : actions/download-artifact@v4
98+ with :
99+ path : ./packages/rtk-query-codegen-openapi
100+ name : package
101+
102+ - name : Install dependencies
103+ run : yarn install
104+
105+ - name : Install build artifact
106+ run : yarn add ./package.tgz
107+
108+ - name : Remove path alias
109+ run : sed -i -e /@remap-prod-remove-line/d ./tsconfig.json
110+
111+ - name : Run tests
112+ run : yarn test
113+
114+ - name : Did we fail?
115+ if : failure()
116+ run : ls -R
0 commit comments