Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Empty file.
597 changes: 597 additions & 0 deletions .github/test_projects/repo_root/poetry.lock

Large diffs are not rendered by default.

37 changes: 37 additions & 0 deletions .github/test_projects/repo_root/pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
[project]
name = "test-project"
version = "0.1.0"
description = ""
authors = [
{name = "Joel Dixon",email = "[email protected]"}
]
readme = "README.md"
requires-python = ">=3.9,<4.0"
dynamic = ["dependencies"]

[tool.poetry]
packages = [{include = "test_project", from = "src"}]

[tool.poetry.group.lint.dependencies]
ni-python-styleguide = ">=0.4.1"
mypy = ">=1.0"
pyright = { version = ">=1.1.400", extras = ["nodejs"] }

[tool.ni-python-styleguide]
extend_exclude = "update-project-version"

[tool.mypy]
mypy_path = "."
files = "."
namespace_packages = true
strict = true
explicit_package_bases = true
exclude = "update-project-version"

[tool.pyright]
include = ["src/", "tests/"]
exclude = ["update-project-version"]

[build-system]
requires = ["poetry-core>=2.0.0,<3.0.0"]
build-backend = "poetry.core.masonry.api"
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
"""Docstring required."""
1 change: 1 addition & 0 deletions .github/test_projects/repo_root/tests/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
"""Module docstring."""
25 changes: 24 additions & 1 deletion .github/workflows/test_actions.yml
Original file line number Diff line number Diff line change
Expand Up @@ -228,11 +228,33 @@ jobs:
python-version: ${{ matrix.python-version }}
- name: Set up Poetry
uses: ./setup-poetry
- name: Analyze Python Project
- name: Analyze Python project
uses: ./analyze-project
with:
project-directory: ${{ github.workspace }}/.github/test_projects/minimal

test_analyze_project_repo_root:
name: Test analyze-project (repo root)
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [windows-latest, ubuntu-latest, macos-latest]
python-version: [3.9, '3.10', 3.11, 3.12, 3.13, pypy3.10, pypy3.11]
steps:
- name: Check out repo
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
- name: Set up Python
uses: ./setup-python
with:
python-version: ${{ matrix.python-version }}
- name: Set up Poetry
uses: ./setup-poetry
- name: Copy Python project to root
run: cp -av "${{ github.workspace }}/.github/test_projects/repo_root"/* "${{ github.workspace }}"
shell: bash
- name: Analyze Python project
uses: ./analyze-project

# This job is intended to combine the test results so we don't have to list
# each matrix combination in the required status check settings. There are a
# lot of corner cases that make this harder than it should be; see See
Expand All @@ -248,6 +270,7 @@ jobs:
test_check_project_version,
test_update_project_version,
test_analyze_project,
test_analyze_project_repo_root,
]
if: ${{ !cancelled() }}
steps:
Expand Down
30 changes: 20 additions & 10 deletions setup-poetry/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,20 +27,30 @@ runs:
- name: Set paths (Linux/Mac)
if: runner.os != 'Windows'
run: |
echo "POETRY_BIN_DIR=$GITHUB_WORKSPACE/.cache/poetry/bin" >> "$GITHUB_ENV"
echo "POETRY_CONFIG_DIR=$GITHUB_WORKSPACE/.cache/poetry/config" >> "$GITHUB_ENV"
echo "POETRY_HOME=$GITHUB_WORKSPACE/.cache/poetry/home" >> "$GITHUB_ENV"
echo "POETRY_HOME_BIN=$GITHUB_WORKSPACE/.cache/poetry/home/bin" >> "$GITHUB_ENV"
echo "$GITHUB_WORKSPACE/.cache/poetry/bin" >> "$GITHUB_PATH"
# Use the "pipeline directory" so that tools that search the workspace
# directory for Python files will not find the Poetry cache. Use
# realpath to normalize the "../".
PIPELINE_DIR="$(realpath $GITHUB_WORKSPACE/..)"
POETRY_ROOT="$PIPELINE_DIR/.cache/poetry"
echo "POETRY_BIN_DIR=$POETRY_ROOT/bin" >> "$GITHUB_ENV"
echo "POETRY_CONFIG_DIR=$POETRY_ROOT/config" >> "$GITHUB_ENV"
echo "POETRY_HOME=$POETRY_ROOT/home" >> "$GITHUB_ENV"
echo "POETRY_HOME_BIN=$POETRY_ROOT/home/bin" >> "$GITHUB_ENV"
echo "$POETRY_ROOT/bin" >> "$GITHUB_PATH"
shell: bash
- name: Set paths (Windows)
if: runner.os == 'Windows'
run: |
Add-Content $env:GITHUB_ENV "POETRY_BIN_DIR=$env:GITHUB_WORKSPACE\.cache\poetry\bin"
Add-Content $env:GITHUB_ENV "POETRY_CONFIG_DIR=$env:GITHUB_WORKSPACE\.cache\poetry\config"
Add-Content $env:GITHUB_ENV "POETRY_HOME=$env:GITHUB_WORKSPACE\.cache\poetry\home"
Add-Content $env:GITHUB_ENV "POETRY_HOME_BIN=$env:GITHUB_WORKSPACE\.cache\poetry\home\Scripts"
Add-Content $env:GITHUB_PATH "$env:GITHUB_WORKSPACE\.cache\poetry\bin"
# Use the "pipeline directory" so that tools that search the workspace
# directory for Python files will not find the Poetry cache. Use
# Resolve-Path to normalize the "../".
$PIPELINE_DIR = (Resolve-Path -Path "$env:GITHUB_WORKSPACE\..").Path
$POETRY_ROOT = "$PIPELINE_DIR\.cache\poetry"
Add-Content $env:GITHUB_ENV "POETRY_BIN_DIR=$POETRY_ROOT\bin"
Add-Content $env:GITHUB_ENV "POETRY_CONFIG_DIR=$POETRY_ROOT\config"
Add-Content $env:GITHUB_ENV "POETRY_HOME=$POETRY_ROOT\home"
Add-Content $env:GITHUB_ENV "POETRY_HOME_BIN=$POETRY_ROOT\home\Scripts"
Add-Content $env:GITHUB_PATH "$POETRY_ROOT\bin"
shell: pwsh
- name: Copy paths from $GITHUB_ENV to $GITHUB_OUTPUT
id: copy-paths
Expand Down
Loading