Skip to content
Bitcoin Roots

v30.3-roots.1 · Commit 63: [PATCH 63/68] fix(release): restore signed five-platform CI releases

ci/test/test_prepare_release.py

Before: ci/test/test_prepare_release.py · After: ci/test/test_prepare_release.py

File metadata
index 7e75c554da77596fffbeb962346d367b25860858..5291ba5e9172891476f960294528c670a765daf6 100755

Download original patch · Release notes

Diff rows 1–47 of 47. Line numbers refer to the original before/after files.

+ Added− RemovedUnmarked lines are context.

Scroll the code area horizontally to read long lines. Before is on the left; after is on the right. Unified view fits narrow screens more easily.

ci/test/test_prepare_release.py CHANGED
@@ -6,6 +6,7 @@
6
  import hashlib
7
  import io
8
  import os
 
9
  from pathlib import Path
10
  import subprocess
11
  import tarfile
@@ -119,7 +120,7 @@ class PrepareReleaseTest(unittest.TestCase):
119
  subprocess.run(["python3", ARCHIVE_TOOL, "validate", archive, root.name,
120
  "--copying", ROOT / "COPYING"], check=True)
121
 
122
- def test_actual_unix_workflow_intermediate_repacks_and_prepares(self):
123
  lines = (ROOT / ".github/workflows/release.yml").read_text().splitlines()
124
  def packaging_block(name):
125
  start = lines.index(f" - name: {name}")
@@ -137,7 +138,7 @@ class PrepareReleaseTest(unittest.TestCase):
137
  out = work / "out"
138
  out.mkdir()
139
  environment = {**os.environ, "RUNNER_TEMP": str(work / "runner"),
140
- "BASE_OUTDIR": str(out), "ARTIFACT_NAME": f"bitcoin-roots-{platform}",
141
  "RELEASE_TAG": "v30.3-roots.1", "GITHUB_WORKSPACE": str(work)}
142
  if platform.startswith("linux"):
143
  (out / "payload").write_bytes(b"binary fixture")
@@ -148,6 +149,8 @@ class PrepareReleaseTest(unittest.TestCase):
148
  with zipfile.ZipFile(deploy / "Bitcoin-Roots.zip", mode="w") as package:
149
  package.writestr("Bitcoin-Qt.app/Contents/MacOS/Bitcoin-Qt", b"binary fixture")
150
  block = packaging_block("Stage release package")
 
 
151
  subprocess.run(["bash", "-c", block], cwd=ROOT, env=environment, check=True)
152
  archive = next((work / "runner/release-packages").iterdir())
153
  member = "bitcoin-roots-30.3-roots.1/COPYING"
@@ -160,13 +163,12 @@ class PrepareReleaseTest(unittest.TestCase):
160
  notice = package.read(member)
161
  self.assertEqual(package.read("bitcoin-roots-30.3-roots.1/Bitcoin-Qt.app/Contents/MacOS/Bitcoin-Qt"), b"binary fixture")
162
  self.assertEqual(notice, (ROOT / "COPYING").read_bytes())
163
- descriptor = notice_fixtures.ReleaseNoticesTest().descriptor(work, platform)
164
- notice_fixtures.NOTICES.collect(platform, descriptor, work / "notice-inputs")
165
  downloads = work / "assembled-downloads"
166
  downloads.mkdir()
167
  assembled = downloads / archive.name
168
- subprocess.run(["python3", notice_fixtures.REPACK_TOOL, archive, assembled,
169
- "bitcoin-roots-30.3-roots.1", work / "notice-inputs/index.json", platform], check=True)
170
  (downloads / "series.patch").write_text("patch\n")
171
  subprocess.run([SCRIPT, downloads, work / "release-assets", PUBLIC_KEY,
172
  "v30.3-roots.1", "1"], check=True)
 
6
  import hashlib
7
  import io
8
  import os
9
+ import shutil
10
  from pathlib import Path
11
  import subprocess
12
  import tarfile
 
120
  subprocess.run(["python3", ARCHIVE_TOOL, "validate", archive, root.name,
121
  "--copying", ROOT / "COPYING"], check=True)
122
 
123
+ def test_actual_unix_workflow_stages_notices_and_prepares(self):
124
  lines = (ROOT / ".github/workflows/release.yml").read_text().splitlines()
125
  def packaging_block(name):
126
  start = lines.index(f" - name: {name}")
 
138
  out = work / "out"
139
  out.mkdir()
140
  environment = {**os.environ, "RUNNER_TEMP": str(work / "runner"),
141
+ "BASE_OUTDIR": str(out), "BASE_BUILD_DIR": str(work / "runner"), "ARTIFACT_NAME": f"bitcoin-roots-{platform}",
142
  "RELEASE_TAG": "v30.3-roots.1", "GITHUB_WORKSPACE": str(work)}
143
  if platform.startswith("linux"):
144
  (out / "payload").write_bytes(b"binary fixture")
 
149
  with zipfile.ZipFile(deploy / "Bitcoin-Roots.zip", mode="w") as package:
150
  package.writestr("Bitcoin-Qt.app/Contents/MacOS/Bitcoin-Qt", b"binary fixture")
151
  block = packaging_block("Stage release package")
152
+ descriptor = notice_fixtures.ReleaseNoticesTest().descriptor(work, platform)
153
+ notice_fixtures.NOTICES.collect(platform, descriptor, work / "runner/release-notices/notices")
154
  subprocess.run(["bash", "-c", block], cwd=ROOT, env=environment, check=True)
155
  archive = next((work / "runner/release-packages").iterdir())
156
  member = "bitcoin-roots-30.3-roots.1/COPYING"
 
163
  notice = package.read(member)
164
  self.assertEqual(package.read("bitcoin-roots-30.3-roots.1/Bitcoin-Qt.app/Contents/MacOS/Bitcoin-Qt"), b"binary fixture")
165
  self.assertEqual(notice, (ROOT / "COPYING").read_bytes())
166
+ subprocess.run(["python3", ROOT / "ci/release/notices.py", "validate", archive,
167
+ "bitcoin-roots-30.3-roots.1", platform], check=True)
168
  downloads = work / "assembled-downloads"
169
  downloads.mkdir()
170
  assembled = downloads / archive.name
171
+ shutil.copyfile(archive, assembled)
 
172
  (downloads / "series.patch").write_text("patch\n")
173
  subprocess.run([SCRIPT, downloads, work / "release-assets", PUBLIC_KEY,
174
  "v30.3-roots.1", "1"], check=True)