Skip to content

Commit 80161b9

Browse files
committed
add free-threaded CI (Instagram#1312)
1 parent 30d9b0a commit 80161b9

File tree

2 files changed

+54
-4
lines changed

2 files changed

+54
-4
lines changed

.github/workflows/ci.yml

Lines changed: 49 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,51 @@ jobs:
4444
hatch run coverage combine .coverage.pure
4545
hatch run coverage report
4646
47+
# TODO:
48+
# merge into regular CI once hatch has support for creating environments on
49+
# the free-threaded build: https://github.com/pypa/hatch/issues/1931
50+
free-threaded-tests:
51+
name: "test (${{ matrix.os }}, 3.13t)"
52+
runs-on: ${{ matrix.os }}
53+
strategy:
54+
fail-fast: false
55+
matrix:
56+
os: [macos-latest, ubuntu-latest, windows-latest]
57+
steps:
58+
- uses: actions/checkout@v4
59+
with:
60+
fetch-depth: 0
61+
persist-credentials: false
62+
# TODO: update to tagged release when there is one
63+
- uses: actions/setup-python@9e62be81b28222addecf85e47571213eb7680449
64+
with:
65+
cache: pip
66+
cache-dependency-path: "pyproject.toml"
67+
python-version: '3.13t'
68+
- name: Build LibCST
69+
run: |
70+
# Install build-system.requires dependencies
71+
pip install setuptools setuptools-scm setuptools-rust wheel
72+
# Jupyter is annoying to install on free-threaded Python
73+
pip install -e .[dev-without-jupyter] --no-build-isolation
74+
- name: Native Parser Tests
75+
# TODO: remove when native modules declare free-threaded support
76+
env:
77+
PYTHON_GIL: '0'
78+
run: |
79+
python -m coverage run -m libcst.tests
80+
- name: Pure Parser Tests
81+
env:
82+
COVERAGE_FILE: .coverage.pure
83+
LIBCST_PARSER_TYPE: pure
84+
run: |
85+
python -m coverage run -m libcst.tests
86+
- name: Coverage
87+
run: |
88+
python -m coverage combine .coverage.pure
89+
python -m coverage report
90+
91+
4792
# Run linters
4893
lint:
4994
runs-on: ubuntu-latest
@@ -110,16 +155,18 @@ jobs:
110155
fail-fast: false
111156
matrix:
112157
os: [ubuntu-latest, macos-latest, windows-latest]
158+
python-version: ["3.10", "3.13t"]
113159
steps:
114160
- uses: actions/checkout@v4
115161
with:
116162
persist-credentials: false
117163
- uses: dtolnay/rust-toolchain@stable
118164
with:
119165
components: rustfmt, clippy
120-
- uses: actions/setup-python@v5
166+
# TODO: update to tagged release when there is one
167+
- uses: actions/setup-python@9e62be81b28222addecf85e47571213eb7680449
121168
with:
122-
python-version: "3.10"
169+
python-version: ${{ matrix.python-version }}
123170
- name: test
124171
uses: actions-rs/cargo@v1
125172
with:

pyproject.toml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,11 @@ dependencies = ["pyyaml>=5.2"]
2222

2323
[project.optional-dependencies]
2424
dev = [
25+
"libcst[dev-without-jupyter]",
26+
"jupyter>=1.0.0",
27+
"nbsphinx>=0.4.2",
28+
]
29+
dev-without-jupyter = [
2530
"black==24.8.0",
2631
"coverage[toml]>=4.5.4",
2732
"build>=0.10.0",
@@ -30,9 +35,7 @@ dev = [
3035
"Sphinx>=5.1.1",
3136
"hypothesis>=4.36.0",
3237
"hypothesmith>=0.0.4",
33-
"jupyter>=1.0.0",
3438
"maturin>=1.7.0,<1.8",
35-
"nbsphinx>=0.4.2",
3639
"prompt-toolkit>=2.0.9",
3740
"pyre-check==0.9.18; platform_system != 'Windows'",
3841
"setuptools_scm>=6.0.1",

0 commit comments

Comments
 (0)