-
Notifications
You must be signed in to change notification settings - Fork 4
188 lines (160 loc) · 5.15 KB
/
CI.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
185
186
187
188
name: CI
on: [push, pull_request, release]
jobs:
tests_and_coverage:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest]
python-version: [3.9]
toolchain:
- {compiler: gcc, version: 10}
- {compiler: gcc, version: 11}
- {compiler: gcc, version: 12}
- {compiler: gcc, version: 13}
- {compiler: intel, version: '2024.2'}
- {compiler: intel, version: '2023.2'}
steps:
- name: Checkout code
uses: actions/checkout@v2
with:
submodules: false
- name: Setup Fortran Compiler
uses: fortran-lang/setup-fortran@v1
id: setup-fortran
with:
compiler: ${{ matrix.toolchain.compiler }}
version: ${{ matrix.toolchain.version }}
- name: Install Python
uses: actions/setup-python@v1 # Use pip to install latest CMake, & FORD/Jin2For, etc.
with:
python-version: ${{ matrix.python-version }}
- name: Setup Graphviz
uses: ts-graphviz/setup-graphviz@v1
- name: Setup Fortran Package Manager
uses: fortran-lang/setup-fpm@v4
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install ford numpy matplotlib gcovr numpy scipy
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
sudo apt-get install libnlopt-dev
- name: Run tests without coverage
if: ${{ env.FC != 'gfortran' }}
run: |
fpm test --profile release --flag "-g" --compiler ${{ env.FC }} --c-compiler gcc
- name: Run tests with coverage
if: ${{ env.FC == 'gfortran' }}
run: |
fpm test --profile release --flag "-g -coverage" --compiler ${{ env.FC }} --c-compiler gcc
bash ci/ci.sh
- name: Coverage
run: bash ci/ci.sh coverage
if: ${{ env.FC == 'gfortran' }}
- name: Upload coverage reports to Codecov
if: ${{ env.FC == 'gfortran' }}
uses: codecov/[email protected]
with:
token: ${{ secrets.CODECOV_TOKEN }}
slug: ipqa-research/yaeos
Python-API:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest]
python-version: ["3.12"]
toolchain:
- {compiler: gcc, version: 13}
steps:
- name: Checkout code
uses: actions/checkout@v2
with:
submodules: false
- name: Install Python
uses: actions/setup-python@v1 # Use pip to install latest CMake, & FORD/Jin2For, etc.
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
sudo apt-get install libnlopt-dev pandoc
- name: install tox
run: |
pip install tox tox-gh-actions
- name: Setup Fortran Compiler
uses: fortran-lang/setup-fortran@v1
id: setup-fortran
with:
compiler: ${{ matrix.toolchain.compiler }}
version: ${{ matrix.toolchain.version }}
- name: Run tox
run: |
cd python && tox -r
build_wheels:
name: Build wheels on ${{ matrix.os }}
needs:
- tests_and_coverage
- Python-API
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest] #, windows-latest, macos-13, macos-14]
steps:
- uses: actions/checkout@v4
# Used to host cibuildwheel
- uses: actions/setup-python@v5
# Install gfortran on each OS
- name: Setup Fortran Compiler
uses: fortran-lang/setup-fortran@v1
id: setup-fortran
with:
compiler: gcc
version: 12
# Install fpm for Windows
- name: Install fpm
uses: fortran-lang/setup-fpm@v5
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
# CiBuildWheel
- name: Install dependencies
run: |
python -m pip install cibuildwheel==2.19.2
- name: Build wheels
run: python -m cibuildwheel python/ --output-dir wheelhouse --debug-traceback
# to supply options, put them in 'env', like:
env:
# CIBW_BUILD_VERBOSITY: 3
CIBW_BUILD_FRONTEND: build
# MACOSX_DEPLOYMENT_TARGET: "13.0"
CIBW_BEFORE_TEST: pip install pytest
CIBW_TEST_COMMAND: pytest {project}/python/tests --import-mode=importlib
- uses: actions/upload-artifact@v4
with:
name: cibw-wheels-${{ matrix.os }}
path: ./wheelhouse/*.whl
publish_to_testpypi:
name: Publish Python 🐍 wheels 🛞 to PyPI
if: github.event_name == 'release'
needs: build_wheels
runs-on: ubuntu-latest
environment:
name: pypi
url: https://test.pypi.org/p/yaeos
permissions:
id-token: write # IMPORTANT: mandatory for trusted publishing
steps:
- name: Download all the dists
uses: actions/download-artifact@v4
with:
path: dist/
pattern: cibw-wheels-*
merge-multiple: true
- run: ls -R dist
- name: Publish distribution 📦 to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
skip-existing: true