summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNed Batchelder <ned@nedbatchelder.com>2022-06-02 08:37:49 -0400
committerNed Batchelder <ned@nedbatchelder.com>2022-06-02 08:37:49 -0400
commit67e5e95c133cf970c0706d2084f7e1c65d1c1b3a (patch)
tree085f6ce1e651ca1517abb1234bfb69ead46383f0
parent82169a624678223742d303d3ae520ed08f2e8b72 (diff)
downloadpython-coveragepy-git-67e5e95c133cf970c0706d2084f7e1c65d1c1b3a.tar.gz
build: automate triggering kit builds on github actions
-rw-r--r--Makefile5
-rw-r--r--ci/trigger_build_kits.py26
-rw-r--r--howto.txt6
3 files changed, 34 insertions, 3 deletions
diff --git a/Makefile b/Makefile
index b5fb1063..f2c67095 100644
--- a/Makefile
+++ b/Makefile
@@ -131,7 +131,7 @@ sample_html_beta: _sample_cog_html ## Generate sample HTML report for a beta rel
##@ Kitting: making releases
-.PHONY: kit kit_upload test_upload kit_local download_kits check_kits tag
+.PHONY: kit kit_upload test_upload kit_local build_kits download_kits check_kits tag
.PHONY: update_stable comment_on_fixes
kit: ## Make the source distribution.
@@ -152,6 +152,9 @@ kit_local:
# don't go crazy trying to figure out why our new code isn't installing.
find ~/Library/Caches/pip/wheels -name 'coverage-*' -delete
+build_kits: ## Trigger GitHub to build kits
+ python ci/trigger_build_kits.py nedbat/coveragepy
+
download_kits: ## Download the built kits from GitHub.
python ci/download_gha_artifacts.py nedbat/coveragepy
diff --git a/ci/trigger_build_kits.py b/ci/trigger_build_kits.py
new file mode 100644
index 00000000..0485df10
--- /dev/null
+++ b/ci/trigger_build_kits.py
@@ -0,0 +1,26 @@
+# Licensed under the Apache License: http://www.apache.org/licenses/LICENSE-2.0
+# For details: https://github.com/nedbat/coveragepy/blob/master/NOTICE.txt
+
+"""Trigger the GitHub action to build our kits."""
+
+import sys
+
+import requests
+
+repo_owner = sys.argv[1]
+
+# The GitHub URL makes no mention of which workflow to use. It's found based on
+# the event_type, which matches the types in the workflow:
+#
+# on:
+# repository_dispatch:
+# types:
+# - build-kits
+#
+
+resp = requests.post(
+ f"https://api.github.com/repos/{repo_owner}/dispatches",
+ json={"event_type": "build-kits"},
+)
+print(f"Status: {resp.status_code}")
+print(resp.text)
diff --git a/howto.txt b/howto.txt
index 94eb6c05..47da48ba 100644
--- a/howto.txt
+++ b/howto.txt
@@ -40,8 +40,10 @@
- ELSE:
$ make publish
- Kits:
- - Manually trigger the kit GitHub Action
- - https://github.com/nedbat/coveragepy/actions/workflows/kit.yml
+ - Trigger the kit GitHub Action
+ $ make build_kits
+ - wait for it to finish:
+ - https://github.com/nedbat/coveragepy/actions/workflows/kit.yml
- Download and check built kits from GitHub Actions:
$ make clean download_kits check_kits
- examine the dist directory, and remove anything that looks malformed.