Repository navigation
276 lines (247 loc) · 9.08 KB
/
Copy pathpull-request.yml
File metadata and controls
276 lines (247 loc) · 9.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
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
permissions: write-all # Equivalent to default permissions plus id-token: write
env:
ESC_ACTION_ENVIRONMENT: pulumi/github-secrets/pulumi-registry
ESC_ACTION_EXPORT_ENVIRONMENT_VARIABLES: false
name: Pull request
on:
pull_request:
branches:
- master
jobs:
sentinel:
# The name of this action cannot be "Sentinel", since this job exists to create an
# action result called "Sentinel".
name: Sentinel Tower
if: github.event.pull_request.head.repo.full_name == github.repository
permissions:
statuses: write
needs:
- resourcedocsgen
- lint-markdown
- lint-scripts
- lint-dark-logos
- test-provider-api-docs
- test-infra
- preview
- test-live-publish
- check-publish
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
- uses: guibranco/github-status-action-v2@77639353504055053524efa7a3719aaf0b731ce9 # v1.2.4
with:
authToken: ${{secrets.GITHUB_TOKEN}}
# Write an explicit status check called "Sentinel" which will only pass if this code really runs.
# This should always be a required check for PRs.
context: 'Sentinel'
description: 'All required checks passed'
state: 'success'
# Write to the PR commit SHA if it's available as we don't want the merge commit sha,
# otherwise use the current SHA for any other type of build.
sha: ${{ github.event.pull_request.head.sha || github.sha }}
check-publish:
name: Check published packages
runs-on: ubuntu-latest
timeout-minutes: 10
permissions:
contents: read
pull-requests: write
steps:
- name: Check out branch
uses: actions/checkout@v7
with:
fetch-depth: 0
- uses: actions/setup-python@v7
with:
python-version: "3.12"
- name: Install dependencies
run: pip install pyyaml
- name: Check the packages this PR publishes
id: check
run: >-
python3 scripts/ci/community-package/cli.py check-publish
--diff "origin/${{ github.base_ref }}"
--out "${{ runner.temp }}/factsheets"
- name: Post the fact-sheet
if: always() && github.event.pull_request.head.repo.full_name == github.repository
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
PR: ${{ github.event.pull_request.number }}
run: |
shopt -s nullglob
sheets=("${RUNNER_TEMP}"/factsheets/*.factsheet.md)
[ ${#sheets[@]} -eq 0 ] && exit 0
cat "${sheets[@]}" > "${RUNNER_TEMP}/comment.md"
# GitHub rejects a comment body over 65536 characters.
if [ "$(wc -c < "${RUNNER_TEMP}/comment.md")" -gt 60000 ]; then
head -c 60000 "${RUNNER_TEMP}/comment.md" > "${RUNNER_TEMP}/truncated.md"
printf '\n\n_Truncated: this PR publishes %d packages. The full fact-sheets are in the "Check published packages" job log._\n' "${#sheets[@]}" >> "${RUNNER_TEMP}/truncated.md"
mv "${RUNNER_TEMP}/truncated.md" "${RUNNER_TEMP}/comment.md"
fi
gh pr comment "$PR" --edit-last --create-if-none --body-file "${RUNNER_TEMP}/comment.md"
resourcedocsgen:
uses: ./.github/workflows/check-go.yml
with:
path: tools/resourcedocsgen/
lint-markdown:
name: Lint Markdown
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- name: Check out branch
uses: actions/checkout@v7
- name: Install Node
uses: actions/setup-node@v7
with:
node-version: "24.22.1"
cache: 'yarn'
- name: Yarn Install
uses: ./.github/actions/yarn-install
- name: Lint Markdown
run: make lint-markdown
lint-scripts:
name: Lint Scripts
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- name: Check out branch
uses: actions/checkout@v7
- name: Install Node
uses: actions/setup-node@v7
with:
node-version: "24.22.1"
cache: 'yarn'
- name: Yarn Install
uses: ./.github/actions/yarn-install
- name: Run Linter
run: yarn run lint
- name: Test preview comment
run: make test-preview-comment
- name: Test consent scripts
run: |
yarn --cwd themes/default/theme install --frozen-lockfile --network-timeout 300000
make test-theme
lint-dark-logos:
name: Lint Dark Logo Variants
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- name: Check out branch
uses: actions/checkout@v7
# The `-on-dark.svg` package marks are generated from their light siblings by
# scripts/generate-dark-logos.py, so adding or replacing a local logo leaves
# them stale unless someone remembers to re-run it. The check is deterministic
# and offline (stdlib only, no network), so it can just run here.
- name: Check dark logo variants
run: make lint-dark-logos
test-infra:
name: Test Infrastructure Functions
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- name: Check out branch
uses: actions/checkout@v7
- name: Install Node
uses: actions/setup-node@v7
with:
node-version: "24.22.1"
- name: Run tests
run: make test-infra
test-live-publish:
name: Test Live Registry Publish
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- name: Check out branch
uses: actions/checkout@v7
- name: Install uv
uses: astral-sh/setup-uv@v7
- run: uv run --with pyyaml scripts/ci/publish_to_registry.py --validate-all
test-provider-api-docs:
name: Test Provider API Docs
runs-on: ubuntu-latest
timeout-minutes: 20
steps:
- name: Check out branch
uses: actions/checkout@v7
- name: Install Node
uses: actions/setup-node@v7
with:
node-version: "24.22.1"
cache: 'yarn'
cache-dependency-path: |
yarn.lock
infrastructure/yarn.lock
themes/default/yarn.lock
themes/default/theme/yarn.lock
themes/default/theme/stencil/yarn.lock
- name: Install Go
uses: actions/setup-go@v7
with:
go-version-file: tools/resourcedocsgen/go.mod
cache-dependency-path: tools/resourcedocsgen/go.sum
- name: Install Hugo
uses: peaceiris/actions-hugo@v3
with:
hugo-version: "0.169.0"
extended: true
- name: Prepare
run: make ensure build-assets
- name: Run Provider Tests
run: make test_provider_api_docs
env:
GOPATH: ${{ github.workspace }}/go
# Preview runs a registry build into a commit specific S3 bucket to preview changes.
#
# A link to the generated build is appended to the PR on each commit.
preview:
name: Build and deploy preview
# Only run this job for events that originate on this repository and if the automation/merge label is not applied to the PR.
# PRs with the automation/tfgen-provider-docs label contain only metadata file changes and don't need a PR build.
if: github.event.pull_request.head.repo.full_name == github.repository && contains(github.event.pull_request.labels.*.name, 'automation/tfgen-provider-docs') != true
runs-on: pulumi-service-ubuntu-24.04-16core
timeout-minutes: 45
environment: testing
env:
GOPATH: ${{ github.workspace }}/go
steps:
- name: Check out branch
uses: actions/checkout@v7
with:
# Full history needed for registry-mirror-discover to find package versions
fetch-depth: 0
- uses: ./.github/actions/build-and-deploy-preview
with:
pr: ${{ github.event.pull_request.number }}
github_token: ${{ secrets.GITHUB_TOKEN }}
pulumi_stack_name: ${{ vars.PULUMI_STACK_NAME }}
algolia_app_id: ${{ vars.ALGOLIA_APP_ID }}
algolia_app_search_key: ${{ vars.ALGOLIA_APP_SEARCH_KEY }}
notify:
if: (github.event.pull_request.user.login == 'pulumi-bot') && failure()
name: Send slack notification
runs-on: ubuntu-latest
timeout-minutes: 5
needs: [preview]
steps:
- name: Authenticate to Pulumi Cloud
id: pulumi-auth
uses: pulumi/auth-actions@273044cc19e63ea565285da8edd4e059126a0bdb # v2.1.2
with:
organization: pulumi
requested-token-type: urn:pulumi:token-type:access_token:organization
export-environment-variables: false
- name: Fetch secrets from ESC
id: esc-secrets
uses: pulumi/esc-action@eec71a90d9989af7ff14bd700b83fc72fae36119 # v4.0.0
with:
pulumi-access-token: ${{ steps.pulumi-auth.outputs.pulumi-access-token }}
- name: Slack Notification
uses: docker://sholung/action-slack-notify:v2.3.0
env:
SLACK_CHANNEL: registry-ops
SLACK_COLOR: "#F54242"
SLACK_MESSAGE: "pull request build failure in pulumi/registry repo :meow_sad:"
SLACK_USERNAME: registrybot
SLACK_WEBHOOK: ${{ steps.esc-secrets.outputs.SLACK_WEBHOOK_URL }}
SLACK_ICON: https://www.pulumi.com/logos/brand/avatar-on-white.png