Skip to content

Commit f836f8e

Browse files
committed
Add GitHub Actions and Codecov
1 parent 41b1baf commit f836f8e

File tree

3 files changed

+89
-3
lines changed

3 files changed

+89
-3
lines changed

.github/workflows/ci.yaml

Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches:
6+
- dev
7+
- master
8+
pull_request: ~
9+
10+
jobs:
11+
lint:
12+
name: "Check style and lint"
13+
runs-on: ubuntu-latest
14+
steps:
15+
- uses: actions/checkout@v4
16+
- name: Set up Python
17+
uses: actions/setup-python@v5
18+
with:
19+
python-version: "3.12"
20+
- uses: actions/cache@v4
21+
with:
22+
path: ${{ env.pythonLocation }}
23+
key: ${{ env.pythonLocation }}-${{ hashFiles('requirements.txt') }}-${{ hashFiles('test-requirements.txt') }}
24+
- name: Install dependencies
25+
run: |
26+
python -m pip install --upgrade pip
27+
pip install -r requirements.txt -r test-requirements.txt --upgrade --upgrade-strategy eager
28+
- name: Check isort
29+
run: isort tests pyheos --check-only
30+
- name: Check black
31+
run: black tests pyheos --check --fast --quiet
32+
- name: Check pylint
33+
run: pylint tests pyheos
34+
- name: Check flake8
35+
run: flake8 tests pyheos --doctests
36+
37+
tests:
38+
name: "Run tests on ${{ matrix.python-version }}"
39+
runs-on: ubuntu-latest
40+
needs: lint
41+
strategy:
42+
matrix:
43+
python-version: ["3.11", "3.12"]
44+
steps:
45+
- uses: actions/checkout@v4
46+
- name: Set up Python
47+
uses: actions/setup-python@v5
48+
with:
49+
python-version: ${{ matrix.python-version }}
50+
- uses: actions/cache@v4
51+
with:
52+
path: ${{ env.pythonLocation }}
53+
key: ${{ env.pythonLocation }}-${{ hashFiles('requirements.txt') }}-${{ hashFiles('test-requirements.txt') }}
54+
- name: Install dependencies
55+
run: |
56+
python -m pip install --upgrade pip
57+
pip install -r requirements.txt -r test-requirements.txt --upgrade --upgrade-strategy eager
58+
- name: Run pytest on ${{ matrix.python-version }}
59+
run: pytest
60+
61+
coverage:
62+
name: "Check code coverage"
63+
runs-on: ubuntu-latest
64+
needs: lint
65+
steps:
66+
- uses: actions/checkout@v4
67+
- name: Set up Python
68+
uses: actions/setup-python@v5
69+
with:
70+
python-version: "3.12"
71+
- uses: actions/cache@v4
72+
with:
73+
path: ${{ env.pythonLocation }}
74+
key: ${{ env.pythonLocation }}-${{ hashFiles('requirements.txt') }}-${{ hashFiles('test-requirements.txt') }}
75+
- name: Install dependencies
76+
run: |
77+
python -m pip install --upgrade pip
78+
pip install -r requirements.txt -r test-requirements.txt --upgrade --upgrade-strategy eager
79+
- name: Run pytest on ${{ matrix.python-version }}
80+
run: pytest --cov=./ --cov-report=xml
81+
- name: Upload coverage reports to Codecov
82+
uses: codecov/codecov-action@v4.0.1
83+
with:
84+
token: ${{ secrets.CODECOV_TOKEN }}
85+
fail_ci_if_error: true

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# pyheos
2-
[![Build Status](https://travis-ci.org/andrewsayre/pyheos.svg?branch=master)](https://travis-ci.org/andrewsayre/pyheos)
3-
[![Coverage Status](https://coveralls.io/repos/github/andrewsayre/pyheos/badge.svg?branch=master)](https://coveralls.io/github/andrewsayre/pyheos?branch=master)
2+
[![CI Status](https://github.com/andrewsayre/pyheos/workflows/CI/badge.svg)](https://github.com/andrewsayre/pyheos/actions)
3+
[![codecov](https://codecov.io/github/andrewsayre/pyheos/graph/badge.svg?token=PV4P3AN7Z1)](https://codecov.io/github/andrewsayre/pyheos)
44
[![image](https://img.shields.io/pypi/v/pyheos.svg)](https://pypi.org/project/pyheos/)
55
[![image](https://img.shields.io/pypi/pyversions/pyheos.svg)](https://pypi.org/project/pyheos/)
66
[![image](https://img.shields.io/pypi/l/pyheos.svg)](https://pypi.org/project/pyheos/)

pytest.ini

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
[pytest]
22
log_level=DEBUG
33
testpaths = tests
4-
norecursedirs = .git
4+
norecursedirs = .git
5+
timeout = 30

0 commit comments

Comments
 (0)