Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

18 add GitHub workflow for releases #19

Merged
merged 9 commits into from
Jan 10, 2024
6 changes: 3 additions & 3 deletions .github/workflows/_code_quality.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
options: '--check --diff'
src: '.'
jupyter: true
version: '==23.11'
version: '==23.12'

ruff:
runs-on: ubuntu-latest
Expand All @@ -31,7 +31,7 @@ jobs:
run: |
pip install -r requirements.txt
- name: Install ruff
run: pip install ruff==0.1.6
run: pip install ruff==0.1.8
- name: Run ruff
run: ruff .

Expand All @@ -52,6 +52,6 @@ jobs:
pip install -r requirements.txt
pip install pytest
- name: Install pyright
run: pip install pyright==1.1.336
run: pip install pyright==1.1.338
- name: Run pyright
run: pyright .
25 changes: 25 additions & 0 deletions .github/workflows/_merge_into_release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: Merge into release

on:
workflow_call:
secrets:
RELEASE_TOKEN:
required: true

jobs:
merge_into_release:
name: Merge ${{ github.event.ref }} -> release branch
runs-on: ubuntu-latest
environment: release
steps:
- uses: actions/checkout@v4
with:
# Fetch the whole history to prevent unrelated history errors
fetch-depth: 0
# The branch you want to checkout (usually equal to `branchtomerge`)
# ref: ${{ github.event.ref }}
- uses: devmasx/merge-branch@v1.4.0
with:
type: now
target_branch: release
github_token: ${{ secrets.RELEASE_TOKEN }}
22 changes: 22 additions & 0 deletions .github/workflows/_publish_package.yml.disabled
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: Publish Package to pypi

on:
workflow_call:
secrets:
PYPI_API_TOKEN:
required: true

jobs:
publish:
name: Publish package
runs-on: ubuntu-latest
environment: pypi
steps:
- uses: actions/download-artifact@v3
with:
name: artifact
path: ./dist/
- uses: pypa/gh-action-pypi-publish@v1.5.2
with:
user: __token__
password: ${{ secrets.PYPI_API_TOKEN }}
2 changes: 2 additions & 0 deletions .github/workflows/_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ jobs:
toxenv: 'py310'
- version: '3.11'
toxenv: 'py311'
- version: '3.12'
toxenv: 'py312'
steps:
- uses: actions/checkout@v4
- name: Install Python ${{ matrix.python.version }}
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/_test_future.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ jobs:
- runner: windows-latest
toxenv: windows
python:
- version: '3.12.0rc3'
toxenv: 'py312'
- version: '3.13.0a2'
toxenv: 'py313'
steps:
- uses: actions/checkout@v4
- name: Install Python ${{ matrix.python.version }}
Expand Down
25 changes: 25 additions & 0 deletions .github/workflows/publish_release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: Publish Release
run-name: Publish Release ${{ github.event.ref }} created by @${{ github.actor }}

on:
push:
tags:
- v*

jobs:
# requirements_files:
# uses: ./.github/workflows/_requirements_files.yml
# build_package:
# needs:
# - requirements_files
# uses: ./.github/workflows/_build_package.yml
# publish_package:
# needs:
# - build_package
# uses: ./.github/workflows/_publish_package.yml
# secrets:
# PYPI_API_TOKEN: ${{ secrets.PYPI_API_TOKEN }}
merge_into_release:
uses: ./.github/workflows/_merge_into_release.yml
secrets:
RELEASE_TOKEN: ${{ secrets.RELEASE_TOKEN }}
14 changes: 12 additions & 2 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,21 @@
"version": "0.2.0",
"configurations": [
{
"name": "Debug Unit Test",
"name": "Python: Debug Tests",
"type": "python",
"request": "launch",
"program": "${file}",
"purpose": [
"debug-test"
],
"console": "integratedTerminal",
"env": {
"PYTEST_ADDOPTS": "--no-cov"
},
"autoReload": {
"enable": true
},
"justMyCode": false,
"program": "${file}"
},
{
"name": "Python: Current File, cwd = file dir, envFile",
Expand Down
8 changes: 3 additions & 5 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,24 +5,22 @@
"python.terminal.activateEnvInCurrentTerminal": true,
"python.languageServer": "Pylance",
"ruff.importStrategy": "fromEnvironment",
"python.linting.enabled": false,
"python.formatting.provider": "black",
"editor.formatOnSave": true,
"[python]": {
"editor.formatOnSave": true,
"editor.codeActionsOnSave": {
"source.organizeImports": true
"source.organizeImports": "explicit"
},
},
"autoDocstring.docstringFormat": "numpy",
"python.testing.unittestEnabled": false,
"python.testing.pytestEnabled": true,
"python.analysis.logLevel": "Warning",
"python.analysis.completeFunctionParens": false,
"python.analysis.diagnosticMode": "workspace",
"python.analysis.diagnosticSeverityOverrides": {},
"python.analysis.indexing": true,
"python.analysis.autoImportCompletions": true,
"python.analysis.autoImportUserSymbols": true,
"python.analysis.inlayHints.variableTypes": false,
"python.analysis.inlayHints.functionReturnTypes": false,
"python.analysis.inlayHints.pytestParameters": true,
Expand All @@ -44,4 +42,4 @@
"includeAllSymbols": true,
},
],
}
}
10 changes: 4 additions & 6 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,12 @@ pydantic = "^2.5"
optional = true

[tool.poetry.group.dev.dependencies]
black = { version = "^23.11", extras = ["jupyter"] }
ruff = "^0.1.6" # linter
pyright = "^1.1.336"
black = { version = "^23.12", extras = ["jupyter"] }
ruff = "^0.1.8" # linter
pyright = "^1.1.338"
tox = "^4.11.1"
pytest = "^7.4.1"
pytest-cov = "^4.1"
pytest-randomly = "^3.15"
sourcery = "^1.14"

[tool.poetry.group.docs]
Expand All @@ -51,11 +50,10 @@ build-backend = "poetry.core.masonry.api"
testpaths = "tests"
addopts = "--strict-markers"
xfail_strict = true
pythonpath = ["src"]

[tool.black]
line-length = 105
target-version = ["py39", "py310", "py311"]
target-version = ["py39", "py310", "py311", "py312"]

[tool.ruff]
exclude = [
Expand Down
1 change: 0 additions & 1 deletion tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ system_site_packages = True
deps =
pytest>=7.4
pytest-cov>=4.1
pytest-randomly>=3.15
commands =
pytest --cov --cov-config tox.ini {tty:--color=yes} {posargs}

Expand Down