-
Notifications
You must be signed in to change notification settings - Fork 72
194 lines (186 loc) · 7.08 KB
/
Copy pathon_push_ts.yaml
File metadata and controls
194 lines (186 loc) · 7.08 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
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
name: Check Typescript Code
run-name: On Push TS check - ${{ github.ref_name }} by ${{ github.actor }}
on:
push:
workflow_call:
inputs:
working-directory:
description: 'Working directory to run tests in'
required: false
type: string
default: '.'
use-artifact:
description: 'Name of artifact to download and use as working directory'
required: false
type: string
default: ''
permissions:
contents: read
env:
WORKING_DIR: ${{ inputs.use-artifact != '' && format('{0}/oss-content', inputs.working-directory || '.') || (inputs.working-directory || '.') }}
jobs:
check-typescript-project:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Download artifact
if: inputs.use-artifact != ''
uses: actions/download-artifact@v4
with:
name: ${{ inputs.use-artifact }}
path: ${{ inputs.working-directory }}/oss-content
- name: Check if TypeScript project exists
id: check-ts
working-directory: ${{ env.WORKING_DIR }}
run: |
if [ -d "are/simulation/gui/client" ] && [ -f "are/simulation/gui/client/package.json" ]; then
echo "exists=true" >> $GITHUB_OUTPUT
echo "TypeScript project found at are/simulation/gui/client"
else
echo "exists=false" >> $GITHUB_OUTPUT
echo "No TypeScript project found at are/simulation/gui/client"
fi
outputs:
typescript-exists: ${{ steps.check-ts.outputs.exists }}
typescript-type-checks:
runs-on: ubuntu-latest
needs: check-typescript-project
if: needs.check-typescript-project.outputs.typescript-exists == 'true'
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Download artifact
if: inputs.use-artifact != ''
uses: actions/download-artifact@v4
with:
name: ${{ inputs.use-artifact }}
path: ${{ inputs.working-directory }}/oss-content
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '23.10.0'
- name: Install npm dependencies
uses: ./.github/actions/npm-install-with-retry
with:
working-directory: ${{ env.WORKING_DIR }}/are/simulation/gui/client
- name: Run TypeScript checks
working-directory: ${{ env.WORKING_DIR }}/are/simulation/gui/client
run: npm run tsc
vitest-tests:
runs-on: ubuntu-latest
needs: check-typescript-project
if: needs.check-typescript-project.outputs.typescript-exists == 'true'
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Download artifact
if: inputs.use-artifact != ''
uses: actions/download-artifact@v4
with:
name: ${{ inputs.use-artifact }}
path: ${{ inputs.working-directory }}/oss-content
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '23.10.0'
- name: Install npm dependencies
uses: ./.github/actions/npm-install-with-retry
with:
working-directory: ${{ env.WORKING_DIR }}/are/simulation/gui/client
- name: Run vitest tests
working-directory: ${{ env.WORKING_DIR }}/are/simulation/gui/client
run: npm run test
graphql-no-uncommitted-changes:
runs-on: ubuntu-latest
needs: check-typescript-project
if: needs.check-typescript-project.outputs.typescript-exists == 'true' && inputs.use-artifact == ''
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.12"
cache: "pip"
- name: Install Python dependencies
working-directory: ${{ inputs.working-directory }}
run: pip install -r requirements.txt -r requirements-dev.txt
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '23.10.0'
- name: Install npm dependencies
uses: ./.github/actions/npm-install-with-retry
with:
working-directory: ${{ env.WORKING_DIR }}/are/simulation/gui/client
- name: Run GraphQL schema check
working-directory: ${{ env.WORKING_DIR }}/are/simulation/gui/client
run: |
npm run graphql
if git status --porcelain schema.graphql | grep -q .; then
git --no-pager diff schema.graphql
echo "Uncommitted schema changes detected in schema.graphql, please re-run 'npm run graphql' and commit all generated changes."
exit 1
else
echo "No uncommitted changes detected in schema.graphql. All good."
fi
relay-no-uncommitted-changes:
runs-on: ubuntu-latest
needs: check-typescript-project
if: needs.check-typescript-project.outputs.typescript-exists == 'true' && inputs.use-artifact == ''
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '23.10.0'
- name: Install npm dependencies
uses: ./.github/actions/npm-install-with-retry
with:
working-directory: ${{ env.WORKING_DIR }}/are/simulation/gui/client
- name: Clean up existing .graphql.ts files
working-directory: ${{ env.WORKING_DIR }}/are/simulation/gui/client
run: find . -name "*.graphql.ts" -delete
- name: Run Relay check
working-directory: ${{ env.WORKING_DIR }}/are/simulation/gui/client
run: |
npm run relay
if git status --porcelain | grep -E '\.graphql\.ts$' | grep -q .; then
git --no-pager diff
echo "Uncommitted changes detected in .graphql.ts files, please re-run 'npm run relay' and commit all generated changes."
exit 1
else
echo "No uncommitted changes detected in .graphql.ts files. All good."
fi
prettier-format-check:
runs-on: ubuntu-latest
needs: check-typescript-project
if: needs.check-typescript-project.outputs.typescript-exists == 'true' && inputs.use-artifact == ''
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '23.10.0'
- name: Install npm dependencies
uses: ./.github/actions/npm-install-with-retry
with:
working-directory: ${{ env.WORKING_DIR }}/are/simulation/gui/client
- name: Run format check
working-directory: ${{ env.WORKING_DIR }}/are/simulation/gui/client
run: |
npm run format
if git status --porcelain | grep -q .; then
echo "Files changed by formatting:"
git status --porcelain
echo ""
echo "Diff of changes:"
git --no-pager diff
echo "Formatting issues detected. Please run 'npm run format' locally and commit the changes."
exit 1
else
echo "No formatting issues detected. All files are properly formatted."
fi