add a pip install and lint to the PR build to validate install time deps without the lock #369
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: | |
| 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@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1 | |
| - uses: ni/python-actions/setup-python@9768589f3e50672173dad75a6fc181e4a85d33fa # v0.7.0 | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| - uses: ni/python-actions/setup-poetry@9768589f3e50672173dad75a6fc181e4a85d33fa # v0.7.0 | |
| - uses: ni/python-actions/analyze-project@9768589f3e50672173dad75a6fc181e4a85d33fa # v0.7.0 | |
| 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@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1 | |
| - name: Set up Python | |
| id: setup-python | |
| uses: ni/python-actions/setup-python@9768589f3e50672173dad75a6fc181e4a85d33fa # v0.7.0 | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| - name: Set up Poetry | |
| uses: ni/python-actions/setup-poetry@9768589f3e50672173dad75a6fc181e4a85d33fa # v0.7.0 | |
| - name: Cache virtualenv | |
| uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.3.0 | |
| 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: | | |
| pwd | |
| ${DOG_FOOD_VENV_BIN}/nps lint . |