Skip to content

Commit 71678b0

Browse files
itamaroclaude
andcommitted
Update the workflows for gather and test without strategies
Run `test`, `test --no-install` and, on Linux, `test --relative-rpath`, with a summary table for each. The Build artifacts workflow uploaded trees patched for the runner's paths, which were no use anywhere else. Upload one tarball per platform instead, with the gathered tree and `install.py`. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
1 parent 2943c69 commit 71678b0

2 files changed

Lines changed: 31 additions & 23 deletions

File tree

‎.github/workflows/reusable-build.yml‎

Lines changed: 24 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -80,14 +80,20 @@ jobs:
8080
working-directory: cpython
8181
run: python ../prebuilt-cpython/relocatable.py make
8282

83-
- name: Test (patch)
83+
- name: Test
8484
working-directory: cpython
8585
continue-on-error: true
86-
run: python ../prebuilt-cpython/relocatable.py test --strategy patch --format json > ../results-patch.json
87-
- name: Test (origin)
86+
run: python ../prebuilt-cpython/relocatable.py test --format json > ../results.json
87+
# `--relative-rpath` only changes ELF files.
88+
- name: Test (--relative-rpath)
89+
if: runner.os == 'Linux'
90+
working-directory: cpython
91+
continue-on-error: true
92+
run: python ../prebuilt-cpython/relocatable.py test --relative-rpath --format json > ../results-relative-rpath.json
93+
- name: Test (--no-install)
8894
working-directory: cpython
8995
continue-on-error: true
90-
run: python ../prebuilt-cpython/relocatable.py test --strategy origin --format json > ../results-origin.json
96+
run: python ../prebuilt-cpython/relocatable.py test --no-install --format json > ../results-no-install.json
9197

9298
- name: Summarize
9399
shell: python
@@ -97,11 +103,14 @@ jobs:
97103
colours = {"PASS": "🟢", "FAIL": "🔴", "SKIP": "🟡"}
98104
99105
lines = []
100-
for strategy in ("patch", "origin"):
106+
tables = {"test": "results.json", "test --no-install": "results-no-install.json"}
107+
if os.environ["RUNNER_OS"] == "Linux":
108+
tables["test --relative-rpath"] = "results-relative-rpath.json"
109+
for command, filename in tables.items():
101110
# Fails the job if the harness crashed instead of reporting.
102-
with open(f"results-{strategy}.json") as file:
111+
with open(filename) as file:
103112
results = json.load(file)
104-
lines += [f"### `--strategy {strategy}`", "", "| Check | Status | Summary |", "|---|---|---|"]
113+
lines += [f"### `{command}`", "", "| Check | Status | Summary |", "|---|---|---|"]
105114
lines += [f"| `{r['name']}` | {colours[r['status']]}&nbsp;{r['status']} | {r['summary']} |" for r in results]
106115
lines.append("")
107116
with open(os.environ["GITHUB_STEP_SUMMARY"], "a") as summary:
@@ -110,31 +119,23 @@ jobs:
110119
if: ${{ !cancelled() }}
111120
with:
112121
name: relocatability-${{ matrix.os }}
113-
path: results-*.json
122+
path: results*.json
114123
if-no-files-found: ignore
115124

116-
# `gather --origin` is Linux only. The tarballs keep the symlinks and
117-
# file modes that the artifact zip drops.
125+
# install.py goes with the tree. The tarball keeps the symlinks and file
126+
# modes that the artifact zip drops.
118127
- name: Gather
119128
if: inputs.artifacts
120129
working-directory: cpython
121130
env:
122131
NAME: ${{ steps.commit.outputs.name }}
123-
STRATEGIES: ${{ runner.os == 'Linux' && 'patch origin' || 'patch' }}
124132
run: |
125-
for strategy in $STRATEGIES; do
126-
python ../prebuilt-cpython/relocatable.py gather --output "$GITHUB_WORKSPACE/python" "--$strategy"
127-
tar -C "$GITHUB_WORKSPACE" -czf "$GITHUB_WORKSPACE/$NAME-$strategy.tar.gz" python
128-
done
133+
python ../prebuilt-cpython/relocatable.py gather --output "$GITHUB_WORKSPACE/$NAME/python"
134+
cp ../prebuilt-cpython/install.py "$GITHUB_WORKSPACE/$NAME/"
135+
tar -C "$GITHUB_WORKSPACE" -czf "$GITHUB_WORKSPACE/$NAME.tar.gz" "$NAME"
129136
- uses: actions/upload-artifact@v7
130137
if: inputs.artifacts
131138
with:
132-
name: ${{ steps.commit.outputs.name }}-patch
133-
path: ${{ steps.commit.outputs.name }}-patch.tar.gz
134-
if-no-files-found: error
135-
- uses: actions/upload-artifact@v7
136-
if: inputs.artifacts && runner.os == 'Linux'
137-
with:
138-
name: ${{ steps.commit.outputs.name }}-origin
139-
path: ${{ steps.commit.outputs.name }}-origin.tar.gz
139+
name: ${{ steps.commit.outputs.name }}
140+
path: ${{ steps.commit.outputs.name }}.tar.gz
140141
if-no-files-found: error

‎README.md‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,13 @@ Use `--relative-rpath` to gather with `--relative-rpath`, `--no-install` to chec
8383

8484
The Relocatability GitHub Actions workflow runs `test` in each of those modes against CPython `main` on Linux and macOS, daily and for each pull request. Each run's summary lists the results, and the JSON is attached to the run.
8585

86+
The Build artifacts workflow is run by hand and also attaches the build to the run: a tarball per platform with the gathered tree in `python/` and `install.py` next to it. To try one, unpack it, move `python/` to where it should live, and run `install.py` on it:
87+
88+
```shell
89+
tar -xf cpython-<commit>-<os>-<arch>.tar.gz
90+
python3 cpython-<commit>-<os>-<arch>/install.py cpython-<commit>-<os>-<arch>/python
91+
```
92+
8693
If the build wasn't configured by `relocatable.py configure`, `install.py` isn't run, and its `--prefix` is treated as the old location. If that directory still exists, the `distribution.isolation` check fails, because the moved build might be using files from it without anyone noticing.
8794

8895
## Project Representatives

0 commit comments

Comments
 (0)