Skip to content
Merged
Show file tree
Hide file tree
Changes from 19 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
68 changes: 17 additions & 51 deletions .github/workflows/python_test.yml
Original file line number Diff line number Diff line change
@@ -1,60 +1,26 @@
# 📘 Full documentation:
# https://github.com/renalreg/.github/blob/main/README.md#python-test-workflow


name: Python Test

on:
pull_request:
branches:
- main
- "master"

workflow_dispatch:

jobs:
test:
runs-on: ${{ matrix.platform }}
strategy:
matrix:
platform:
- ubuntu-latest
- windows-latest
python-version: ["3.9", "3.10", "3.11"]

env:
DIRECTORY_TO_SCAN: ./ukrr_models
TODO_REGEX: 'TODO:(?!\s*\[[A-Za-z0-9-]+\])'

steps:
- name: Checkout
uses: actions/checkout@v4

- name: Install Poetry
uses: Gr1N/setup-poetry@v8

- name: Set Up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}

- name: Install Dependencies
run: poetry install

- name: Run Tox
run: poetry run tox

- name: TODO Check (Linux)
if: runner.os == 'Linux'
run: |
result=$(find "$DIRECTORY_TO_SCAN" -type f -name "*.py" -exec grep -Hn -P "$TODO_REGEX" {} \;)
if [ -n "$result" ]; then
echo "Non-matching TODO comments found:"
echo "$result"
exit 1
fi

- name: TODO Check (Windows)
if: runner.os == 'Windows'
run: |
$result = Get-ChildItem -Path $env:DIRECTORY_TO_SCAN -Filter *.py -Recurse | ForEach-Object { Get-Content $_.FullName | Select-String -Pattern $env:TODO_REGEX }
if ($result) {
echo "Non-matching TODO comments found:"
echo "$result"
exit 1
}
call-workflow:
name: Running python tests
uses: renalreg/.github/.github/workflows/python_test.yml@main
secrets: inherit
with:
python_versions: '["3.12"]'

os: '["windows-latest"]'
package_manager_command: "pip install poetry"
install_command: "poetry install"
test_command: "poetry run tox"
org_deps: true
Loading
Loading