-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
116 lines (93 loc) · 2.92 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
# 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 for ${{ matrix.os }} with 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 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]
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
- name: Did we fail?
if: failure()
run: ls -R