Skip to content

Commit 4efa95c

Browse files
committed
Add github workflow for continuous testing
1 parent 8792488 commit 4efa95c

File tree

1 file changed

+69
-0
lines changed

1 file changed

+69
-0
lines changed
Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
# Tests with pytest the package and monitors the coverage and sends it to coveralls.io
2+
# Coverage is only send to coveralls.io when no pytest tests fail
3+
name: "Tests & Coverage"
4+
5+
on: [push]
6+
7+
# Cancel jobs on new push
8+
concurrency:
9+
group: ${{ github.workflow }}-${{ github.ref || github.run_id }}
10+
cancel-in-progress: true
11+
12+
jobs:
13+
build:
14+
name: "${{ matrix.name-suffix }} at py${{ matrix.python-version }} on ${{ matrix.os }}"
15+
runs-on: ${{ matrix.os }}
16+
17+
strategy:
18+
fail-fast: false
19+
matrix:
20+
include:
21+
- name-suffix: "coverage"
22+
os: ubuntu-latest
23+
python-version: 3.11
24+
- name-suffix: "basic"
25+
os: ubuntu-latest
26+
python-version: 3.10
27+
- name-suffix: "basic"
28+
os: ubuntu-latest
29+
python-version: 3.12
30+
- name-suffix: "basic"
31+
os: windows-latest
32+
python-version: 3.11
33+
34+
steps:
35+
- name: Checkout repo
36+
uses: actions/checkout@v3
37+
38+
- name: Set up Python
39+
uses: actions/setup-python@v4
40+
with:
41+
python-version: ${{ matrix.python-version }}
42+
43+
- name: Install dependencies (Linux)
44+
if: runner.os == 'Linux'
45+
run: |
46+
python -m pip install --upgrade pip wheel setuptools
47+
pip install .[dev]
48+
49+
- name: Install dependencies (Windows)
50+
if: runner.os == 'Windows'
51+
uses: conda-incubator/setup-miniconda@v2
52+
run:
53+
conda create -n testenv python=${{ matrix.python }}
54+
conda activate testenv
55+
python -m pip install .[dev]
56+
57+
- name: Run tests
58+
if: ${{ !(runner.os == 'Linux' && matrix.python-version == 3.9 && matrix.name-suffix == 'coverage') }}
59+
run: |
60+
python -m pytest --disable-warnings --color=yes -v
61+
62+
- name: Run tests, coverage and send to coveralls
63+
if: runner.os == 'Linux' && matrix.python-version == 3.9 && matrix.name-suffix == 'coverage'
64+
run: |
65+
coverage run --source=windpowerlib -m pytest --disable-warnings --color=yes -v
66+
coveralls
67+
env:
68+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
69+
COVERALLS_SERVICE_NAME: github

0 commit comments

Comments
 (0)