Skip to content

Commit 67e5e95

Browse files
committedJun 2, 2022
build: automate triggering kit builds on github actions
1 parent 82169a6 commit 67e5e95

File tree

3 files changed

+34
-3
lines changed

3 files changed

+34
-3
lines changed
 

‎Makefile

+4-1
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ sample_html_beta: _sample_cog_html ## Generate sample HTML report for a beta rel
131131

132132
##@ Kitting: making releases
133133

134-
.PHONY: kit kit_upload test_upload kit_local download_kits check_kits tag
134+
.PHONY: kit kit_upload test_upload kit_local build_kits download_kits check_kits tag
135135
.PHONY: update_stable comment_on_fixes
136136

137137
kit: ## Make the source distribution.
@@ -152,6 +152,9 @@ kit_local:
152152
# don't go crazy trying to figure out why our new code isn't installing.
153153
find ~/Library/Caches/pip/wheels -name 'coverage-*' -delete
154154

155+
build_kits: ## Trigger GitHub to build kits
156+
python ci/trigger_build_kits.py nedbat/coveragepy
157+
155158
download_kits: ## Download the built kits from GitHub.
156159
python ci/download_gha_artifacts.py nedbat/coveragepy
157160

‎ci/trigger_build_kits.py

+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
# Licensed under the Apache License: http://www.apache.org/licenses/LICENSE-2.0
2+
# For details: https://github.com/nedbat/coveragepy/blob/master/NOTICE.txt
3+
4+
"""Trigger the GitHub action to build our kits."""
5+
6+
import sys
7+
8+
import requests
9+
10+
repo_owner = sys.argv[1]
11+
12+
# The GitHub URL makes no mention of which workflow to use. It's found based on
13+
# the event_type, which matches the types in the workflow:
14+
#
15+
# on:
16+
# repository_dispatch:
17+
# types:
18+
# - build-kits
19+
#
20+
21+
resp = requests.post(
22+
f"https://api.github.com/repos/{repo_owner}/dispatches",
23+
json={"event_type": "build-kits"},
24+
)
25+
print(f"Status: {resp.status_code}")
26+
print(resp.text)

‎howto.txt

+4-2
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,10 @@
4040
- ELSE:
4141
$ make publish
4242
- Kits:
43-
- Manually trigger the kit GitHub Action
44-
- https://github.com/nedbat/coveragepy/actions/workflows/kit.yml
43+
- Trigger the kit GitHub Action
44+
$ make build_kits
45+
- wait for it to finish:
46+
- https://github.com/nedbat/coveragepy/actions/workflows/kit.yml
4547
- Download and check built kits from GitHub Actions:
4648
$ make clean download_kits check_kits
4749
- examine the dist directory, and remove anything that looks malformed.

0 commit comments

Comments
 (0)
Please sign in to comment.