Skip to content

Commit 177441f

Browse files
authored
adopt ni/python-actions for PR builds (#235)
* adopt ni/python-actions for PR builds * address review comments * try env.pythonVersion * try upgrading python-actions and using steps....output * apparently now it's check --lock * actually request a python version * don't test 3.8 for now * what does adding πthon and free-threaded look like? * also drop support for 3.8 so that we can use poetry 2 * simplify dep specification * increase verbosity in test poetry install * also use ni/python-actions/analyze-project * I thought this was the default?? * add some debug output * oh, have to check out first
1 parent 1e8d5c7 commit 177441f

File tree

4 files changed

+31
-58
lines changed

4 files changed

+31
-58
lines changed

.github/workflows/PR.yml

Lines changed: 24 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -13,56 +13,44 @@ on:
1313
workflow_call:
1414
workflow_dispatch:
1515

16-
env:
17-
POETRY_VERSION: 1.8.1
18-
1916
jobs:
2017
checks:
21-
runs-on: ubuntu-latest
22-
env:
23-
PYTHON_VERSION: 3.11 # Use latest
18+
runs-on: ${{ matrix.os }}
19+
strategy:
20+
matrix:
21+
os: [macos-latest, windows-latest, ubuntu-latest]
22+
python-version: [3.9, 3.14] # oldest supported and latest tested
2423
steps:
25-
- uses: actions/checkout@v2
26-
- uses: actions/setup-python@v2
27-
with:
28-
python-version: ${{ env.PYTHON_VERSION }}
29-
- uses: Gr1N/setup-poetry@v8
24+
- name: Check out repo
25+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
26+
- uses: ni/python-actions/setup-python@9768589f3e50672173dad75a6fc181e4a85d33fa # v0.7.0
3027
with:
31-
poetry-version: ${{ env.POETRY_VERSION }}
32-
# @TODO: This is a workaround for there not being a way to check the lock file
33-
# See: https://github.com/python-poetry/poetry/issues/453
34-
- name: Check for lock changes
35-
run: |
36-
poetry lock --check
37-
- uses: actions/cache@v4
38-
with:
39-
path: ~/.cache/pypoetry/virtualenvs
40-
key: ${{ runner.os }}-poetry-${{ hashFiles('poetry.lock') }}
41-
- name: Install the Package
42-
run: poetry install -vvv
43-
- name: Lint the Code
44-
run: poetry run ni-python-styleguide lint
28+
python-version: ${{ matrix.python-version }}
29+
- uses: ni/python-actions/setup-poetry@9768589f3e50672173dad75a6fc181e4a85d33fa # v0.7.0
30+
- uses: ni/python-actions/analyze-project@9768589f3e50672173dad75a6fc181e4a85d33fa # v0.7.0
4531

4632
tests:
4733
runs-on: ${{ matrix.os }}
4834
strategy:
4935
matrix:
5036
os: [macos-latest, windows-latest, ubuntu-latest]
51-
python-version: [3.8, 3.9, '3.10', 3.11, 3.12, 3.13]
37+
python-version: [3.9, '3.10', 3.11, 3.12, 3.13, 3.14, 3.14t]
5238
steps:
53-
- uses: actions/checkout@v2
54-
- uses: actions/setup-python@v2
39+
- name: Check out repo
40+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
41+
- name: Set up Python
42+
id: setup-python
43+
uses: ni/python-actions/setup-python@9768589f3e50672173dad75a6fc181e4a85d33fa # v0.7.0
5544
with:
5645
python-version: ${{ matrix.python-version }}
57-
58-
- uses: Gr1N/setup-poetry@v8
59-
with:
60-
poetry-version: ${{ env.POETRY_VERSION }}
61-
- uses: actions/cache@v4
46+
- name: Set up Poetry
47+
uses: ni/python-actions/setup-poetry@9768589f3e50672173dad75a6fc181e4a85d33fa # v0.7.0
48+
- name: Cache virtualenv
49+
uses: actions/cache@0400d5f644dc74513175e3cd8d07132dd4860809 # v4.2.4
6250
with:
63-
path: ~/.cache/pypoetry/virtualenvs
64-
key: ${{ runner.os }}-poetry-${{ hashFiles('poetry.lock') }}
51+
path: .venv
52+
key: nps-${{ runner.os }}-py${{ steps.setup-python.outputs.python-version }}-${{ hashFiles('poetry.lock') }}
6553
- name: Install the Package
66-
run: poetry install
54+
run: poetry install -v
6755
- name: Run tests
6856
run: poetry run pytest -v

poetry.lock

Lines changed: 3 additions & 17 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

poetry.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
[virtualenvs]
2+
in-project = true

pyproject.toml

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ include = ["ni_python_styleguide/config.toml"]
1313

1414

1515
[tool.poetry.dependencies]
16-
python = "^3.8"
16+
python = "^3.9"
1717
pathspec = ">=0.11.1"
1818

1919
# Tools we aggregate
@@ -38,10 +38,7 @@ isort = ">=5.10"
3838
flake8-black = ">=0.2.1"
3939
flake8-docstrings = ">=1.5.0"
4040
flake8-import-order = ">=0.18.1,<0.19.0" # we're not compatible with 0.19.0 yet due to #226
41-
flake8-tidy-imports = [
42-
{version = ">=4.4.1", python = ">=3.7,<3.9"},
43-
{version=">=4.11.0", python="^3.9"},
44-
]
41+
flake8-tidy-imports = ">=4.11.0"
4542
pep8-naming = ">=0.11.1"
4643

4744
# Rejected flake8 plugins should be listed here (in alphabetical order)

0 commit comments

Comments
 (0)