Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
56 changes: 27 additions & 29 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,44 +3,42 @@ name: build
on:
release:
types:
- published
- released
pull_request:

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

defaults:
run:
shell: bash -leo pipefail {0}

jobs:
build:
name: build package
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@main
- uses: actions/setup-python@main
with:
python-version: '3.x'
- uses: actions/cache@main
with:
path: ${{ env.pythonLocation }}
key: build-${{ runner.os }}-${{ env.pythonLocation }}-${{ hashFiles('pyproject.toml', 'setup.*') }}
- run: pip wheel . --no-deps -w dist
- uses: actions/upload-artifact@main
with:
name: package
path: dist/
publish:
name: publish package
needs: [ build ]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@main
- uses: actions/setup-python@main
with:
python-version: '3.x'
- uses: actions/cache@main
- uses: mamba-org/setup-micromamba@v1
with:
path: ${{ env.pythonLocation }}
key: build-${{ runner.os }}-${{ env.pythonLocation }}-${{ hashFiles('pyproject.toml', 'setup.*') }}
- uses: actions/download-artifact@main
condarc: |
channels:
- conda-forge
environment-name: build
create-args: >-
build
cache-downloads: true
cache-environment: true
init-shell: >-
bash
- uses: actions/checkout@v4
- run: python -m build
- uses: actions/upload-artifact@v4
with:
name: package
name: stormevents
path: dist/
- uses: pypa/gh-action-pypi-publish@master
- if: github.event_name == 'release' && github.event.action == 'released'
uses: pypa/gh-action-pypi-publish@v1.8.11
with:
user: __token__
password: ${{ secrets.PYPI_TOKEN }}
92 changes: 53 additions & 39 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,64 +14,78 @@ on:
- '.github/workflows/test*.yml'
- 'pyproject.toml'

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

defaults:
run:
shell: bash -leo pipefail {0}

jobs:
style:
name: check code style
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@main
- uses: actions/setup-python@main
with:
python-version: '3.x'
- uses: actions/cache@main
id: cache
- uses: mamba-org/setup-micromamba@v1
with:
path: ${{ env.pythonLocation }}
key: style-${{ runner.os }}-${{ env.pythonLocation }}-${{ hashFiles('pyproject.toml', 'setup.*') }}
- run: pip install flake8 black
# stop the build if there are Python syntax errors or undefined names
- run: flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
- run: flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
- run: black . --check
condarc: |
channels:
- conda-forge
environment-name: style
create-args: >-
ruff
cache-downloads: true
cache-environment: true
init-shell: >-
bash
- uses: actions/checkout@v4
- run: ruff check .
test:
needs: [ style ]
name: test Python ${{ matrix.python }} on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ ubuntu-latest, macos-latest ]
python: [ '3.9', '3.10' ]
steps:
- uses: actions/checkout@main
- uses: actions/setup-python@main
- uses: mamba-org/setup-micromamba@v1
with:
python-version: ${{ matrix.python }}
- uses: actions/cache@main
id: cache
with:
path: ${{ env.pythonLocation }}
key: test-${{ runner.os }}-${{ env.pythonLocation }}-${{ hashFiles('pyproject.toml', 'setup.*') }}
- run: pip install ".[test]" pytest-xdist
- run: pytest -n auto
condarc: |
channels:
- conda-forge
environment-name: test
create-args: >-
python=${{ matrix.python }}
pytest-xdist
cache-downloads: true
cache-environment: true
init-shell: >-
bash
- uses: actions/checkout@v4
- run: pip install ".[test]"
- run: pytest -n auto --verbose
test_with_coverage:
needs: [ style, test ]
name: test with code coverage
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@main
- uses: actions/setup-python@main
with:
python-version: '3.x'
- uses: actions/cache@main
id: cache
- uses: mamba-org/setup-micromamba@v1
with:
path: ${{ env.pythonLocation }}
key: test-${{ runner.os }}-${{ env.pythonLocation }}-${{ hashFiles('pyproject.toml', 'setup.*') }}
- run: pip install ".[test]" pytest-cov pytest-xdist
- run: pytest --cov . --cov-report xml:coverage.xml
- run: coverage report -m
- uses: codecov/codecov-action@main
condarc: |
channels:
- conda-forge
environment-name: coverage
create-args: >-
python=${{ matrix.python }}
pytest-xdist
pytest-cov
cache-downloads: true
cache-environment: true
init-shell: >-
bash
- uses: actions/checkout@v4
- run: pip install ".[test]"
- run: pytest --cov . --cov-report xml:coverage.xml --cov-report term-missing -n auto --verbose
- uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: coverage.xml
Expand Down
47 changes: 0 additions & 47 deletions .github/workflows/test_quick.yml

This file was deleted.

3 changes: 1 addition & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,7 @@ dependencies = [
dynamic = ["version"]

[project.optional-dependencies]
test = ['pytest', 'pytest-cov', 'pytest-socket', 'pytest-xdist']
style = ['black', 'reorder-python-imports']
test = ['pytest', 'pytest-socket']
docs = ['dunamai', 'm2r2', 'sphinx<7', 'sphinx-rtd-theme', 'toml']

[project.urls]
Expand Down