-
Notifications
You must be signed in to change notification settings - Fork 0
160 lines (153 loc) · 5.03 KB
/
main.yml
File metadata and controls
160 lines (153 loc) · 5.03 KB
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
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
name: Run examples
on:
push:
branches:
- main
pull_request:
branches:
- main
workflow_dispatch:
schedule:
# run daily at 5:00 am UTC (12 am ET/9 pm PT)
- cron: '0 5 * * *'
concurrency:
# NOTE: the value of `group` should be chosen carefully,
# otherwise we might end up over- or under-canceling workflow runs
group: ${{ github.workflow }}-${{ github.ref_name }}
cancel-in-progress: true
env:
IDAES_CONDA_ENV_NAME_DEV: examples-pse-dev
IDAES_PSE_REQUIREMENT: idaes-pse[prerelease] @ https://github.com/IDAES/idaes-pse/archive/main.zip
defaults:
run:
# -l needed to work properly with Conda
shell: bash -l {0}
jobs:
examples:
name: Build examples (py${{ matrix.python-version }}/${{ matrix.os }})
runs-on: ${{ matrix.os-runner }}
strategy:
# if fail-fast == true (the default), jobs for the remaining values in the matrix are cancelled
fail-fast: false
matrix:
python-version:
- '3.7'
- '3.8'
- '3.9'
os:
- linux
- windows
include:
- os: linux
os-runner: ubuntu-18.04
- os: windows
os-runner: windows-2019
skip-wsl-only: true
steps:
- name: Set up Conda environment
uses: conda-incubator/setup-miniconda@v2.1.1
with:
activate-environment: ${{ env.IDAES_CONDA_ENV_NAME_DEV }}
python-version: ${{ matrix.python-version }}
- uses: actions/checkout@v2
- name: Skip notebooks that require WSL to run on Windows
if: matrix.skip-wsl-only
run: |
rm -r src/Examples/DAE/petsc*.ipynb
- name: Skip notebooks that require Alamo
run: |
rm src/Examples/SurrMod/FlowsheetOptimization/ALAMO_flowsheet_optimization.ipynb
- name: Add configured version of idaes-pse to requirements
run: |
echo "$IDAES_PSE_REQUIREMENT" >> requirements.txt
- name: Set up IDAES
uses: ./.github/actions/setup-idaes
with:
install-target: -r requirements.txt
- name: Run pytest (unit)
run: |
pytest --verbose -m unit tests/
- name: Run pytest (not unit, including running notebooks)
run: |
pytest --verbose -m 'not unit' tests/
- name: Save build error logs
uses: actions/upload-artifact@v2
if: failure()
with:
name: build-error-logs
path: ci-test-errors.txt
build-examples-docs:
name: Build examples docs (py${{ matrix.python-version }})
runs-on: ubuntu-18.04
strategy:
fail-fast: false
matrix:
python-version:
- '3.7'
- '3.8'
- '3.9'
steps:
- name: Set up Conda environment
uses: conda-incubator/setup-miniconda@v2.1.1
with:
activate-environment: ${{ env.IDAES_CONDA_ENV_NAME_DEV }}
python-version: ${{ matrix.python-version }}
- uses: actions/checkout@v2
- name: Skip notebooks that require Alamo
run: |
rm src/Examples/SurrMod/FlowsheetOptimization/ALAMO_flowsheet_optimization.ipynb
- name: Add configured version of idaes-pse to requirements
run: |
echo "$IDAES_PSE_REQUIREMENT" >> requirements.txt
- name: Set up IDAES
uses: ./.github/actions/setup-idaes
with:
install-target: -r requirements.txt
- name: Install pandoc
run: |
sudo apt-get install --quiet --yes pandoc
- name: Check installed versions
run: |
idaes --version
pandoc --version
- name: Build notebook index
run: |
python build.py -v --config ./build-ci.yml -x
- name: Convert notebooks and build docs
run: |
# copy files and dirs from 'docs/' to 'docs_test/' to avoid Sphinx errors and warnings
mkdir ./docs_test && cp -r ./docs/{conf.py,index.rst,_images,_static,_templates} ./docs_test/
ls -lah ./docs_test
python build.py -v --config ./build-ci.yml -cd
- name: Save build outputs
uses: actions/upload-artifact@v2
if: always()
with:
name: examples-pse-build-docs-${{ matrix.python-version }}
path: |
sphinx-errors.txt
docs_test/_build/html/
- name: Check for broken links in HTML docs
run: |
# linkchecker refuses to load files from its own installation directory if they are world-writable
linkchecker_pkg_dir=$(python -c 'import linkcheck as l, pathlib as p; print(p.Path(l.__file__).parent.resolve())')
chmod -R o-w "$linkchecker_pkg_dir"
linkchecker --no-warnings ./docs_test/_build/html/
pylint:
name: Check for errors using pylint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: '3.8'
- name: Install pylint and dependencies
run: |
python -m pip install --progress-bar=off -r requirements.txt pylint
- name: Run pylint
env:
PYLINT_OPTIONS: --errors-only
PYLINT_TARGETS: build.py build_util
run: |
pylint $PYLINT_OPTIONS $PYLINT_TARGETS