-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
a5062dd
commit 695b45a
Showing
13 changed files
with
944 additions
and
53 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
runs: | ||
using: composite | ||
steps: | ||
- name: "Install UV" | ||
shell: bash | ||
run: | | ||
curl -LsSf https://astral.sh/uv/install.sh | sh |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,56 +1,63 @@ | ||
# This workflow will install Python dependencies, run tests with pytest, and publish package on successful builds. | ||
name: Python package | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
workflow_dispatch: | ||
|
||
jobs: | ||
test: | ||
lock_file: | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
python-version: ['3.10', '3.11'] | ||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- name: Set up Python ${{ matrix.python-version }} | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: ${{ matrix.python-version }} | ||
|
||
- name: Install dependencies | ||
run: | | ||
python -m pip install --upgrade pip | ||
pip install -r requirements.txt | ||
pip install -r requirements-test.txt | ||
- name: Run tests | ||
run: | | ||
pytest --maxfail=5 --disable-warnings | ||
deploy: | ||
needs: test | ||
- uses: ./.github/actions/setup | ||
- run: uv lock --locked | ||
linting: | ||
runs-on: ubuntu-latest | ||
needs: [lock_file] | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: ./.github/actions/setup | ||
- run: uvx ruff check . | ||
formatting: | ||
runs-on: ubuntu-latest | ||
needs: [lock_file] | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: ./.github/actions/setup | ||
- run: uvx ruff format --check . | ||
type_consistency: | ||
runs-on: ubuntu-latest | ||
needs: [lock_file] | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: ./.github/actions/setup | ||
- run: uv run pyright . | ||
tests: | ||
runs-on: ubuntu-latest | ||
needs: [lock_file] | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: ./.github/actions/setup | ||
- run: uv run pytest -v --durations=0 --cov --cov-report=xml | ||
# TODO | ||
# - name: Upload Coverage to Codecov | ||
# uses: codecov/codecov-action@v4 | ||
# with: | ||
# token: ${{ secrets.CODECOV_TOKEN }} | ||
|
||
build_and_deploy: | ||
runs-on: [ubuntu-latest] | ||
needs: [linting, formatting, type_consistency, tests] | ||
# Run only on manual trigger | ||
if: ${{ github.event_name == 'workflow_dispatch' }} | ||
environment: release | ||
permissions: | ||
id-token: write | ||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- name: Set up Python | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: '3.x' | ||
|
||
- name: Install dependencies | ||
run: | | ||
python -m pip install --upgrade pip | ||
pip install build | ||
- name: Build package | ||
run: python -m build | ||
|
||
- uses: ./.github/actions/setup | ||
- run: uv run python -m build | ||
- name: Publish package distributions to PyPI | ||
uses: pypa/gh-action-pypi-publish@release/v1 |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
clean-pyc: ## Clean Python cache files | ||
find . \( -name '*.pyc' -o -name '*.pyo' -o -name '*~' -o -name '__pycache__' -o -name '.pytest_cache' \) -exec rm -rf {} + | ||
|
||
clean-test: ## Cleanup pytest leftovers | ||
rm -f .coverage | ||
rm -fr htmlcov/ | ||
rm -fr test_results/ | ||
rm -f *report.html log.html test-results.html output.xml | ||
|
||
pre-commit-setup: ## Install pre-commit | ||
python3 -m pip install pre-commit | ||
pre-commit --version | ||
|
||
requirements: ## Install all requirements | ||
python3 -m pip install -r requirements.txt | ||
python3 -m pip install -r requirements-test.txt | ||
python3 -m pip install ruff | ||
|
||
setup: requirements pre-commit-setup## Set up all requirements | ||
|
||
docs: ## Open your browser to the web apps testing docs | ||
@echo "Opening documentation..." | ||
xdg-open http://localhost:5000/docs || open http://localhost:5000/docs |
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Binary file not shown.
Binary file not shown.
This file contains 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
Oops, something went wrong.