-
Notifications
You must be signed in to change notification settings - Fork 2
126 lines (108 loc) · 3.58 KB
/
codegen.yml
File metadata and controls
126 lines (108 loc) · 3.58 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
name: codegen
on:
push:
branches:
- main
paths:
- '.github/workflows/codegen.yml'
- 'codegen/**'
- 'api/*.yml'
- '!**/*.md'
pull_request:
paths:
- '.github/workflows/codegen.yml'
- 'codegen/**'
- 'api/*.yml'
- '!**/*.md'
release:
types: [published]
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
permissions:
contents: read
jobs:
tests:
if: |
${{ github.event_name == 'pull_request' || github.event_name == 'release' }}
timeout-minutes: 15
runs-on: ubuntu-latest
name: 'Test codegen'
steps:
- name: Harden the runner (Audit all outbound calls)
uses: step-security/harden-runner@58077d3c7e43986b6b15fba718e8ea69e387dfcc # v2.15.1
with:
egress-policy: audit
- name: Checkout csolution-rpc repository
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
fetch-depth: 0
- name: Set up Node.js
uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f # v6.3.0
with:
node-version: 'lts/*'
- name: Install dependencies
run: npm ci
working-directory: codegen
- name: Run linter
run: npm run lint
working-directory: codegen
- name: Run tests
run: npm test
working-directory: codegen
- name: Archive test report
uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7.0.0
with:
name: codegen-test
path: codegen/reports/junit/testreport.xml
retention-days: 1
if-no-files-found: error
- name: Archive generated interface files
uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7.0.0
with:
name: codegen-rpc-interfaces
path: codegen/generated/*
retention-days: 1
if-no-files-found: error
release:
if: ${{ github.event_name == 'release' }}
needs: [ tests ]
timeout-minutes: 15
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Harden the runner (Audit all outbound calls)
uses: step-security/harden-runner@58077d3c7e43986b6b15fba718e8ea69e387dfcc # v2.15.1
with:
egress-policy: audit
- name: Download generated files
uses: actions/download-artifact@70fc10c6e5e1ce46ad2ea6f2b72d43f7d47b13c3 # v8.0.0
with:
name: codegen-rpc-interfaces
path: generated
- name: Check release version tag
run: |
version=$(grep -oP 'RPC_API_VERSION\s*=\s*"\K[^"]+' RpcInterface.h)
tag=${{ github.event.release.tag_name }}
tag="${tag#v}"
if [ "$tag" != "$version" ]; then
echo "Release version does not match the version in generated interfaces. Update csolution-openapi.yml"
exit 1
fi
working-directory: generated
- name: ZIP generated files
run: zip -r csolution-rpc.zip RpcInterface.h rpc-interface.ts
working-directory: generated
- name: TAR generated files
run: tar -czf csolution-rpc.tar.gz RpcInterface.h rpc-interface.ts
working-directory: generated
- name: Attach files to release assets
id: release_assets
uses: svenstaro/upload-release-action@b98a3b12e86552593f3e4e577ca8a62aa2f3f22b # v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: generated/csolution-rpc.*
tag: ${{ github.ref }}
overwrite: true
file_glob: true