Skip to content

Commit 6068405

Browse files
authored
ci: Test tket2-py release PRs using released -exts and -eccs (#877)
Checks that the tests run correctly against the latets published `tket2-exts` and `tket2-eccs`. If this fails, we may need to publish a new version of those first. Passing check: https://github.com/CQCL/tket2/actions/runs/15108368429/job/42461967318
1 parent aae0558 commit 6068405

File tree

1 file changed

+78
-0
lines changed

1 file changed

+78
-0
lines changed

.github/workflows/release-checks.yml

Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
name: Release checks
2+
3+
on:
4+
pull_request:
5+
merge_group:
6+
types: [checks_requested]
7+
workflow_dispatch: {}
8+
9+
env:
10+
SCCACHE_GHA_ENABLED: "true"
11+
RUSTC_WRAPPER: "sccache"
12+
# Pinned version for the uv package manager
13+
UV_VERSION: "0.7.5"
14+
# The highest and lowest supported Python versions, used for testing
15+
PYTHON_HIGHEST: "3.13"
16+
PYTHON_LOWEST: "3.10"
17+
18+
jobs:
19+
# Check if changes were made to the relevant files.
20+
# Always returns true if running on the default branch, to ensure all changes are throughly checked.
21+
changes:
22+
name: Check for changes
23+
runs-on: ubuntu-latest
24+
# Required permissions
25+
permissions:
26+
pull-requests: read
27+
# Set job outputs to values from filter step
28+
# These outputs are always true when running after a merge to main, or if the PR has a `run-ci-checks` label.
29+
outputs:
30+
rust-release: ${{ steps.source-branch.outputs.rust == 'true' }}
31+
python-release: ${{ steps.source-branch.outputs.py == 'true' }}
32+
steps:
33+
- uses: actions/checkout@v4
34+
- name: Override label
35+
id: source-branch
36+
run: |
37+
if [ "${{ github.event_name == 'pull_request' && startsWith(github.head_ref, 'release-please-') }}" == "true" ]; then
38+
echo "This is a python release PR"
39+
echo "py=true" >> $GITHUB_OUTPUT
40+
elif [ "${{ github.event_name == 'pull_request' && startsWith(github.head_ref, 'release-plz-') }}" == "true" ]; then
41+
echo "This is a rust release PR"
42+
echo "rust=true" >> $GITHUB_OUTPUT
43+
elif [ "${{ github.event_name != 'pull_request' }}" == "true" ]; then
44+
echo "Manual trigger"
45+
echo "py=true" >> $GITHUB_OUTPUT
46+
echo "rust=true" >> $GITHUB_OUTPUT
47+
else
48+
echo "Not a release PR"
49+
fi
50+
51+
py-release:
52+
name: Check `tket2-py` release
53+
needs: changes
54+
if: ${{ needs.changes.outputs.python-release == 'true' }}
55+
runs-on: ubuntu-latest
56+
steps:
57+
- uses: actions/checkout@v4
58+
- uses: mozilla-actions/sccache-action@v0.0.9
59+
- name: Set up uv
60+
uses: astral-sh/setup-uv@v6
61+
with:
62+
version: ${{ env.UV_VERSION }}
63+
enable-cache: true
64+
- name: Install Python ${{ env.PYTHON_HIGHEST }}
65+
run: uv python install ${{ env.PYTHON_HIGHEST }}
66+
- name: Setup `tke2-py` with only pypi deps
67+
run: |
68+
uv sync --no-sources --no-install-workspace \
69+
--python ${{ env.PYTHON_HIGHEST }}
70+
uv pip install --no-sources tket2-exts
71+
uv pip install --no-sources tket2-eccs
72+
uv run --no-sync maturin develop
73+
echo "\nDone! Installed dependencies:"
74+
uv pip list
75+
- name: Lint with ruff
76+
run: uv run --no-sync ruff check
77+
- name: Run python tests
78+
run: uv run --no-sync pytest

0 commit comments

Comments
 (0)