-
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.
Migrate to pyproject.toml and common workflows (#17)
* move to pyproject file * remove setup.py * using common workflows * update authors metadata as discussed * unnecessary lines
- Loading branch information
Showing
8 changed files
with
100 additions
and
277 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,30 +1,28 @@ | ||
# Continous Integration Workflows | ||
|
||
This package implements different workflows for CI. | ||
This package implements different workflows for CI, based on our organisation's common workflows. | ||
They are organised as follows. | ||
|
||
### Documentation | ||
|
||
The `documentation` workflow triggers on any push to master, builds the documentation and pushes it to the `gh-pages` branch (if the build is successful). | ||
It runs on `ubuntu-latest` and `Python 3.9`. | ||
|
||
### Testing Suite | ||
|
||
Tests are ensured in the `tests` workflow, which triggers on all pushes. | ||
It runs on a matrix of all supported operating systems (ubuntu-20.04, ubuntu-22.04, windows-latest and macos-latest) for all supported Python versions (currently `3.8`, `3.9`, `3.10` and `3.11`). | ||
It runs on a matrix of all supported operating systems for all supported Python versions. | ||
|
||
### Test Coverage | ||
|
||
Test coverage is calculated in the `coverage` wokflow, which triggers on pushes to `master` and any push to a `pull request`. | ||
It runs on `ubuntu-latest` & `Python 3.9`, and reports the coverage results of the test suite to `CodeClimate`, | ||
|
||
It reports the coverage results of the test suite to `CodeClimate`. | ||
|
||
### Regular Testing | ||
|
||
A `cron` workflow triggers every Monday at 3am (UTC time) and runs the full testing suite, on all available operating systems and supported Python versions. | ||
It also runs on `Python 3.x` so that newly released Python versions that would break tests are automatically detected. | ||
It also runs on `Python 3.x` so that newly released Python versions that would break tests are automatically included. | ||
|
||
### Publishing | ||
|
||
Publishing to `PyPI` is done through the `publish` workflow, which triggers anytime a `release` is made of the Github repository. | ||
Publishing to `PyPI` is done through the `publish` workflow, which triggers anytime a `release` is made of the GitHub repository. | ||
It builds a `wheel`, checks it, and pushes to `PyPI` if checks are successful. |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,39 +1,10 @@ | ||
# Runs all tests on master everyday at 10 am (UTC time) | ||
# Runs all tests on master on Mondays at 3 am (UTC time) | ||
name: Cron Testing | ||
|
||
defaults: | ||
run: | ||
shell: bash | ||
|
||
on: # Runs on master branch on Mondays at 3am UTC time | ||
on: | ||
schedule: | ||
- cron: '* 3 * * mon' | ||
|
||
jobs: | ||
tests: | ||
name: ${{ matrix.os }} / ${{ matrix.python-version }} | ||
runs-on: ${{ matrix.os }} | ||
strategy: | ||
matrix: | ||
os: [ubuntu-20.04, ubuntu-22.04, macos-latest, windows-latest] | ||
# Make sure to escape 3.10 with quotes so it doesn't get interpreted as float 3.1 by GA's parser | ||
python-version: [3.8, 3.9, "3.10", "3.11", 3.x] # crons should always run latest python hence 3.x | ||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
|
||
- name: Set up Python ${{ matrix.python-version }} | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: ${{ matrix.python-version }} | ||
cache: 'pip' | ||
cache-dependency-path: '**/setup.py' | ||
|
||
- name: Upgrade pip, setuptools and wheel | ||
run: python -m pip install --upgrade pip setuptools wheel | ||
|
||
- name: Install package | ||
run: python -m pip install '.[test]' | ||
|
||
- name: Run all tests | ||
run: python -m pytest | ||
tests: | ||
uses: pylhc/.github/.github/workflows/cron.yml@master |
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,47 +1,14 @@ | ||
# Build documentation | ||
# The build is uploaded as artifact if the triggering event is a push for a pull request | ||
# The build is published to github pages if the triggering event is a push to the master branch (PR merge) | ||
name: Build and upload documentation | ||
|
||
defaults: | ||
run: | ||
shell: bash | ||
|
||
on: # Runs on any push event to master | ||
on: # Runs on any push event in a PR or any push event to master | ||
pull_request: | ||
push: | ||
branches: | ||
- 'master' | ||
|
||
jobs: | ||
documentation: | ||
name: ${{ matrix.os }} / ${{ matrix.python-version }} | ||
runs-on: ${{ matrix.os }} | ||
strategy: | ||
matrix: | ||
os: [ubuntu-latest] | ||
python-version: [3.9] | ||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
|
||
- name: Set up Python ${{ matrix.python-version }} | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: ${{ matrix.python-version }} | ||
cache: 'pip' | ||
cache-dependency-path: '**/setup.py' | ||
|
||
- name: Upgrade pip, setuptools and wheel | ||
run: python -m pip install --upgrade pip setuptools wheel | ||
|
||
- name: Install package | ||
run: python -m pip install '.[doc]' | ||
|
||
- name: Build documentation | ||
run: python -m sphinx -b html doc ./doc_build -d ./doc_build | ||
|
||
- name: Upload documentation to gh-pages | ||
if: ${{ success() }} | ||
uses: JamesIves/github-pages-deploy-action@3.7.1 | ||
with: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
BRANCH: gh-pages | ||
FOLDER: doc_build | ||
uses: pylhc/.github/.github/workflows/documentation.yml@master |
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,46 +1,11 @@ | ||
# Publishes to PyPI upon creation of a release | ||
name: Upload Package to PyPI | ||
|
||
defaults: | ||
run: | ||
shell: bash | ||
|
||
on: # Runs everytime a release is added to the repository | ||
release: | ||
types: [created] | ||
|
||
jobs: | ||
deploy: | ||
name: ${{ matrix.os }} / ${{ matrix.python-version }} | ||
runs-on: ${{ matrix.os }} | ||
strategy: | ||
matrix: | ||
os: [ubuntu-latest] | ||
python-version: [3.9] | ||
|
||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
|
||
- name: Set up Python ${{ matrix.python-version }} | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: ${{ matrix.python-version }} | ||
cache: 'pip' | ||
cache-dependency-path: '**/setup.py' | ||
|
||
- name: Upgrade pip, setuptools, wheel, build and twine | ||
run: python -m pip install --upgrade pip setuptools wheel build twine | ||
|
||
- name: Build and check build | ||
run: | | ||
python -m build | ||
twine check dist/* | ||
- name: Publish | ||
if: ${{ success() }} | ||
env: | ||
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }} | ||
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }} | ||
run: | | ||
twine upload dist/* | ||
uses: pylhc/.github/.github/workflows/publish.yml@master | ||
secrets: inherit |
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,11 @@ | ||
# Runs all tests not flagged as "extended" with a pytest marker | ||
name: Tests | ||
|
||
defaults: | ||
run: | ||
shell: bash | ||
|
||
on: [push] # Runs on all push events to any branch | ||
# Runs all tests | ||
name: All Tests | ||
|
||
on: # Runs on any push event to any branch except master (the coverage workflow takes care of that) | ||
push: | ||
branches-ignore: | ||
- 'master' | ||
|
||
jobs: | ||
tests: | ||
name: ${{ matrix.os }} / ${{ matrix.python-version }} | ||
runs-on: ${{ matrix.os }} | ||
strategy: | ||
matrix: | ||
os: [ubuntu-20.04, ubuntu-22.04, macos-latest, windows-latest] | ||
# Make sure to escape 3.10 with quotes so it doesn't get interpreted as float 3.1 by GA's parser | ||
python-version: [3.8, 3.9, "3.10", "3.11"] | ||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
|
||
- name: Set up Python ${{ matrix.python-version }} | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: ${{ matrix.python-version }} | ||
cache: 'pip' | ||
cache-dependency-path: '**/setup.py' | ||
|
||
- name: Upgrade pip, setuptools and wheel | ||
run: python -m pip install --upgrade pip setuptools wheel | ||
|
||
- name: Install package | ||
run: python -m pip install '.[test]' | ||
|
||
- name: Run basic tests | ||
run: python -m pytest | ||
uses: pylhc/.github/.github/workflows/tests.yml@master |
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,73 @@ | ||
[build-system] | ||
requires = ["hatchling"] | ||
build-backend = "hatchling.build" | ||
|
||
[tool.hatch.version] | ||
path = "turn_by_turn/__init__.py" | ||
|
||
[tool.hatch.build.targets.sdist] | ||
exclude = [ | ||
"/.github", | ||
"/doc", | ||
"/tests", | ||
] | ||
|
||
[tool.hatch.build.targets.wheel] | ||
packages = ["turn_by_turn"] | ||
|
||
[project] | ||
name = "tfs-turn_by_turn" | ||
readme = "README.md" | ||
description = "Read and write turn-by-turn measurement files from different particle accelerator formats." | ||
authors = [ | ||
{name = "OMC Team", email = "pylhc@github.com"}, # see zenodo file / commits for details | ||
] | ||
license = "MIT" | ||
dynamic = ["version"] | ||
requires-python = ">=3.9" | ||
|
||
classifiers = [ | ||
"Development Status :: 5 - Production/Stable", | ||
"Intended Audience :: Science/Research", | ||
"License :: OSI Approved :: MIT License", | ||
"Natural Language :: English", | ||
"Operating System :: OS Independent", | ||
"Programming Language :: Python :: 3 :: Only", | ||
"Programming Language :: Python :: 3.9", | ||
"Programming Language :: Python :: 3.10", | ||
"Programming Language :: Python :: 3.11", | ||
"Programming Language :: Python :: 3.12", | ||
"Programming Language :: Python :: Implementation :: CPython", | ||
"Topic :: Scientific/Engineering", | ||
"Topic :: Software Development :: Libraries :: Python Modules", | ||
"Typing :: Typed", | ||
] | ||
|
||
dependencies = [ | ||
"numpy >= 1.24", | ||
"scipy >= 1.5", | ||
"pandas >= 2.1", | ||
"sdds >= 0.4", | ||
"h5py >= 2.9", | ||
] | ||
|
||
[project.optional-dependencies] | ||
test = [ | ||
"pytest>=7.0", | ||
"pytest-cov>=2.9", | ||
] | ||
doc = [ | ||
"sphinx >= 7.0", | ||
"sphinx_rtd_theme >= 2.0", | ||
] | ||
|
||
all = [ | ||
"turn_by_turn[test]", | ||
"turn_by_turn[doc]", | ||
] | ||
|
||
[project.urls] | ||
homepage = "https://github.com/pylhc/turn_by_turn" | ||
repository = "https://github.com/pylhc/turn_by_turn" | ||
documentation = "https://pylhc.github.io/turn_by_turn/" | ||
# changelog = "https://github.com/pylhc/turn_by_turn/blob/master/CHANGELOG.md" |
Oops, something went wrong.