This repository has been archived by the owner on Dec 5, 2024. It is now read-only.
-
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.
* build: use uv and hatch * fix: fix typing in tests * style: reformat using ruff + pylint * style: fix some code up * docs: refer to uv in README.md * style: fix indents in pyproject.toml * refactor: big restructure * chore: add py.typed * ci: modify doc ci * style: ignore example and docs * style: fix up some types * feat: add class methods to builder
- Loading branch information
Showing
92 changed files
with
2,215 additions
and
3,411 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 |
---|---|---|
@@ -1,150 +1,118 @@ | ||
name: ci-cd | ||
name: ci | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
- "feature/**" | ||
paths: | ||
- 'src/**.py' | ||
branches: [ main ] | ||
pull_request: | ||
workflow_dispatch: | ||
types: [opened, reopened, synchronize] | ||
|
||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.ref }} | ||
cancel-in-progress: true | ||
|
||
jobs: | ||
test: | ||
name: Test | ||
runs-on: ubuntu-latest | ||
concurrency: test | ||
ruff: | ||
runs-on: ubuntu-22.04 | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Setup Python & Dependencies | ||
uses: packetcoders/action-setup-cache-python-poetry@main | ||
- uses: astral-sh/ruff-action@d0a0e814ec17e92d33be7d24dd922b479f1bcd38 | ||
with: | ||
python-version: 3.12.1 | ||
poetry-version: 1.8.2 | ||
|
||
- name: Run Tests | ||
run: | | ||
poetry install --only-root | ||
poetry run pytest | ||
args: 'format --check' | ||
- uses: astral-sh/ruff-action@d0a0e814ec17e92d33be7d24dd922b479f1bcd38 | ||
with: | ||
args: 'check' | ||
|
||
lint: | ||
name: Lint | ||
runs-on: ubuntu-latest | ||
concurrency: lint | ||
test: | ||
runs-on: ubuntu-22.04 | ||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- name: Setup Python 3.12 | ||
uses: packetcoders/action-setup-cache-python-poetry@main | ||
- name: Install uv | ||
uses: astral-sh/setup-uv@v3 | ||
with: | ||
python-version: 3.12.1 | ||
poetry-version: 1.8.2 | ||
|
||
- name: Install dev dependencies | ||
run: poetry install --only-root | ||
enable-cache: true | ||
cache-dependency-glob: 'uv.lock' | ||
|
||
- name: Format with ruff | ||
run: | | ||
poetry run ruff check src/ --diff --output-format=full --exit-non-zero-on-fix | ||
- name: Typecheck with mypy | ||
run: poetry run mypy --ignore-missing-imports src/ | ||
|
||
beautify: | ||
name: Beautify | ||
runs-on: ubuntu-latest | ||
needs: [test, lint] | ||
concurrency: push | ||
permissions: | ||
id-token: write | ||
contents: write | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Set up Python | ||
uses: actions/setup-python@v5 | ||
with: | ||
ref: ${{ github.head_ref }} | ||
python-version-file: '.python-version' | ||
|
||
- name: Setup Python 3.12 | ||
uses: packetcoders/action-setup-cache-python-poetry@main | ||
with: | ||
python-version: 3.12.1 | ||
poetry-version: 1.8.2 | ||
- name: Install dev dependencies | ||
run: poetry install --only-root | ||
|
||
- name: Format with ruff | ||
run: poetry run ruff format src/ | ||
|
||
- name: Commit and push changes | ||
uses: stefanzweifel/git-auto-commit-action@v5 | ||
id: auto-commit-action | ||
with: | ||
commit_message: "style: beautify ${{ github.sha }}" | ||
- name: Run tests | ||
run: | | ||
uv run pytest | ||
release: | ||
name: Semantic Release | ||
runs-on: ubuntu-latest | ||
runs-on: ubuntu-22.04 | ||
concurrency: push | ||
needs: [test, lint, beautify] | ||
needs: [ruff, test] | ||
if: github.ref == 'refs/heads/main' | ||
permissions: | ||
id-token: write | ||
contents: write | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
- name: Setup Python 3.12 | ||
uses: packetcoders/action-setup-cache-python-poetry@main | ||
with: | ||
python-version: 3.12.1 | ||
poetry-version: 1.8.2 | ||
|
||
- name: Python Semantic Release | ||
id: release | ||
uses: python-semantic-release/python-semantic-release@composite-github-action | ||
with: | ||
github_token: ${{ secrets.GITHUB_TOKEN }} | ||
root_options: "-vv" | ||
|
||
- name: Publish GitHub Release | ||
uses: python-semantic-release/upload-to-gh-release@main | ||
if: ${{ steps.release.outputs.released }} == 'true' | ||
with: | ||
github_token: ${{ secrets.GITHUB_TOKEN }} | ||
tag: ${{ steps.release.outputs.version }} | ||
- uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- name: Install uv | ||
uses: astral-sh/setup-uv@v3 | ||
with: | ||
enable-cache: true | ||
cache-dependency-glob: 'uv.lock' | ||
|
||
- name: Set up Python | ||
uses: actions/setup-python@v5 | ||
with: | ||
python-version-file: '.python-version' | ||
|
||
- name: Python Semantic Release | ||
id: release | ||
uses: python-semantic-release/python-semantic-release@composite-github-action | ||
with: | ||
github_token: ${{ secrets.GITHUB_TOKEN }} | ||
root_options: '-vv' | ||
|
||
- name: Publish GitHub Release | ||
uses: python-semantic-release/upload-to-gh-release@main | ||
if: ${{ steps.release.outputs.released }} == 'true' | ||
with: | ||
github_token: ${{ secrets.GITHUB_TOKEN }} | ||
tag: ${{ steps.release.outputs.version }} | ||
|
||
outputs: | ||
released: ${{ steps.release.outputs.released }} | ||
|
||
docs: | ||
name: Build Documentation | ||
runs-on: ubuntu-latest | ||
needs: [test, lint, beautify] | ||
runs-on: ubuntu-22.04 | ||
if: github.ref == 'refs/heads/main' && github.event_name == 'push' | ||
needs: [release] | ||
permissions: | ||
id-token: write | ||
contents: write | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: actions/checkout@v4 | ||
|
||
- name: Setup Python 3.12 | ||
uses: packetcoders/action-setup-cache-python-poetry@main | ||
with: | ||
python-version: 3.12.1 | ||
poetry-version: 1.8.2 | ||
- name: Add Poetry's bin directory to the PATH | ||
run: echo "$(poetry env info --path)/bin" >> $GITHUB_PATH | ||
- name: Install uv | ||
uses: astral-sh/setup-uv@v3 | ||
with: | ||
enable-cache: true | ||
cache-dependency-glob: 'uv.lock' | ||
|
||
- name: Set up Python | ||
uses: actions/setup-python@v5 | ||
with: | ||
python-version-file: '.python-version' | ||
|
||
- name: Build HTML | ||
run: | | ||
cd docs/ | ||
make html | ||
- name: Run ghp-import | ||
run: | | ||
ghp-import -n -p -f docs/_build/html | ||
- name: Install dependencies | ||
run: | | ||
uv sync --dev | ||
- name: Build HTML | ||
run: | | ||
cd docs/ | ||
make html | ||
- name: Run ghp-import | ||
run: | | ||
uv run ghp-import -n -p -f docs/_build/html |
This file was deleted.
Oops, something went wrong.
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 @@ | ||
3.13 |
Oops, something went wrong.