-
Notifications
You must be signed in to change notification settings - Fork 19
75 lines (72 loc) · 2.66 KB
/
PR.yml
File metadata and controls
75 lines (72 loc) · 2.66 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
name: PR
on:
pull_request:
branches:
- main
paths:
- ni_python_styleguide/**
- poetry.lock
- pyproject.toml
- docs/Coding-Conventions.md
- .github/workflows/PR.yml
workflow_call:
workflow_dispatch:
jobs:
checks:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [macos-latest, windows-latest, ubuntu-latest]
python-version: [3.9, 3.14] # oldest supported and latest tested
steps:
- name: Check out repo
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- uses: ni/python-actions/setup-python@aa64e60612cb078b0c2ada666becbd70d4817d55 # v0.7.1
with:
python-version: ${{ matrix.python-version }}
- uses: ni/python-actions/setup-poetry@aa64e60612cb078b0c2ada666becbd70d4817d55 # v0.7.1
- uses: ni/python-actions/analyze-project@aa64e60612cb078b0c2ada666becbd70d4817d55 # v0.7.1
tests:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [macos-latest, windows-latest, ubuntu-latest]
python-version: [3.9, '3.10', 3.11, 3.12, 3.13, 3.14, 3.14t]
steps:
- name: Check out repo
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- name: Set up Python
id: setup-python
uses: ni/python-actions/setup-python@aa64e60612cb078b0c2ada666becbd70d4817d55 # v0.7.1
with:
python-version: ${{ matrix.python-version }}
- name: Set up Poetry
uses: ni/python-actions/setup-poetry@aa64e60612cb078b0c2ada666becbd70d4817d55 # v0.7.1
- name: Cache virtualenv
uses: actions/cache@cdf6c1fa76f9f475f3d7449005a359c84ca0f306 # v5.0.3
with:
path: .venv
key: nps-${{ runner.os }}-py${{ steps.setup-python.outputs.python-version }}-${{ hashFiles('poetry.lock') }}
- name: Install the Package
run: poetry install -v
- name: Run tests
run: poetry run pytest -v
- name: Install package into separate venv
shell: bash
run: |
venv_dir="$RUNNER_TEMP/dog_food_venv"
python3 -m venv "${venv_dir}"
if [[ "$RUNNER_OS" == "Windows" ]]; then
binary_folder_name="Scripts"
else
binary_folder_name="bin"
fi
DOG_FOOD_VENV_BIN="${venv_dir}/${binary_folder_name}"
echo "DOG_FOOD_VENV_BIN=${venv_dir}/${binary_folder_name}" >> "$GITHUB_ENV"
${DOG_FOOD_VENV_BIN}/pip install .
- name: Lint our own package
shell: bash
run: |
echo "We expect to have to format before linting passes."
${DOG_FOOD_VENV_BIN}/nps format .
${DOG_FOOD_VENV_BIN}/nps lint .