Repository navigation
Run the relocatability checks in GitHub Actions #41
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,104 @@ | ||||||||||
| name: Relocatability | ||||||||||
|
|
||||||||||
| # Build CPython main and run `relocatable.py test` against it. Some checks | ||||||||||
| # fail until CPython is fixed, so failed checks don't fail the job; the | ||||||||||
| # results are in the job summary and the uploaded JSON. The job only fails | ||||||||||
| # if the build or the harness itself breaks. | ||||||||||
|
|
||||||||||
| on: | ||||||||||
| push: | ||||||||||
| branches: [main] | ||||||||||
| pull_request: | ||||||||||
| schedule: | ||||||||||
| # Daily, to track changes in CPython main. | ||||||||||
| - cron: "17 6 * * *" | ||||||||||
| workflow_dispatch: | ||||||||||
|
|
||||||||||
| permissions: | ||||||||||
| contents: read | ||||||||||
|
|
||||||||||
| concurrency: | ||||||||||
| group: ${{ github.workflow }}-${{ github.ref }} | ||||||||||
| cancel-in-progress: true | ||||||||||
|
|
||||||||||
| jobs: | ||||||||||
| test: | ||||||||||
| name: ${{ matrix.os }} | ||||||||||
| # Forks get the schedule too; only run it here. | ||||||||||
| if: github.event_name != 'schedule' || github.repository == 'python/prebuilt-cpython' | ||||||||||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same thing without hardcoding repo name, easier to copy to other repos:
Suggested change
|
||||||||||
| runs-on: ${{ matrix.os }} | ||||||||||
| timeout-minutes: 60 | ||||||||||
| strategy: | ||||||||||
| fail-fast: false | ||||||||||
| matrix: | ||||||||||
| os: [ubuntu-latest, macos-latest] | ||||||||||
| steps: | ||||||||||
| - uses: actions/checkout@v5 | ||||||||||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||
| with: | ||||||||||
| path: prebuilt-cpython | ||||||||||
| persist-credentials: false | ||||||||||
| - uses: actions/checkout@v5 | ||||||||||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||
| with: | ||||||||||
| repository: python/cpython | ||||||||||
| path: cpython | ||||||||||
| persist-credentials: false | ||||||||||
| - uses: actions/setup-python@v6 | ||||||||||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||
| with: | ||||||||||
| python-version: "3.14" | ||||||||||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do we specifically need 3.14, or can we use 3.15?
Suggested change
Or whatever the latest stable is?
Suggested change
|
||||||||||
|
|
||||||||||
| - name: Install build dependencies (Linux) | ||||||||||
| if: runner.os == 'Linux' | ||||||||||
| run: | | ||||||||||
| sudo apt-get update | ||||||||||
| sudo apt-get install -y build-essential pkg-config patchelf \ | ||||||||||
| libbz2-dev libffi-dev libgdbm-dev liblzma-dev libncurses-dev \ | ||||||||||
| libreadline-dev libsqlite3-dev libssl-dev libzstd-dev uuid-dev \ | ||||||||||
| zlib1g-dev | ||||||||||
| - name: Install build tools (macOS) | ||||||||||
| if: runner.os == 'macOS' | ||||||||||
| run: brew install pkg-config | ||||||||||
| - name: Build dependencies (macOS) | ||||||||||
| if: runner.os == 'macOS' | ||||||||||
| working-directory: cpython | ||||||||||
| run: python ../prebuilt-cpython/relocatable.py deps | ||||||||||
|
|
||||||||||
| - name: Record the CPython commit | ||||||||||
| working-directory: cpython | ||||||||||
| run: git log -1 --format='CPython main at %h (%cs)' | tee -a "$GITHUB_STEP_SUMMARY" | ||||||||||
| - name: Configure | ||||||||||
| working-directory: cpython | ||||||||||
| run: python ../prebuilt-cpython/relocatable.py configure ${{ runner.os == 'macOS' && '--deps-dir deps' || '' }} | ||||||||||
| - name: Build | ||||||||||
| working-directory: cpython | ||||||||||
| run: python ../prebuilt-cpython/relocatable.py make | ||||||||||
|
|
||||||||||
| - name: Test (patch) | ||||||||||
| working-directory: cpython | ||||||||||
| continue-on-error: true | ||||||||||
| run: python ../prebuilt-cpython/relocatable.py test --strategy patch --format json > ../results-patch.json | ||||||||||
| - name: Test (origin) | ||||||||||
| working-directory: cpython | ||||||||||
| continue-on-error: true | ||||||||||
| run: python ../prebuilt-cpython/relocatable.py test --strategy origin --format json > ../results-origin.json | ||||||||||
|
|
||||||||||
| - name: Summarize | ||||||||||
| shell: python | ||||||||||
| run: | | ||||||||||
| import json, os | ||||||||||
|
|
||||||||||
| lines = [] | ||||||||||
| for strategy in ("patch", "origin"): | ||||||||||
| # Fails the job if the harness crashed instead of reporting. | ||||||||||
| with open(f"results-{strategy}.json") as file: | ||||||||||
| results = json.load(file) | ||||||||||
| lines += [f"### `--strategy {strategy}`", "", "| Check | Status | Summary |", "|---|---|---|"] | ||||||||||
| lines += [f"| `{r['name']}` | {r['status']} | {r['summary']} |" for r in results] | ||||||||||
| lines.append("") | ||||||||||
| with open(os.environ["GITHUB_STEP_SUMMARY"], "a") as summary: | ||||||||||
| summary.write("\n".join(lines) + "\n") | ||||||||||
| - uses: actions/upload-artifact@v4 | ||||||||||
| if: ${{ !cancelled() }} | ||||||||||
| with: | ||||||||||
| name: relocatability-${{ matrix.os }} | ||||||||||
| path: results-*.json | ||||||||||
| if-no-files-found: ignore | ||||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Allow forks to run CI on feature branches, so we can check results on our fork CI before opening a PR.