43
43
run : |
44
44
asdf plugin add python
45
45
asdf install
46
+ ls -la
46
47
47
48
- name : Setup uv
48
49
run : |
53
54
uses : actions/cache@v4
54
55
with :
55
56
path : |
57
+ .asdf
56
58
~/.cache/pip
57
59
~/.cache/uv
58
60
~/.cargo
81
83
uses : actions/cache@v4
82
84
with :
83
85
path : |
86
+ .asdf
84
87
~/.cache/pip
85
88
~/.cache/uv
86
89
~/.cargo
@@ -106,7 +109,7 @@ jobs:
106
109
uv run ruff format --check .
107
110
108
111
# ユニットテストジョブ
109
- test :
112
+ unittest :
110
113
name : Unit Tests
111
114
runs-on : ubuntu-latest
112
115
needs : prepare
@@ -123,6 +126,7 @@ jobs:
123
126
uses : actions/cache@v4
124
127
with :
125
128
path : |
129
+ .asdf
126
130
~/.cache/pip
127
131
~/.cache/uv
128
132
~/.cargo
@@ -146,15 +150,8 @@ jobs:
146
150
run : |
147
151
uv run pytest modules/api/tests/ -v --cov=modules/api --cov-report=xml
148
152
149
- - name : Upload coverage reports
150
- uses : codecov/codecov-action@v5
151
- with :
152
- file : ./coverage.xml
153
- flags : unittests
154
- name : codecov-umbrella
155
-
156
153
# SCAチェックジョブ(Trivy)
157
- sca :
154
+ sca_trivy :
158
155
name : SCA (Trivy)
159
156
runs-on : ubuntu-latest
160
157
needs : prepare
@@ -169,9 +166,9 @@ jobs:
169
166
scan-ref : " ."
170
167
trivy-config : trivy-config.yaml
171
168
172
- # SASTチェックジョブ(CodeQL + CodeGuru Security)
173
- sast :
174
- name : SAST (CodeQL + CodeGuru)
169
+ # SASTチェックジョブ(CodeGuru Security)
170
+ sast_code_guru :
171
+ name : SAST (CodeGuru)
175
172
runs-on : ubuntu-latest
176
173
needs : prepare
177
174
environment : production
@@ -183,36 +180,17 @@ jobs:
183
180
- name : Checkout code
184
181
uses : actions/checkout@v5
185
182
186
- - name : Initialize CodeQL
187
- uses : github/codeql-action/init@v3
188
- with :
189
- languages : python
190
-
191
183
- name : Restore cache
192
184
uses : actions/cache@v4
193
185
with :
194
186
path : |
187
+ .asdf
195
188
~/.cache/pip
196
189
~/.cache/uv
197
190
~/.cargo
198
191
~/.local/bin
199
192
key : ${{ needs.prepare.outputs.cache-key }}
200
193
201
- - name : Setup asdf
202
- uses : asdf-vm/actions/setup@v4
203
-
204
- - name : Install tools via asdf
205
- run : |
206
- asdf plugin add python
207
-
208
- - name : Setup uv
209
- run : |
210
- curl -LsSf https://astral.sh/uv/install.sh | sh
211
- echo "$HOME/.cargo/bin" >> $GITHUB_PATH
212
-
213
- - name : Perform CodeQL Analysis
214
- uses : github/codeql-action/analyze@v3
215
-
216
194
- name : Configure AWS credentials via OIDC
217
195
# GitHub OIDCを使ってIAMロールを引き受ける
218
196
uses : aws-actions/configure-aws-credentials@v4
@@ -224,8 +202,8 @@ jobs:
224
202
run : |
225
203
SCAN_NAME="${{ env.CICD_TOOL }}-${{ env.STAGE_NAME }}-sast-$(date +%s)"
226
204
echo "Running CodeGuru Security SAST scan: $SCAN_NAME"
227
- zip -r /tmp/source-code.zip . -x "*.git*" "node_modules/*" "* .pyc" "__pycache__/*" ".venv/*"
228
- bash ./cicd/scripts/run_codeguru_security .sh $SCAN_NAME /tmp/source-code.zip ${{ env.AWS_REGION }}
205
+ zip -r /tmp/source-code.zip . -x "*.git*" "* .pyc" "__pycache__/*" ".venv/*" ".asdf /*"
206
+ bash ./cicd/scripts/codeguru .sh $SCAN_NAME /tmp/source-code.zip ${{ env.AWS_REGION }}
229
207
230
208
# 脆弱性チェック
231
209
if [ -f "$SCAN_NAME.json" ]; then
@@ -241,11 +219,32 @@ jobs:
241
219
fi
242
220
fi
243
221
222
+ sast_codeql :
223
+ name : SAST (CodeQL)
224
+ runs-on : ubuntu-latest
225
+ needs : prepare
226
+ environment : production
227
+ permissions :
228
+ id-token : write
229
+ contents : read
230
+ security-events : write
231
+ steps :
232
+ - name : Checkout code
233
+ uses : actions/checkout@v5
234
+
235
+ - name : Initialize CodeQL
236
+ uses : github/codeql-action/init@v3
237
+ with :
238
+ languages : python
239
+
240
+ - name : Perform CodeQL Analysis
241
+ uses : github/codeql-action/analyze@v3
242
+
244
243
# AWS Lambdaデプロイジョブ
245
244
deploy_lambda :
246
245
name : Deploy to AWS Lambda
247
246
runs-on : ubuntu-latest
248
- needs : [lint, test, sca, sast ]
247
+ needs : [lint, unittest, sca_trivy, sast_code_guru, sast_codeql ]
249
248
environment : production
250
249
permissions :
251
250
id-token : write
@@ -293,7 +292,7 @@ jobs:
293
292
deploy_ec2 :
294
293
name : Deploy to EC2 (Blue/Green)
295
294
runs-on : ubuntu-latest
296
- needs : [lint, test, sca, sast ]
295
+ needs : [lint, unittest, sca_trivy, sast_code_guru, sast_codeql ]
297
296
environment : production
298
297
permissions :
299
298
id-token : write
@@ -314,7 +313,7 @@ jobs:
314
313
- name : Create deployment package
315
314
run : |
316
315
zip -r deployment-package.zip . \
317
- -x "*.git*" "node_modules/*" "* .pyc" "__pycache__/*" ".venv/*" \
316
+ -x "*.git*" "* .pyc" "__pycache__/*" ".venv/*" ".asdf /*" \
318
317
"cdk.out/*" "*.zip"
319
318
320
319
- name : Upload to S3
0 commit comments