Skip to content

Commit

Permalink
Update GitHub Actions
Browse files Browse the repository at this point in the history
  • Loading branch information
bittremieux committed Apr 21, 2024
1 parent 40151e2 commit 610e395
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 43 deletions.
26 changes: 12 additions & 14 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,9 @@ name: Lint

on:
push:
branches:
- main
- dev
branches: [ main, dev ]
pull_request:
branches:
- main
- dev
branches: [ main, dev ]

jobs:
lint:
Expand All @@ -20,13 +16,15 @@ jobs:
with:
python-version: "3.12"

- name: Lint with black
uses: psf/black@stable
- name: Install Ruff
run: |
python -m pip install --upgrade pip
pip install ruff
- name: Lint with Ruff
run: |
ruff check . --output-format=github
- name: Check for debugging print statements
- name: Check formatting with Ruff
run: |
if grep -rq "print(" spectrum_utils; then
echo "Found the following print statements:"
grep -r "print(" spectrum_utils
exit 1
fi
ruff format --check .
7 changes: 2 additions & 5 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,8 @@
# This workflows will upload a Python Package using Twine when a release is created.
# For more information see: https://help.github.com/en/actions/language-and-framework-guides/using-python-with-github-actions#publishing-to-package-registries

name: PyPI
name: Publish to PyPI

on:
release:
types: [created]
types: [ created ]

jobs:
deploy:
Expand Down
35 changes: 11 additions & 24 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -1,17 +1,10 @@
# This workflow will install Python dependencies, run tests and lint with a single version of Python
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions

name: tests
name: Run tests

on:
push:
branches:
- main
- dev
branches: [ main, dev ]
pull_request:
branches:
- main
- dev
branches: [ main, dev ]
schedule:
- cron: "0 0 1 1/1 *" # Run monthly.

Expand All @@ -20,8 +13,8 @@ jobs:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
os: [ ubuntu-latest, windows-latest, macos-latest ]
python-version: [ "3.10", "3.11", "3.12" ]

steps:
- uses: actions/checkout@v4
Expand All @@ -32,21 +25,15 @@ jobs:

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install flake8 pytest pytest-cov wheel
pip install -e .
- name: Lint with flake8
run: |
# Stop the build if there are Python syntax errors or undefined names.
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
# exit-zero treats all errors as warnings.
# The GitHub editor is 127 chars wide
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
pip install uv
uv pip install pytest pytest-cov wheel --system
uv pip install -e . --system
- name: Run unit and system tests
run: |
pytest --cov=spectrum_utils tests/
pytest --cov=spectrum_utils --verbose tests/
- name: Upload coverage to codecov
uses: codecov/codecov-action@v3
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
fail_ci_if_error: true
verbose: true

0 comments on commit 610e395

Please sign in to comment.