-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
150 lines (121 loc) · 3.83 KB
/
test-codegen.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
# 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'
- '.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 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 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 -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 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 validity of type definitions 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