Repository navigation
172 lines (139 loc) · 5.09 KB
/
Copy pathtest-codegen.yml
File metadata and controls
172 lines (139 loc) · 5.09 KB
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
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
# 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]
permissions:
contents: read
pull-requests: read
jobs:
changes:
name: Check for changes
runs-on: ubuntu-latest
outputs:
codegen: ${{ steps.filter.outputs.codegen }}
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- uses: dorny/paths-filter@7b450fff21473bca461d4b92ce414b9d0420d706 # v4.0.2
id: filter
with:
filters: |
codegen:
- 'packages/rtk-query-codegen-openapi/**'
- 'pnpm-lock.yaml'
- '.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: ['24.x']
os: [ubuntu-latest]
steps:
- name: Checkout repository
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
# pnpm/setup must run before setup-node, or setup-node's
# `cache: 'pnpm'` cannot find the store to cache.
- uses: pnpm/setup@84cb39b217b10273981911c288cd62326dc7c6d2 # v2.0.2
with:
install: false
- name: Setup Node ${{ matrix.node-version }}
uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0
with:
node-version: ${{ matrix.node-version }}
cache: 'pnpm'
# `pnpm install` from inside a workspace package still installs the whole
# workspace ("Scope: all 11 workspace projects"), the same as yarn did.
- name: Install dependencies
run: pnpm install
# pnpm names the tarball <name>-<version>.tgz where yarn named it
# package.tgz. --out keeps the name the artifact steps below expect.
- name: Pack
run: pnpm pack --out package.tgz
- name: Upload artifact
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
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: [24.x]
os: [ubuntu-latest]
steps:
- name: Checkout repository
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- uses: pnpm/setup@84cb39b217b10273981911c288cd62326dc7c6d2 # v2.0.2
with:
install: false
- name: Setup Node ${{ matrix.node-version }}
uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0
with:
node-version: ${{ matrix.node-version }}
cache: 'pnpm'
- name: Download artifact
id: download-artifact
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
with:
path: ./packages/rtk-query-codegen-openapi
name: package
- name: Install dependencies
run: pnpm install
- name: Install build artifact
run: pnpm add ./package.tgz
- name: Remove path alias
run: sed -i -e /@remap-prod-remove-line/d ./tsconfig.json
- name: Run tests
run: pnpm 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: [24.x]
steps:
- name: Checkout repo
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- uses: pnpm/setup@84cb39b217b10273981911c288cd62326dc7c6d2 # v2.0.2
with:
install: false
- name: Use node ${{ matrix.node-version }}
uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0
with:
node-version: ${{ matrix.node-version }}
cache: 'pnpm'
- name: Install deps
run: pnpm install
- name: Download artifact
id: download-artifact
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
with:
path: ./packages/rtk-query-codegen-openapi
name: package
- name: Run are-the-types-wrong
run: pnpm exec attw ./package.tgz --format table --exclude-entrypoints cli