Skip to content

Commit ec7db7b

Browse files
committed
Add CI pipeline and code coverage
1 parent 6ee0dc4 commit ec7db7b

2 files changed

Lines changed: 48 additions & 0 deletions

File tree

.github/workflows/build.yml

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
# Builds the python environment; linter and formatting via ruff; type annotations via pyright;
2+
# tests via pytest; reports test coverage via pytest-cov.
3+
4+
name: build
5+
on:
6+
push:
7+
branches: ['*']
8+
pull_request:
9+
workflow_dispatch:
10+
11+
jobs:
12+
build_run_tests:
13+
name: Build env using pip and pyproject.toml on ${{ matrix.os }}
14+
runs-on: ${{ matrix.os }}
15+
if: github.event.pull_request.draft == false
16+
strategy:
17+
matrix:
18+
os: [ubuntu-latest, windows-latest, macos-latest]
19+
python-version: [3.9, 3.11]
20+
fail-fast: false
21+
defaults:
22+
run:
23+
shell: ${{ matrix.os == 'windows-latest' && 'cmd' || 'bash' }} -l {0} # Adjust shell based on OS
24+
steps:
25+
- name: Checkout
26+
uses: actions/checkout@v4
27+
- name: Setup Python
28+
uses: actions/setup-python@v5
29+
with:
30+
python-version: ${{ matrix.python-version }}
31+
- name: Create venv and install dependencies
32+
run: |
33+
python -m venv .venv
34+
.venv/Scripts/activate || source .venv/bin/activate
35+
pip install -e .[dev]
36+
- name: Activate venv for later steps
37+
run: |
38+
echo "VIRTUAL_ENV=$(pwd)/.venv" >> $GITHUB_ENV
39+
echo "$(pwd)/.venv/bin" >> $GITHUB_PATH # For Unix-like systems
40+
echo "$(pwd)/.venv/Scripts" >> $GITHUB_PATH # For Windows
41+
42+
- name: ruff
43+
run: ruff check .
44+
- name: pyright
45+
run: pyright .
46+
- name: pytest
47+
run: pytest --cov harp

pyproject.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ dev = [
3333
"datamodel-code-generator",
3434
"pandas-stubs",
3535
"pytest",
36+
"pytest-cov",
3637
"pyright",
3738
"ruff",
3839
"codespell"

0 commit comments

Comments
 (0)