forked from gmlc-dispatches/dispatches
-
Notifications
You must be signed in to change notification settings - Fork 0
134 lines (127 loc) · 4.33 KB
/
checks.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
# This workflow will install Python dependencies, run tests and lint
# with a variety of Python versions For more information see:
# https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions
name: Checks
on:
push:
branches:
- main
- '*_rel'
pull_request:
branches: [ main ]
workflow_dispatch:
defaults:
run:
# important to make sure that all commands on Windows are run using Bash
# -l: login shell, needed when using Conda
shell: bash -l {0}
env:
PYTEST_ADDOPTS: --color=yes -m 'not fails_in_ci'
jobs:
tests:
name: Tests (py${{ matrix.python-version }}/${{ matrix.os }})
runs-on: ${{ matrix.os-version }}
strategy:
fail-fast: false
matrix:
python-version: ['3.8', '3.9']
os:
- linux
- win64
include:
- os: linux
os-version: ubuntu-20.04
- os: win64
os-version: windows-2019
- python-version: '3.8'
cov-report: true
steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Install Python package and dependencies
run: |
_pip_install="pip install --progress-bar off"
echo '::group::Output of "pip install" commands'
$_pip_install --upgrade pip wheel setuptools
$_pip_install -r requirements-dev.txt
echo '::endgroup::'
echo '::group::Display installed packages'
conda list
pip list
pip show idaes-pse
echo '::endgroup::'
echo '::group::Output of "idaes get-extensions" command'
idaes get-extensions --verbose
echo '::endgroup::'
- name: Lint with flake8
if: 'false'
run: |
# stop the build if there are Python syntax errors or undefined names
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
# flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
- name: Add pytest CLI options for coverage
if: matrix.cov-report
run: |
echo PYTEST_ADDOPTS="$PYTEST_ADDOPTS --cov --cov-report=xml" >> "$GITHUB_ENV"
- name: Test with pytest
run: |
pytest
- name: Upload coverage report to Codecov
if: matrix.cov-report
uses: codecov/codecov-action@v2
with:
fail_ci_if_error: true
tests-noneditable-install:
name: Tests (non-editable install) (py${{ matrix.python-version }}/${{ matrix.os }})
runs-on: ${{ matrix.os-version }}
strategy:
fail-fast: false
matrix:
python-version: ['3.8', '3.9']
os:
- linux
- win64
include:
- os: linux
os-version: ubuntu-20.04
- os: win64
os-version: windows-2019
steps:
- name: Set up Python ${{ matrix.python-version }}
uses: conda-incubator/setup-miniconda@v2
with:
activate-environment: dispatches-env
python-version: ${{ matrix.python-version }}
- name: Define install URL (default)
env:
_repo_full_name: gmlc-dispatches/dispatches
_ref_to_install: main
run: |
echo "_install_url=https://github.com/${_repo_full_name}/archive/${_ref_to_install}.zip" >> $GITHUB_ENV
- name: Define install URL (for PRs)
if: github.event.pull_request
env:
_repo_full_name: ${{ github.event.pull_request.head.repo.full_name }}
_ref_to_install: ${{ github.event.pull_request.head.sha }}
run:
echo "_install_url=https://github.com/${_repo_full_name}/archive/${_ref_to_install}.zip" >> $GITHUB_ENV
- name: Install dispatches and testing dependencies
run: |
echo '::group::Output of "pip install" commands'
pip install --progress-bar off "dispatches @ ${_install_url}"
echo '::endgroup::'
echo '::group::Display installed packages'
pip list
echo '::endgroup::'
- name: Install IDAES extensions
run: |
echo '::group::Output of "idaes get-extensions" command'
idaes get-extensions --verbose
echo '::endgroup::'
- name: Run pytest
run: |
pytest --pyargs dispatches