Skip to content

Commit 9669be4

Browse files
committed
add workflows
1 parent 27e7777 commit 9669be4

File tree

4 files changed

+161
-0
lines changed

4 files changed

+161
-0
lines changed

.github/workflows/linting.yml

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
name: linting
2+
3+
# Triggers the workflow on push for all branches
4+
on:
5+
push:
6+
7+
jobs:
8+
lint:
9+
runs-on: ubuntu-latest
10+
steps:
11+
# Check out repo and set up Python
12+
- uses: actions/checkout@v4
13+
with:
14+
fetch-depth: 0
15+
16+
# Setup python
17+
18+
- name: Install uv and set the python version to 3.12
19+
uses: astral-sh/setup-uv@v5
20+
with:
21+
python-version: 3.12
22+
23+
- name: Install package and dev dependencies
24+
run: |
25+
uv pip install ".[dev]"
26+
27+
# Linting steps, execute all linters even if one fails
28+
- name: ruff check
29+
run:
30+
ruff check src/mpes_tools tests
31+
- name: ruff formatting
32+
if: ${{ always() }}
33+
run:
34+
ruff format --check src/mpes_tools tests
35+
- name: mypy
36+
if: ${{ always() }}
37+
run:
38+
mypy src/mpes_tools tests
39+
- name: spellcheck
40+
if: ${{ always() }}
41+
uses: streetsidesoftware/cspell-action@v6
42+
with:
43+
check_dot_files: false
44+
incremental_files_only: false
45+
config: './cspell.json'

.github/workflows/release.yml

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
name: Upload Python Package
2+
3+
# Workflow runs a release job on every published tag.
4+
# The package is distributed as sed-processor
5+
on:
6+
release:
7+
types: [published]
8+
9+
env:
10+
python-version: 3.12
11+
12+
jobs:
13+
release:
14+
name: Upload release to PyPI
15+
runs-on: ubuntu-latest
16+
environment:
17+
name: testpypi
18+
# url: https://pypi.org/p/mpes-tools
19+
url: https://test.pypi.org/p/mpes-tools
20+
permissions:
21+
id-token: write
22+
23+
steps:
24+
- uses: actions/checkout@v4
25+
with:
26+
fetch-depth: 0
27+
28+
- name: Install uv and set the python version to ${{ env.python-version }}
29+
uses: astral-sh/setup-uv@v5
30+
with:
31+
python-version: ${{ env.python-version }}
32+
33+
- name: Build package
34+
run: uv build
35+
36+
- name: Publish package distributions to PyPI
37+
uses: pypa/gh-action-pypi-publish@release/v1
38+
with:
39+
verbose: true
40+
repository-url: https://test.pypi.org/legacy/
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
name: pytest and coverage report
2+
3+
# Triggers the workflow on push for all branches and PR only for main
4+
on:
5+
push:
6+
branches: [ main ]
7+
pull_request:
8+
branches: [ main ]
9+
10+
jobs:
11+
pytest:
12+
runs-on: ubuntu-latest
13+
steps:
14+
# Check out repo and set up Python
15+
- uses: actions/checkout@v4
16+
with:
17+
fetch-depth: 0
18+
19+
# Setup python
20+
- name: Install uv and set the python version to 3.12
21+
uses: astral-sh/setup-uv@v5
22+
with:
23+
python-version: 3.12
24+
25+
- name: Install package
26+
run: |
27+
uv pip install -e ".[dev]"
28+
29+
# Run pytest with coverage report, saving to xml
30+
- name: Run tests on python 3.12
31+
run: |
32+
pytest --cov --cov-report xml:cobertura.xml --full-trace --show-capture=no -sv -n auto tests/
33+
34+
# Take report and upload to coveralls
35+
- name: Coveralls
36+
uses: coverallsapp/github-action@v2
37+
with:
38+
github-token: ${{ secrets.GITHUB_TOKEN }}
39+
file: ./cobertura.xml
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
# Tests for all supported versions [Python 3.9|3.10|3.11|3.12]
2+
name: Unit Tests
3+
4+
on:
5+
schedule:
6+
- cron: '0 1 * * 1'
7+
workflow_dispatch:
8+
push:
9+
branches: [ main ]
10+
11+
jobs:
12+
pytest:
13+
runs-on: ubuntu-latest
14+
# Using matrix strategy
15+
strategy:
16+
fail-fast: false
17+
matrix:
18+
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"]
19+
20+
steps:
21+
# Check out repo and set up Python
22+
- uses: actions/checkout@v4
23+
with:
24+
fetch-depth: 0
25+
26+
- name: Install uv and set the python version to ${{ matrix.python-version }}
27+
uses: astral-sh/setup-uv@v5
28+
with:
29+
python-version: ${{ matrix.python-version }}
30+
31+
- name: Install package and test dependencies
32+
run: |
33+
uv pip install ".[dev]"
34+
35+
- name: Run tests on python ${{matrix.python-version}}
36+
run: |
37+
pytest --full-trace --show-capture=no -sv -n auto tests/

0 commit comments

Comments
 (0)