Skip to content

Commit 2e5a861

Browse files
authored
Merge pull request #430 from sanders41/actions
Use environment variable to set minimum python version in CI
2 parents 0ea8ea2 + 4ba5fce commit 2e5a861

9 files changed

+28
-16
lines changed

src/github_actions.rs

Lines changed: 20 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@ on:
2626
branches:
2727
- main
2828
pull_request:
29+
env:
30+
PYTHON_VERSION: "{min_python_version}"
2931
jobs:
3032
linting:
3133
runs-on: ubuntu-latest
@@ -40,7 +42,7 @@ jobs:
4042
- name: Set up Python
4143
uses: actions/setup-python@v5
4244
with:
43-
python-version: "{min_python_version}"
45+
python-version: ${{{{ env.PYTHON_VERSION }}}}
4446
cache: "poetry"
4547
- name: Install Dependencies
4648
run: poetry install
@@ -92,6 +94,8 @@ on:
9294
branches:
9395
- main
9496
pull_request:
97+
env:
98+
PYTHON_VERSION: "{min_python_version}"
9599
jobs:
96100
linting:
97101
runs-on: ubuntu-latest
@@ -100,7 +104,7 @@ jobs:
100104
- name: Set up Python
101105
uses: actions/setup-python@v5
102106
with:
103-
python-version: "{min_python_version}"
107+
python-version: ${{{{ env.PYTHON_VERSION }}}}
104108
cache: "pip"
105109
- name: Install Dependencies
106110
run: |
@@ -152,6 +156,7 @@ on:
152156
pull_request:
153157
env:
154158
UV_CACHE_DIR: /tmp/.uv-cache
159+
PYTHON_VERSION: "{min_python_version}"
155160
jobs:
156161
linting:
157162
runs-on: ubuntu-latest
@@ -162,7 +167,7 @@ jobs:
162167
- name: Set up Python
163168
uses: actions/setup-python@v5
164169
with:
165-
python-version: "{min_python_version}"
170+
python-version: ${{{{ env.PYTHON_VERSION }}}}
166171
- name: Restore uv cache
167172
uses: actions/cache@v4
168173
with:
@@ -232,6 +237,7 @@ env:
232237
CARGO_TERM_COLOR: always
233238
RUST_BACKTRACE: 1
234239
RUSTFLAGS: "-D warnings"
240+
PYTHON_VERSION: "{min_python_version}"
235241
jobs:
236242
clippy:
237243
name: Clippy
@@ -264,7 +270,7 @@ jobs:
264270
- name: Set up Python
265271
uses: actions/setup-python@v5
266272
with:
267-
python-version: "{min_python_version}"
273+
python-version: ${{{{ env.PYTHON_VERSION }}}}
268274
cache: "pip"
269275
- name: Install Dependencies
270276
run: |
@@ -352,6 +358,8 @@ on:
352358
branches:
353359
- main
354360
pull_request:
361+
env:
362+
PYTHON_VERSION: "{min_python_version}"
355363
jobs:
356364
linting:
357365
runs-on: ubuntu-latest
@@ -366,7 +374,7 @@ jobs:
366374
- name: Set up Python
367375
uses: actions/setup-python@v5
368376
with:
369-
python-version: "{min_python_version}"
377+
python-version: ${{{{ env.PYTHON_VERSION }}}}
370378
cache: "poetry"
371379
- name: Install Dependencies
372380
run: poetry install
@@ -419,6 +427,8 @@ on:
419427
branches:
420428
- main
421429
pull_request:
430+
env:
431+
PYTHON_VERSION: "{min_python_version}"
422432
jobs:
423433
linting:
424434
runs-on: ubuntu-latest
@@ -427,7 +437,7 @@ jobs:
427437
- name: Set up Python
428438
uses: actions/setup-python@v5
429439
with:
430-
python-version: "{min_python_version}"
440+
python-version: ${{{{ env.PYTHON_VERSION }}}}
431441
cache: "pip"
432442
- name: Install Dependencies
433443
run: |
@@ -482,6 +492,7 @@ env:
482492
CARGO_TERM_COLOR: always
483493
RUST_BACKTRACE: 1
484494
RUSTFLAGS: "-D warnings"
495+
PYTHON_VERSION: "{min_python_version}"
485496
jobs:
486497
clippy:
487498
name: Clippy
@@ -514,7 +525,7 @@ jobs:
514525
- name: Set up Python
515526
uses: actions/setup-python@v5
516527
with:
517-
python-version: "{min_python_version}"
528+
python-version: ${{{{ env.PYTHON_VERSION }}}}
518529
cache: "pip"
519530
- name: Install Dependencies
520531
run: |
@@ -573,6 +584,7 @@ on:
573584
pull_request:
574585
env:
575586
UV_CACHE_DIR: /tmp/.uv-cache
587+
PYTHON_VERSION: "{min_python_version}"
576588
jobs:
577589
linting:
578590
runs-on: ubuntu-latest
@@ -583,7 +595,7 @@ jobs:
583595
- name: Set up Python
584596
uses: actions/setup-python@v5
585597
with:
586-
python-version: "{min_python_version}"
598+
python-version: ${{{{ env.PYTHON_VERSION }}}}
587599
- name: Restore uv cache
588600
uses: actions/cache@v4
589601
with:

src/snapshots/python_project__github_actions__tests__save_ci_testing_linux_only_file_pyo3.snap

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@
22
source: src/github_actions.rs
33
expression: content
44
---
5-
"name: Testing\n\non:\n push:\n branches:\n - main\n pull_request:\nenv:\n CARGO_TERM_COLOR: always\n RUST_BACKTRACE: 1\n RUSTFLAGS: \"-D warnings\"\njobs:\n clippy:\n name: Clippy\n runs-on: ubuntu-latest\n steps:\n - uses: actions/checkout@v4\n - name: Install Rust\n run: |\n curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y\n - name: Cache dependencies\n uses: Swatinem/[email protected]\n - name: Run cargo clippy\n run: cargo clippy --all-targets -- --deny warnings\n fmt:\n name: Rustfmt\n runs-on: ubuntu-latest\n steps:\n - uses: actions/checkout@v4\n - name: Install Rust\n run: |\n curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y\n - name: Cache dependencies\n uses: Swatinem/[email protected]\n - name: Run cargo fmt\n run: cargo fmt --all -- --check\n python-linting:\n runs-on: ubuntu-latest\n steps:\n - uses: actions/checkout@v4\n - name: Set up Python\n uses: actions/setup-python@v5\n with:\n python-version: \"3.9\"\n cache: \"pip\"\n - name: Install Dependencies\n run: |\n python -m pip install -U pip\n python -m pip install -r requirements-dev.txt\n python -m pip install -e .\n maturin build --out dist\n python -m pip install --no-index --find-links=dist/ prelude-parser\n - name: Ruff format check\n run: ruff format my_project tests --check\n - name: Lint with ruff\n run: ruff check .\n - name: mypy check\n run: mypy .\n testing:\n strategy:\n fail-fast: false\n matrix:\n python-version: [\"3.9\", \"3.10\", \"3.11\", \"3.12\"]\n runs-on: ubuntu-latest\n steps:\n - uses: actions/checkout@v4\n - name: Set up Python ${{ matrix.python-version }}\n uses: actions/setup-python@v5\n with:\n python-version: ${{ matrix.python-version }}\n cache: \"pip\"\n - name: Install Dependencies\n run: |\n python -m pip install -U pip\n python -m pip install -r requirements-dev.txt\n python -m pip install -e .\n maturin build --out dist\n python -m pip install --no-index --find-links=dist/ prelude-parser\n - name: Test with pytest\n run: pytest\n"
5+
"name: Testing\n\non:\n push:\n branches:\n - main\n pull_request:\nenv:\n CARGO_TERM_COLOR: always\n RUST_BACKTRACE: 1\n RUSTFLAGS: \"-D warnings\"\n PYTHON_VERSION: \"3.9\"\njobs:\n clippy:\n name: Clippy\n runs-on: ubuntu-latest\n steps:\n - uses: actions/checkout@v4\n - name: Install Rust\n run: |\n curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y\n - name: Cache dependencies\n uses: Swatinem/[email protected]\n - name: Run cargo clippy\n run: cargo clippy --all-targets -- --deny warnings\n fmt:\n name: Rustfmt\n runs-on: ubuntu-latest\n steps:\n - uses: actions/checkout@v4\n - name: Install Rust\n run: |\n curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y\n - name: Cache dependencies\n uses: Swatinem/[email protected]\n - name: Run cargo fmt\n run: cargo fmt --all -- --check\n python-linting:\n runs-on: ubuntu-latest\n steps:\n - uses: actions/checkout@v4\n - name: Set up Python\n uses: actions/setup-python@v5\n with:\n python-version: ${{ env.PYTHON_VERSION }}\n cache: \"pip\"\n - name: Install Dependencies\n run: |\n python -m pip install -U pip\n python -m pip install -r requirements-dev.txt\n python -m pip install -e .\n maturin build --out dist\n python -m pip install --no-index --find-links=dist/ prelude-parser\n - name: Ruff format check\n run: ruff format my_project tests --check\n - name: Lint with ruff\n run: ruff check .\n - name: mypy check\n run: mypy .\n testing:\n strategy:\n fail-fast: false\n matrix:\n python-version: [\"3.9\", \"3.10\", \"3.11\", \"3.12\"]\n runs-on: ubuntu-latest\n steps:\n - uses: actions/checkout@v4\n - name: Set up Python ${{ matrix.python-version }}\n uses: actions/setup-python@v5\n with:\n python-version: ${{ matrix.python-version }}\n cache: \"pip\"\n - name: Install Dependencies\n run: |\n python -m pip install -U pip\n python -m pip install -r requirements-dev.txt\n python -m pip install -e .\n maturin build --out dist\n python -m pip install --no-index --find-links=dist/ prelude-parser\n - name: Test with pytest\n run: pytest\n"

src/snapshots/python_project__github_actions__tests__save_ci_testing_multi_os_file_pyo3.snap

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@
22
source: src/github_actions.rs
33
expression: content
44
---
5-
"name: Testing\n\non:\n push:\n branches:\n - main\n pull_request:\nenv:\n CARGO_TERM_COLOR: always\n RUST_BACKTRACE: 1\n RUSTFLAGS: \"-D warnings\"\njobs:\n clippy:\n name: Clippy\n runs-on: ubuntu-latest\n steps:\n - uses: actions/checkout@v4\n - name: Install Rust\n run: |\n curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y\n - name: Cache dependencies\n uses: Swatinem/[email protected]\n - name: Run cargo clippy\n run: cargo clippy --all-targets -- --deny warnings\n fmt:\n name: Rustfmt\n runs-on: ubuntu-latest\n steps:\n - uses: actions/checkout@v4\n - name: Install Rust\n run: |\n curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y\n - name: Cache dependencies\n uses: Swatinem/[email protected]\n - name: Run cargo fmt\n run: cargo fmt --all -- --check\n python-linting:\n runs-on: ubuntu-latest\n steps:\n - uses: actions/checkout@v4\n - name: Set up Python\n uses: actions/setup-python@v5\n with:\n python-version: \"3.9\"\n cache: \"pip\"\n - name: Install Dependencies\n run: |\n python -m pip install -U pip\n python -m pip install -r requirements-dev.txt\n python -m pip install -e .\n maturin build --out dist\n python -m pip install --no-index --find-links=dist/ prelude-parser\n - name: Ruff format check\n run: ruff format my_project tests --check\n - name: Lint with ruff\n run: ruff check .\n - name: mypy check\n run: mypy .\n testing:\n strategy:\n fail-fast: false\n matrix:\n python-version: [\"3.9\", \"3.10\", \"3.11\", \"3.12\"]\n os: [ubuntu-latest, windows-latest, macos-latest]\n runs-on: ${{ matrix.os }}\n steps:\n - uses: actions/checkout@v4\n - name: Set up Python ${{ matrix.python-version }}\n uses: actions/setup-python@v5\n with:\n python-version: ${{ matrix.python-version }}\n cache: \"pip\"\n - name: Install Dependencies\n run: |\n python -m pip install -U pip\n python -m pip install -r requirements-dev.txt\n python -m pip install -e .\n maturin build --out dist\n python -m pip install --no-index --find-links=dist/ prelude-parser\n - name: Test with pytest\n run: pytest\n"
5+
"name: Testing\n\non:\n push:\n branches:\n - main\n pull_request:\nenv:\n CARGO_TERM_COLOR: always\n RUST_BACKTRACE: 1\n RUSTFLAGS: \"-D warnings\"\n PYTHON_VERSION: \"3.9\"\njobs:\n clippy:\n name: Clippy\n runs-on: ubuntu-latest\n steps:\n - uses: actions/checkout@v4\n - name: Install Rust\n run: |\n curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y\n - name: Cache dependencies\n uses: Swatinem/[email protected]\n - name: Run cargo clippy\n run: cargo clippy --all-targets -- --deny warnings\n fmt:\n name: Rustfmt\n runs-on: ubuntu-latest\n steps:\n - uses: actions/checkout@v4\n - name: Install Rust\n run: |\n curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y\n - name: Cache dependencies\n uses: Swatinem/[email protected]\n - name: Run cargo fmt\n run: cargo fmt --all -- --check\n python-linting:\n runs-on: ubuntu-latest\n steps:\n - uses: actions/checkout@v4\n - name: Set up Python\n uses: actions/setup-python@v5\n with:\n python-version: ${{ env.PYTHON_VERSION }}\n cache: \"pip\"\n - name: Install Dependencies\n run: |\n python -m pip install -U pip\n python -m pip install -r requirements-dev.txt\n python -m pip install -e .\n maturin build --out dist\n python -m pip install --no-index --find-links=dist/ prelude-parser\n - name: Ruff format check\n run: ruff format my_project tests --check\n - name: Lint with ruff\n run: ruff check .\n - name: mypy check\n run: mypy .\n testing:\n strategy:\n fail-fast: false\n matrix:\n python-version: [\"3.9\", \"3.10\", \"3.11\", \"3.12\"]\n os: [ubuntu-latest, windows-latest, macos-latest]\n runs-on: ${{ matrix.os }}\n steps:\n - uses: actions/checkout@v4\n - name: Set up Python ${{ matrix.python-version }}\n uses: actions/setup-python@v5\n with:\n python-version: ${{ matrix.python-version }}\n cache: \"pip\"\n - name: Install Dependencies\n run: |\n python -m pip install -U pip\n python -m pip install -r requirements-dev.txt\n python -m pip install -e .\n maturin build --out dist\n python -m pip install --no-index --find-links=dist/ prelude-parser\n - name: Test with pytest\n run: pytest\n"

src/snapshots/python_project__github_actions__tests__save_poetry_ci_testing_linux_only_file.snap

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@
22
source: src/github_actions.rs
33
expression: content
44
---
5-
"name: Testing\n\non:\n push:\n branches:\n - main\n pull_request:\njobs:\n linting:\n runs-on: ubuntu-latest\n steps:\n - uses: actions/checkout@v4\n - name: Install Poetry\n run: pipx install poetry\n - name: Configure poetry\n run: |\n poetry config virtualenvs.create true\n poetry config virtualenvs.in-project true\n - name: Set up Python\n uses: actions/setup-python@v5\n with:\n python-version: \"3.9\"\n cache: \"poetry\"\n - name: Install Dependencies\n run: poetry install\n - name: Ruff format check\n run: poetry run ruff format my_project tests --check\n - name: Lint with ruff\n run: poetry run ruff check .\n - name: mypy check\n run: poetry run mypy .\n testing:\n strategy:\n fail-fast: false\n matrix:\n python-version: [\"3.9\", \"3.10\", \"3.11\", \"3.12\"]\n runs-on: ubuntu-latest\n steps:\n - uses: actions/checkout@v4\n - name: Install Poetry\n run: pipx install poetry\n - name: Configure poetry\n run: |\n poetry config virtualenvs.create true\n poetry config virtualenvs.in-project true\n - name: Set up Python ${{ matrix.python-version }}\n uses: actions/setup-python@v5\n with:\n python-version: ${{ matrix.python-version }}\n cache: \"poetry\"\n - name: Install Dependencies\n run: poetry install\n - name: Test with pytest\n run: poetry run pytest\n"
5+
"name: Testing\n\non:\n push:\n branches:\n - main\n pull_request:\nenv:\n PYTHON_VERSION: \"3.9\"\njobs:\n linting:\n runs-on: ubuntu-latest\n steps:\n - uses: actions/checkout@v4\n - name: Install Poetry\n run: pipx install poetry\n - name: Configure poetry\n run: |\n poetry config virtualenvs.create true\n poetry config virtualenvs.in-project true\n - name: Set up Python\n uses: actions/setup-python@v5\n with:\n python-version: ${{ env.PYTHON_VERSION }}\n cache: \"poetry\"\n - name: Install Dependencies\n run: poetry install\n - name: Ruff format check\n run: poetry run ruff format my_project tests --check\n - name: Lint with ruff\n run: poetry run ruff check .\n - name: mypy check\n run: poetry run mypy .\n testing:\n strategy:\n fail-fast: false\n matrix:\n python-version: [\"3.9\", \"3.10\", \"3.11\", \"3.12\"]\n runs-on: ubuntu-latest\n steps:\n - uses: actions/checkout@v4\n - name: Install Poetry\n run: pipx install poetry\n - name: Configure poetry\n run: |\n poetry config virtualenvs.create true\n poetry config virtualenvs.in-project true\n - name: Set up Python ${{ matrix.python-version }}\n uses: actions/setup-python@v5\n with:\n python-version: ${{ matrix.python-version }}\n cache: \"poetry\"\n - name: Install Dependencies\n run: poetry install\n - name: Test with pytest\n run: poetry run pytest\n"

src/snapshots/python_project__github_actions__tests__save_poetry_ci_testing_multi_os_file.snap

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@
22
source: src/github_actions.rs
33
expression: content
44
---
5-
"name: Testing\n\non:\n push:\n branches:\n - main\n pull_request:\njobs:\n linting:\n runs-on: ubuntu-latest\n steps:\n - uses: actions/checkout@v4\n - name: Install Poetry\n run: pipx install poetry\n - name: Configure poetry\n run: |\n poetry config virtualenvs.create true\n poetry config virtualenvs.in-project true\n - name: Set up Python\n uses: actions/setup-python@v5\n with:\n python-version: \"3.9\"\n cache: \"poetry\"\n - name: Install Dependencies\n run: poetry install\n - name: Ruff format check\n run: poetry run ruff format my_project tests --check\n - name: Lint with ruff\n run: poetry run ruff check .\n - name: mypy check\n run: poetry run mypy .\n testing:\n strategy:\n fail-fast: false\n matrix:\n python-version: [\"3.9\", \"3.10\", \"3.11\", \"3.12\"]\n os: [ubuntu-latest, windows-latest, macos-latest]\n runs-on: ${{ matrix.os }}\n steps:\n - uses: actions/checkout@v4\n - name: Install Poetry\n run: pipx install poetry\n - name: Configure poetry\n run: |\n poetry config virtualenvs.create true\n poetry config virtualenvs.in-project true\n - name: Set up Python ${{ matrix.python-version }}\n uses: actions/setup-python@v5\n with:\n python-version: ${{ matrix.python-version }}\n cache: \"poetry\"\n - name: Install Dependencies\n run: poetry install\n - name: Test with pytest\n run: poetry run pytest\n"
5+
"name: Testing\n\non:\n push:\n branches:\n - main\n pull_request:\nenv:\n PYTHON_VERSION: \"3.9\"\njobs:\n linting:\n runs-on: ubuntu-latest\n steps:\n - uses: actions/checkout@v4\n - name: Install Poetry\n run: pipx install poetry\n - name: Configure poetry\n run: |\n poetry config virtualenvs.create true\n poetry config virtualenvs.in-project true\n - name: Set up Python\n uses: actions/setup-python@v5\n with:\n python-version: ${{ env.PYTHON_VERSION }}\n cache: \"poetry\"\n - name: Install Dependencies\n run: poetry install\n - name: Ruff format check\n run: poetry run ruff format my_project tests --check\n - name: Lint with ruff\n run: poetry run ruff check .\n - name: mypy check\n run: poetry run mypy .\n testing:\n strategy:\n fail-fast: false\n matrix:\n python-version: [\"3.9\", \"3.10\", \"3.11\", \"3.12\"]\n os: [ubuntu-latest, windows-latest, macos-latest]\n runs-on: ${{ matrix.os }}\n steps:\n - uses: actions/checkout@v4\n - name: Install Poetry\n run: pipx install poetry\n - name: Configure poetry\n run: |\n poetry config virtualenvs.create true\n poetry config virtualenvs.in-project true\n - name: Set up Python ${{ matrix.python-version }}\n uses: actions/setup-python@v5\n with:\n python-version: ${{ matrix.python-version }}\n cache: \"poetry\"\n - name: Install Dependencies\n run: poetry install\n - name: Test with pytest\n run: poetry run pytest\n"

0 commit comments

Comments
 (0)