adopt ni/python-actions for PR builds #335
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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: | |
| env: | |
| POETRY_VERSION: 1.8.1 | |
| jobs: | |
| checks: | |
| runs-on: ubuntu-latest | |
| env: | |
| PYTHON_VERSION: 3.11 # Use latest | |
| steps: | |
| - name: Check out repo | |
| uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | |
| - name: Set up Python | |
| uses: ni/python-actions/setup-python@5286c12d65d90b2ea738bd57d452dc4366497581 # v0.4.1 | |
| - name: Set up Poetry | |
| uses: ni/python-actions/setup-poetry@5286c12d65d90b2ea738bd57d452dc4366497581 # v0.4.1 | |
| - name: Check for lock changes | |
| run: | | |
| poetry lock --check | |
| - name: Cache virtualenv | |
| uses: actions/cache@0400d5f644dc74513175e3cd8d07132dd4860809 # v4.2.4 | |
| with: | |
| path: .venv | |
| key: nps-${{ runner.os }}-py${{ steps.setup-python.outputs.python-version }}-${{ hashFiles('poetry.lock') }} | |
| - name: Install the Package | |
| run: poetry install -vvv | |
| - name: Lint the Code | |
| run: poetry run nps lint | |
| tests: | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| matrix: | |
| os: [macos-latest, windows-latest, ubuntu-latest] | |
| python-version: [3.8, 3.9, '3.10', 3.11, 3.12, 3.13] | |
| steps: | |
| - name: Check out repo | |
| uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | |
| - name: Set up Python | |
| uses: ni/python-actions/setup-python@5286c12d65d90b2ea738bd57d452dc4366497581 # v0.4.1 | |
| - name: Set up Poetry | |
| uses: ni/python-actions/setup-poetry@5286c12d65d90b2ea738bd57d452dc4366497581 # v0.4.1 | |
| - name: Cache virtualenv | |
| uses: actions/cache@0400d5f644dc74513175e3cd8d07132dd4860809 # v4.2.4 | |
| with: | |
| path: .venv | |
| key: nps-${{ runner.os }}-py${{ steps.setup-python.outputs.python-version }}-${{ hashFiles('poetry.lock') }} | |
| - name: Install the Package | |
| run: poetry install | |
| - name: Run tests | |
| run: poetry run pytest -v |