-
Notifications
You must be signed in to change notification settings - Fork 31
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
build: updated setup (pyproject.toml, ruff, tox, trusted publishing)
- Loading branch information
1 parent
7d9c247
commit 0ec2bc7
Showing
11 changed files
with
381 additions
and
77 deletions.
There are no files selected for viewing
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,11 @@ | ||
# Config for Dependabot updates. See Documentation here: | ||
# https://docs.github.com/en/code-security/dependabot/dependabot-version-updates/configuration-options-for-the-dependabot.yml-file | ||
|
||
version: 2 | ||
updates: | ||
# Update GitHub actions in workflows | ||
- package-ecosystem: "github-actions" | ||
directory: "/" | ||
# Check for updates to GitHub Actions every weekday | ||
schedule: | ||
interval: "daily" |
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,131 @@ | ||
name: release | ||
|
||
on: | ||
push: | ||
tags: | ||
- 'v*' | ||
|
||
jobs: | ||
build_sdist: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: actions/setup-python@v4 | ||
with: | ||
python-version: "3.12" | ||
|
||
- name: install dependencies | ||
run: | | ||
python -m pip install --upgrade pip | ||
pip install build twine | ||
- name: build source tarball | ||
run: | | ||
python -m build --sdist | ||
twine check --strict dist/* | ||
- uses: actions/upload-artifact@v3 | ||
with: | ||
path: dist/* | ||
|
||
build_wheels: | ||
name: wheel on ${{ matrix.os }} | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
# temporarily ignoring binary wheels for windows until pythran issues are fixed | ||
os: [ubuntu-latest, macos-latest] | ||
runs-on: ${{ matrix.os }} | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
# see https://github.com/pypa/cibuildwheel/issues/933 | ||
# - uses: pypa/cibuildwheel@v2 | ||
|
||
# Used to host cibuildwheel | ||
- uses: actions/setup-python@v4 | ||
with: | ||
python-version: "3.12" | ||
|
||
- name: install cibuildwheel | ||
run: python -m pip install | ||
|
||
- name: build wheels | ||
run: python -m cibuildwheel --output-dir wheelhouse | ||
|
||
- name: upload wheels | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
path: wheelhouse/*.whl | ||
|
||
publish_dev_build: | ||
needs: [build_sdist, build_wheels] | ||
runs-on: ubuntu-latest | ||
environment: | ||
name: testpypi | ||
url: https://pypi.org/p/detectree | ||
permissions: | ||
# IMPORTANT: this permission is mandatory for trusted publishing | ||
id-token: write | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- uses: actions/download-artifact@v3 | ||
with: | ||
name: artifact | ||
path: dist | ||
|
||
- name: publish to test pypi | ||
uses: pypa/gh-action-pypi-publish@release/v1 | ||
with: | ||
repository-url: https://test.pypi.org/legacy/ | ||
skip-existing: true | ||
|
||
release: | ||
needs: [publish_dev_build] | ||
runs-on: ubuntu-latest | ||
environment: | ||
name: pypi | ||
url: https://pypi.org/p/detectree | ||
permissions: | ||
# IMPORTANT: this permission is mandatory for trusted publishing | ||
id-token: write | ||
# see https://github.com/softprops/action-gh-release/issues/236 | ||
contents: write | ||
|
||
# Steps represent a sequence of tasks that will be executed as part of the job | ||
steps: | ||
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it | ||
- uses: actions/checkout@v4 | ||
|
||
- name: generate change log | ||
uses: heinrichreimer/[email protected] | ||
with: | ||
token: ${{ secrets.GITHUB_TOKEN }} | ||
issues: true | ||
issuesWoLabels: true | ||
pullRequests: true | ||
prWoLabels: true | ||
unreleased: true | ||
addSections: '{"documentation":{"prefix":"**Documentation:**","labels":["documentation"]}}' | ||
sinceTag: v0.1.0 | ||
output: RELEASE-CHANGELOG.md | ||
|
||
- uses: actions/download-artifact@v3 | ||
with: | ||
name: artifact | ||
path: dist | ||
|
||
- name: create github release | ||
uses: softprops/action-gh-release@v1 | ||
with: | ||
body_path: ./RELEASE-CHANGELOG.md | ||
files: dist/*.whl | ||
draft: false | ||
prerelease: false | ||
|
||
- name: publish 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,47 @@ | ||
name: tests | ||
|
||
on: | ||
pull_request: | ||
branches: | ||
- "*" | ||
|
||
jobs: | ||
test: | ||
strategy: | ||
matrix: | ||
os: [ubuntu-latest] | ||
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"] | ||
include: | ||
- os: macos-latest | ||
python-version: "3.12" | ||
- os: windows-latest | ||
python-version: "3.12" | ||
|
||
runs-on: ${{ matrix.os }} | ||
defaults: | ||
run: | ||
shell: bash -l {0} | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- uses: mamba-org/setup-micromamba@v1 | ||
with: | ||
environment-name: test-env | ||
create-args: >- | ||
python=${{ matrix.python-version }} | ||
pip | ||
- name: install dependencies | ||
run: pip install tox tox-gh-actions | ||
|
||
- name: test with tox | ||
run: tox | ||
env: | ||
CONDA_EXE: mamba | ||
|
||
- name: upload coverage reports to Codecov | ||
uses: codecov/codecov-action@v3 | ||
|
||
- name: list files | ||
run: ls -l . |
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,38 +1,55 @@ | ||
exclude: 'docs|node_modules|migrations|.tox' | ||
default_stages: [commit] | ||
fail_fast: true | ||
ci: | ||
autofix_commit_msg: "style(pre-commit.ci): auto fixes from pre-commit hooks" | ||
autoupdate_commit_msg: "style(pre-commit.ci): pre-commit autoupdate" | ||
|
||
repos: | ||
- repo: https://github.com/pre-commit/pre-commit-hooks | ||
rev: v4.3.0 | ||
rev: v4.5.0 | ||
hooks: | ||
- id: trailing-whitespace | ||
- id: end-of-file-fixer | ||
- id: check-yaml | ||
|
||
- repo: https://github.com/python-jsonschema/check-jsonschema | ||
rev: 0.18.2 | ||
- repo: https://github.com/commitizen-tools/commitizen | ||
rev: v3.15.0 | ||
hooks: | ||
- id: check-github-workflows | ||
- id: commitizen | ||
|
||
- repo: https://github.com/pre-commit/mirrors-prettier | ||
rev: v3.1.0 | ||
hooks: | ||
- id: prettier | ||
additional_dependencies: [prettier, prettier-plugin-toml, prettier-plugin-ini] | ||
types: ["ini", "toml", "yaml"] | ||
|
||
- repo: https://github.com/psf/black | ||
rev: 22.10.0 | ||
- repo: https://github.com/executablebooks/mdformat | ||
rev: 0.7.17 # Use the ref you want to point at | ||
hooks: | ||
- id: black | ||
- id: mdformat | ||
# Optionally add plugins | ||
additional_dependencies: | ||
- mdformat-gfm | ||
- mdformat-black | ||
|
||
- repo: https://github.com/timothycrosley/isort | ||
rev: 5.10.1 | ||
- repo: https://github.com/adrienverge/yamllint.git | ||
rev: v1.35.1 | ||
hooks: | ||
- id: isort | ||
- id: yamllint | ||
args: ["-d relaxed"] | ||
|
||
- repo: https://github.com/python-jsonschema/check-jsonschema | ||
rev: 0.28.0 | ||
hooks: | ||
- id: check-github-workflows | ||
|
||
- repo: https://gitlab.com/pycqa/flake8 | ||
rev: 5.0.4 | ||
- repo: https://github.com/asottile/pyupgrade | ||
rev: v3.15.0 | ||
hooks: | ||
- id: flake8 | ||
additional_dependencies: [flake8-isort] | ||
- id: pyupgrade | ||
|
||
- repo: https://github.com/pycqa/pydocstyle | ||
rev: 6.1.1 | ||
- repo: https://github.com/astral-sh/ruff-pre-commit | ||
rev: v0.2.2 | ||
hooks: | ||
- id: pydocstyle | ||
files: ^detectree | ||
- id: ruff | ||
args: [ --fix ] | ||
- id: ruff-format |
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,8 +1,11 @@ | ||
version: 2 | ||
|
||
build: | ||
os: ubuntu-22.04 | ||
tools: | ||
python: mambaforge-4.10 | ||
|
||
python: | ||
install: | ||
- requirements: requirements.txt | ||
- requirements: requirements-dev.txt | ||
- method: pip | ||
path: . | ||
install: | ||
- method: pip | ||
path: . |
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.