Skip to content

Commit 9aa42d5

Browse files
committed
workflows
1 parent e929ba9 commit 9aa42d5

File tree

2 files changed

+150
-0
lines changed

2 files changed

+150
-0
lines changed

.github/workflows/publish-pypi.yml

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
name: Publish to PyPI
2+
3+
on:
4+
release:
5+
types: [published]
6+
workflow_dispatch: # Allow manual trigger
7+
8+
jobs:
9+
build:
10+
name: Build distribution
11+
runs-on: ubuntu-latest
12+
steps:
13+
- uses: actions/checkout@v4
14+
15+
- name: Set up Python
16+
uses: actions/setup-python@v5
17+
with:
18+
python-version: "3.11"
19+
20+
- name: Install build dependencies
21+
run: |
22+
python -m pip install --upgrade pip
23+
pip install build
24+
25+
- name: Build package
26+
run: python -m build
27+
28+
- name: Store the distribution packages
29+
uses: actions/upload-artifact@v4
30+
with:
31+
name: python-package-distributions
32+
path: dist/
33+
34+
publish-to-pypi:
35+
name: Publish to PyPI
36+
needs: [build]
37+
runs-on: ubuntu-latest
38+
environment:
39+
name: pypi
40+
url: https://pypi.org/p/votuderep
41+
permissions:
42+
id-token: write # IMPORTANT: mandatory for trusted publishing
43+
44+
steps:
45+
- name: Download all the dists
46+
uses: actions/download-artifact@v4
47+
with:
48+
name: python-package-distributions
49+
path: dist/
50+
51+
- name: Publish distribution to PyPI
52+
uses: pypa/gh-action-pypi-publish@release/v1

.github/workflows/test.yml

Lines changed: 98 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,98 @@
1+
name: Test
2+
3+
on:
4+
push:
5+
branches: [ main, master, develop ]
6+
pull_request:
7+
branches: [ main, master, develop ]
8+
workflow_dispatch:
9+
10+
jobs:
11+
lint:
12+
name: Lint
13+
runs-on: ubuntu-latest
14+
steps:
15+
- uses: actions/checkout@v4
16+
17+
- name: Set up Python
18+
uses: actions/setup-python@v5
19+
with:
20+
python-version: "3.11"
21+
cache: 'pip'
22+
23+
- name: Install dependencies
24+
run: |
25+
python -m pip install --upgrade pip
26+
pip install black ruff
27+
28+
- name: Check formatting with black
29+
run: black --check src/ tests/
30+
31+
- name: Lint with ruff
32+
run: ruff check src/ tests/
33+
34+
test:
35+
name: Test Python ${{ matrix.python-version }} on ${{ matrix.os }}
36+
runs-on: ${{ matrix.os }}
37+
strategy:
38+
fail-fast: false
39+
matrix:
40+
os: [ubuntu-latest, macos-latest]
41+
python-version: ["3.10", "3.11", "3.12"]
42+
43+
steps:
44+
- uses: actions/checkout@v4
45+
46+
- name: Set up Python ${{ matrix.python-version }}
47+
uses: actions/setup-python@v5
48+
with:
49+
python-version: ${{ matrix.python-version }}
50+
cache: 'pip'
51+
52+
- name: Install BLAST+ (Ubuntu)
53+
if: runner.os == 'Linux'
54+
run: |
55+
sudo apt-get update
56+
sudo apt-get install -y ncbi-blast+
57+
blastn -version
58+
59+
- name: Install BLAST+ (macOS)
60+
if: runner.os == 'macOS'
61+
run: |
62+
brew install blast
63+
blastn -version
64+
65+
- name: Install package and dependencies
66+
run: |
67+
python -m pip install --upgrade pip
68+
pip install -e ".[dev]"
69+
70+
- name: Run tests with coverage
71+
run: |
72+
pytest --cov=votuderep --cov-report=xml --cov-report=term
73+
74+
- name: Upload coverage to Codecov
75+
if: matrix.os == 'ubuntu-latest' && matrix.python-version == '3.11'
76+
uses: codecov/codecov-action@v4
77+
with:
78+
file: ./coverage.xml
79+
fail_ci_if_error: false
80+
verbose: true
81+
82+
test-install:
83+
name: Test installation
84+
runs-on: ubuntu-latest
85+
steps:
86+
- uses: actions/checkout@v4
87+
88+
- name: Set up Python
89+
uses: actions/setup-python@v5
90+
with:
91+
python-version: "3.11"
92+
93+
- name: Test installation
94+
run: |
95+
python -m pip install --upgrade pip
96+
pip install .
97+
votuderep --version
98+
votuderep --help

0 commit comments

Comments
 (0)