Skip to content

Commit

Permalink
remove Makefile, add pypi trusted publishing
Browse files Browse the repository at this point in the history
  • Loading branch information
sappelhoff committed Nov 23, 2024
1 parent 0ec570f commit 5c82c52
Show file tree
Hide file tree
Showing 7 changed files with 71 additions and 72 deletions.
10 changes: 2 additions & 8 deletions .github/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,21 +34,15 @@ See https://pre-commit.com/ for more information.
## Running tests and coverage

If you have followed the steps to get the development version,
you can run tests by making use of the `Makefile` and
[GNU Make](https://www.gnu.org/software/make/).
you can run tests as follows.
From the project root, call:

- `make test` to run tests and coverage
- `pytest` to run tests and coverage
- `pre-commit run -a` to run style checks (Ruff and some additional hooks)

## Building the documentation

The documentation can be built using [Sphinx](https://www.sphinx-doc.org).
Again, assuming that you followed the steps to get the development version,
you can use the `Makefile`.
From the project root, call:

- `make build-doc` to build the documentation and open a browser window to view it

The publicly accessible documentation is built and hosted by
[Read the Docs](https://readthedocs.org/).
Expand Down
31 changes: 0 additions & 31 deletions .github/workflows/python_publish.yml

This file was deleted.

9 changes: 5 additions & 4 deletions .github/workflows/python_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -71,16 +71,17 @@ jobs:
- name: Check formatting
if: matrix.platform == 'ubuntu-latest'
run: |
make check-manifest
check-manifest
pre-commit run --all-files
- name: Test with pytest
run: |
make test
# Options defined in pyproject.toml
run: pytest

- name: Build docs
run: |
make build-doc
make -C docs/ clean
make -C docs/ html
- name: Upload artifacts
if: ${{ matrix.platform == 'ubuntu-latest' && matrix.python-version == '3.12' && matrix.mne-version == 'mne-stable'}}
Expand Down
52 changes: 52 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
# Upload a Python Package using Twine when a release is created

name: release
on: # yamllint disable-line rule:truthy
release:
types: [published]
push:
branches:
- main
pull_request:
branches:
- main

permissions:
contents: read

jobs:
package:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.12'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install --upgrade setuptools wheel build twine
- run: python -m build --sdist --wheel
- run: twine check --strict dist/*
- uses: actions/upload-artifact@v4
with:
name: dist
path: dist
include-hidden-files: true

pypi-upload:
needs: package
runs-on: ubuntu-latest
if: github.event_name == 'release'
permissions:
id-token: write # for trusted publishing
environment:
name: pypi
url: https://pypi.org/p/pybv
steps:
- uses: actions/download-artifact@v4
with:
name: dist
path: dist
- uses: pypa/gh-action-pypi-publish@release/v1
if: github.event_name == 'release'
1 change: 0 additions & 1 deletion MANIFEST.in
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,4 @@ exclude .readthedocs.yaml
exclude .git-blame-ignore-revs
exclude .pre-commit-config.yaml
exclude .gitignore
exclude Makefile
global-exclude *.pyc
28 changes: 0 additions & 28 deletions Makefile

This file was deleted.

12 changes: 12 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,18 @@ Documentation = "https://pybv.readthedocs.io"
Issues = "https://github.com/bids-standard/pybv/issues"
Repository = "https://github.com/bids-standard/pybv"

[tool.coverage.report]
# Regexes for lines to exclude from consideration
exclude_lines = ["if 0:", "if __name__ == .__main__.:", "pragma: no cover"]

[tool.coverage.run]
omit = ["*tests*"]

[tool.pytest.ini_options]
addopts = """. --doctest-modules --cov=pybv/ --cov-report=xml --cov-config=pyproject.toml --verbose -s"""
filterwarnings = [
]

[tool.ruff.lint]
ignore = ["D203", "D213"]
select = ["A", "B006", "D", "E", "F", "I", "UP", "W"]
Expand Down

0 comments on commit 5c82c52

Please sign in to comment.