Skip to content

Commit 99f146f

Browse files
authored
Merge pull request #102 from python-hydro/pytest-action
convert flake8 and pytest to github actions
2 parents b0ca4aa + 76d3567 commit 99f146f

2 files changed

Lines changed: 78 additions & 46 deletions

File tree

Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
name: pytest-all
2+
3+
on:
4+
# Trigger the workflow on push or pull request,
5+
# but only for the main branch
6+
push:
7+
branches:
8+
- main
9+
pull_request:
10+
branches:
11+
- main
12+
13+
jobs:
14+
flake-8:
15+
runs-on: ubuntu-latest
16+
17+
steps:
18+
- uses: actions/checkout@v2
19+
20+
- name: Install Python
21+
uses: actions/setup-python@v2
22+
with:
23+
python-version: '3.x'
24+
25+
- name: Cache pip
26+
uses: actions/cache@v2
27+
with:
28+
# this path is specific to Ubuntu
29+
path: ~/.cache/pip
30+
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}
31+
restore-keys: |
32+
${{ runner.os }}-pip-
33+
34+
- name: Install dependencies
35+
run: |
36+
python -m pip install --upgrade pip
37+
pip install -r requirements.txt
38+
39+
- name: Install pynucastro
40+
run: python setup.py install --user
41+
42+
- name: Run flake8
43+
run: flake8 .
44+
45+
pytest:
46+
runs-on: ubuntu-latest
47+
48+
strategy:
49+
matrix:
50+
python-version: [3.7, 3.8, 3.9]
51+
52+
steps:
53+
- uses: actions/checkout@v2
54+
55+
- name: Install Python ${{ matrix.python-version }}
56+
uses: actions/setup-python@v2
57+
with:
58+
python-version: ${{ matrix.python-version }}
59+
60+
- name: Cache pip
61+
uses: actions/cache@v2
62+
with:
63+
# this path is specific to Ubuntu
64+
path: ~/.cache/pip
65+
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}
66+
restore-keys: |
67+
${{ runner.os }}-pip-
68+
69+
- name: Install dependencies
70+
run: |
71+
python -m pip install --upgrade pip
72+
pip install -r requirements.txt
73+
74+
- name: Install pynucastro
75+
run: python setup.py install --user
76+
77+
- name: Run tests with pytest
78+
run: PYTHONPATH=$GITHUB_WORKSPACE pytest -v --cov=. --cov-config .coveragerc --nbval --ignore=docs --ignore=./multigrid/variable_coeff_elliptic.ipynb --ignore=examples/mesh --ignore=examples/multigrid --ignore=presentations

.travis.yml

Lines changed: 0 additions & 46 deletions
This file was deleted.

0 commit comments

Comments
 (0)