Skip to content

Commit

Permalink
Extend PR Checks (#83)
Browse files Browse the repository at this point in the history
- Use `uv`
- Adds:
  - Code style (does not need to pass)
  - License check
  • Loading branch information
leoschwarz authored May 7, 2024
1 parent 04b9252 commit 76daee1
Show file tree
Hide file tree
Showing 4 changed files with 71 additions and 7 deletions.
17 changes: 17 additions & 0 deletions .github/actions/setup-bfabricpy/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
name: "Setup bfabricPy"
inputs:
python-version:
description: "Python version to use"
required: true
runs:
using: "composite"
steps:
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: ${{ inputs.python-version }}
- name: Install bfabricPy
shell: bash
run: |
pip install uv
uv pip install --system ".[dev]"
33 changes: 26 additions & 7 deletions .github/workflows/run_unit_tests.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: unit tests
name: PR Checks

on:
push:
Expand All @@ -8,15 +8,34 @@ on:
workflow_dispatch:

jobs:
build:
unit_tests:
name: Unit Tests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up Python 3.9
uses: actions/setup-python@v2
- uses: actions/checkout@v4
- uses: ./.github/actions/setup-bfabricpy
with:
python-version: 3.9
- name: Install bfabricPy
run: python -m pip install .
- name: Run unit tests
run: python -m unittest discover -s bfabric/tests/unit -p 'test_*.py'
code_style:
name: Code Style
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/setup-bfabricpy
with:
python-version: 3.9
- name: Check code with ruff
run:
ruff bfabric || true
license_check:
name: License Check
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/setup-bfabricpy
with:
python-version: 3.9
- name: Check licenses
run: licensecheck
5 changes: 5 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
.PHONY: install install_dev build clean

test: test_read

test_workunit:
Expand All @@ -9,6 +11,9 @@ test_read:
install:
pip install -e .

install_dev:
pip install -e ".[dev]"

clean:
rm -vf dist/*

23 changes: 23 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,14 @@ dependencies = [
"pandas >= 2.2.2"
]

[project.optional-dependencies]
dev = [
"black",
"isort",
"ruff",
"licensecheck"
]

[project.urls]
Homepage = "https://github.com/fgcz/bfabricPy"
Repository = "https://github.com/fgcz/bfabricPy"
Expand Down Expand Up @@ -56,3 +64,18 @@ Repository = "https://github.com/fgcz/bfabricPy"
#bfabric_save_resource="bfabric.scripts.bfabric_save_resource:main"
#bfabric_save_workunit_attribute="bfabric.scripts.bfabric_save_workunit_attribute:main"
#bfabric_save_workflowstep="bfabric.scripts.bfabric_save_workflowstep:main"

[tool.black]
line-length = 120
target-version = ["py39"]

[tool.ruff]
line-length = 120
indent-width = 4
target-version = "py39"

[tool.ruff.lint]
select = ["D103", "E", "F", "ANN", "PTH", "UP", "BLE", "SIM"]

[tool.licensecheck]
using = "PEP631"

0 comments on commit 76daee1

Please sign in to comment.