forked from NTNU-IHB/PythonFMU
-
Notifications
You must be signed in to change notification settings - Fork 0
184 lines (157 loc) · 5.42 KB
/
main.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
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
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
name: CI
on:
push:
branches:
- master
pull_request:
branches:
- '*'
jobs:
build-wrapper:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, windows-latest]
steps:
- uses: actions/checkout@v2
- name: Setup Python 3.x
uses: actions/setup-python@v2
with:
python-version: '3.x'
architecture: 'x64'
- name: Compile wrapper on Windows
if: startsWith(runner.os, 'Windows')
run: |
mkdir tmp-build
cd tmp-build
cmake $Env:github_workspace/pythonfmu/pythonfmu-export -DCMAKE_BUILD_TYPE=Release -A x64
cmake --build . --config Release
cd ..
- name: Compile wrapper on Linux / macOS
if: startsWith(runner.os, 'Linux') || startsWith(runner.os, 'macOS')
run: |
mkdir tmp-build
cd tmp-build
cmake $GITHUB_WORKSPACE/pythonfmu/pythonfmu-export -DCMAKE_BUILD_TYPE=Release
cmake --build . --config Release
cd ..
- name: Archive wrapper library
uses: actions/upload-artifact@v2
with:
name: lib-wrapper
path: pythonfmu/resources
build-python:
needs: build-wrapper
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Setup Python 3.x
uses: actions/setup-python@v2
with:
python-version: '3.x'
architecture: 'x64'
- name: Download wrappers
uses: actions/download-artifact@v1
with:
name: lib-wrapper
path: pythonfmu/resources
- name: Build distribution artifacts
run: |
python -m pip install setuptools wheel
python setup.py sdist bdist_wheel
- name: Archive production artifacts
uses: actions/upload-artifact@v1
with:
name: python-wheel
path: dist
test:
needs: build-python
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, windows-latest]
python-version: [3.6, 3.7, 3.8]
steps:
- uses: actions/checkout@v2
- name: Download python package
uses: actions/download-artifact@v1
with:
name: python-wheel
# - name: Cache conda packages for Linux
# if: startsWith(runner.os, 'Linux')
# uses: actions/cache@v1
# with:
# path: /usr/share/miniconda/pkgs
# key: ${{ runner.os }}-test-cache-conda-pkgs-${{ matrix.python-version }}-${{ hashFiles('environment.yml') }}
# restore-keys: |
# ${{ runner.os }}-test-cache-conda-pkgs-${{ matrix.python-version }}
# ${{ runner.os }}-test-cache-conda-pkgs-
# ${{ runner.os }}-test-
# - name: Cache conda packages for Mac OS
# if: startsWith(runner.os, 'macOS')
# uses: actions/cache@v1
# with:
# path: /usr/share/miniconda/pkgs
# key: ${{ runner.os }}-test-cache-conda-pkgs-${{ matrix.python-version }}-${{ hashFiles('environment.yml') }}
# restore-keys: |
# ${{ runner.os }}-test-cache-conda-pkgs-${{ matrix.python-version }}
# ${{ runner.os }}-test-cache-conda-pkgs-
# ${{ runner.os }}-test-
# - name: Cache conda packages for Windows
# if: startsWith(runner.os, 'Windows')
# uses: actions/cache@v1
# with:
# path: C:\Miniconda\pkgs
# key: ${{ runner.os }}-test-cache-conda-pkgs-${{ matrix.python-version }}-${{ hashFiles('environment.yml') }}
# restore-keys: |
# ${{ runner.os }}-test-cache-conda-pkgs-${{ matrix.python-version }}
# ${{ runner.os }}-test-cache-conda-pkgs-
# ${{ runner.os }}-test-
- name: Setup Python ${{ matrix.python-version }}
uses: conda-incubator/setup-miniconda@v2
with:
auto-update-conda: true
python-version: ${{ matrix.python-version }}
- name: Run the Tests
run: |
conda activate test
# Install test dependencies - update environment.yml if they changed
conda env update --name=test --file=environment.yml
cd python-wheel
python -m pip install pythonfmu*.whl
python -m pytest --pyargs pythonfmu
cd ..
shell: bash -l {0}
test-notebook:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Cache conda packages for Linux
if: startsWith(runner.os, 'Linux')
uses: actions/cache@v2
with:
path: /usr/share/miniconda/pkgs
key: ${{ runner.os }}-test-nb-cache-conda-pkgs-${{ hashFiles('binder/environment.yml') }}
restore-keys: |
${{ runner.os }}-test-nb-cache-conda-pkgs-
${{ runner.os }}-test-nb-
- name: Setup Python
uses: conda-incubator/setup-miniconda@v2
with:
auto-update-conda: true
- name: Run the Tests
run: |
conda activate test
# Install binder dependencies - update binder/environment.yml if they changed
cp binder/* .
conda env update --name=test --file=environment.yml
bash ./postBuild
cd ./examples
jupyter nbconvert --to notebook --execute demo.ipynb
cd ..
shell: bash -l {0}
- name: Archive executed notbook
uses: actions/upload-artifact@v2
with:
name: nb-examples
path: examples