-
Notifications
You must be signed in to change notification settings - Fork 59
171 lines (158 loc) · 5.64 KB
/
validate-release.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
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
name: Validate release
on:
pull_request:
branches:
- "rc/**"
permissions:
contents: read
actions: write
checks: write
env:
HEAD_SHA: ${{ github.event.pull_request.head.sha }}
jobs:
pre-validate-performance:
outputs:
check-run-id: ${{ steps.create-check-run.outputs.check-run-id }}
runs-on: ubuntu-22.04
steps:
- name: Create check run
id: create-check-run
env:
GITHUB_TOKEN: ${{ github.token }}
run: |
check_run_id=$(gh api \
--header "Accept: application/vnd.github+json" \
--header "X-GitHub-Api-Version: 2022-11-28" \
--field name="performance-test" \
--field head_sha="$HEAD_SHA" \
--jq ".id" \
/repos/$GITHUB_REPOSITORY/check-runs)
echo "check-run-id=$check_run_id" >> "$GITHUB_OUTPUT"
validate-performance:
needs: pre-validate-performance
runs-on: ubuntu-22.04
steps:
- name: Generate token
id: generate-token
uses: actions/create-github-app-token@v1
with:
app-id: ${{ vars.AUTOMATION_APP_ID }}
private-key: ${{ secrets.AUTOMATION_PRIVATE_KEY }}
owner: ${{ github.repository_owner }}
repositories: "codeql-coding-standards-release-engineering"
- name: Invoke performance test
env:
CHECK_RUN_ID: ${{ needs.pre-validate-performance.outputs.check-run-id }}
GH_TOKEN: ${{ steps.generate-token.outputs.token }}
run: |
jq -n \
--arg ref "$HEAD_SHA" \
--arg check_run_id "$CHECK_RUN_ID" \
'{ref: $ref, "check-run-id": $check_run_id}' \
| \
gh workflow run release-performance-testing.yml \
--json \
-R github/codeql-coding-standards-release-engineering
on-failure-validate-performance-dispatch:
needs: [pre-validate-performance, validate-performance]
if: failure()
runs-on: ubuntu-22.04
steps:
- name: Fail check run status
env:
CHECK_RUN_ID: ${{ needs.pre-validate-performance.outputs.check-run-id }}
GITHUB_TOKEN: ${{ github.token }}
run: |
jq -n \
--arg status "completed" \
--arg conclusion "failure" \
'{status: $status, conclusion: $conclusion}' \
| \
gh api \
--method PATCH \
--header "Accept: application/vnd.github+json" \
--header "X-GitHub-Api-Version: 2022-11-28" \
--input - \
/repos/$GITHUB_REPOSITORY/check-runs/$CHECK_RUN_ID
pre-validate-compiler-compatibility:
outputs:
check-run-id: ${{ steps.create-check-run.outputs.check-run-id }}
runs-on: ubuntu-22.04
steps:
- name: Create check run
id: create-check-run
env:
GITHUB_TOKEN: ${{ github.token }}
run: |
check_run_id=$(gh api \
--header "Accept: application/vnd.github+json" \
--header "X-GitHub-Api-Version: 2022-11-28" \
--field name="compiler-compatibility-test" \
--field head_sha="$HEAD_SHA" \
--jq ".id" \
/repos/$GITHUB_REPOSITORY/check-runs)
echo "check-run-id=$check_run_id" >> "$GITHUB_OUTPUT"
validate-compiler-compatibility:
needs: pre-validate-compiler-compatibility
runs-on: ubuntu-22.04
steps:
- name: Generate token
id: generate-token
uses: actions/create-github-app-token@v1
with:
app-id: ${{ vars.AUTOMATION_APP_ID }}
private-key: ${{ secrets.AUTOMATION_PRIVATE_KEY }}
owner: ${{ github.repository_owner }}
repositories: "codeql-coding-standards-release-engineering"
- name: Invoke compiler compatibility test
env:
CHECK_RUN_ID: ${{ needs.pre-validate-compiler-compatibility.outputs.check-run-id }}
GITHUB_TOKEN: ${{ steps.generate-token.outputs.token }}
run: |
jq -n \
--arg ref "$HEAD_SHA" \
--arg check_run_id "$CHECK_RUN_ID" \
'{ref: $ref, "check-run-id": $check_run_id}' \
| \
gh workflow run release-compiler-validation.yml \
--json \
-R github/codeql-coding-standards-release-engineering
on-failure-validate-compiler-compatibility-dispatch:
needs:
[pre-validate-compiler-compatibility, validate-compiler-compatibility]
if: failure()
runs-on: ubuntu-22.04
steps:
- name: Fail check run status
env:
CHECK_RUN_ID: ${{ needs.pre-validate-compiler-compatibility.outputs.check-run-id }}
GITHUB_TOKEN: ${{ github.token }}
run: |
jq -n \
--arg status "completed" \
--arg conclusion "failure" \
'{status: $status, conclusion: $conclusion}' \
| \
gh api \
--method PATCH \
--header "Accept: application/vnd.github+json" \
--header "X-GitHub-Api-Version: 2022-11-28" \
--input - \
/repos/$GITHUB_REPOSITORY/check-runs/$CHECK_RUN_ID
create-release-status-check-run:
name: "Initialize release status monitoring"
runs-on: ubuntu-22.04
steps:
- name: Create release status check run
env:
GITHUB_TOKEN: ${{ github.token }}
run: |
CHECK_RUN_ID=$(gh api \
--header "Accept: application/vnd.github+json" \
--header "X-GitHub-Api-Version: 2022-11-28" \
--field name="release-status" \
--field head_sha="$HEAD_SHA" \
--field status="in_progress" \
--jq ".id" \
/repos/$GITHUB_REPOSITORY/check-runs)
echo "Created release status check run with id $CHECK_RUN_ID for $GITHUB_SHA"