-
Notifications
You must be signed in to change notification settings - Fork 1
142 lines (112 loc) · 4.08 KB
/
test.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
name: Test
on:
push:
pull_request:
schedule:
- cron: '17 4 3 * *' # 4:17a on third day of the month
concurrency:
group: ${{ github.ref }}-${{ github.workflow }}
cancel-in-progress: true
env:
BUILD_DIR: _build
jobs:
build-test-unix:
if:
github.event_name == 'push' || github.event.pull_request.head.repo.full_name != github.repository
runs-on: ${{ matrix.os }}
defaults:
run:
shell: bash -l {0}
strategy:
matrix:
os: [ubuntu-latest, macos-latest]
steps:
- uses: actions/checkout@v4
with:
submodules: true
- uses: mamba-org/setup-micromamba@v2
with:
micromamba-version: latest
environment-file: environment.yml
- name: Build and install HeatModelF
run: |
pushd ./external/bmi-example-fortran
cmake -B ${{ env.BUILD_DIR }} -DCMAKE_INSTALL_PREFIX=$CONDA_PREFIX
cmake --build ${{ env.BUILD_DIR }} --target install --config Release
popd
- name: Build and install package
run: |
make install
- name: Test imports
working-directory: ${{ github.workspace }}/examples
run: |
python -c 'import pymt_heatf'
python -c 'from pymt.models import HeatModelF'
- name: Test BMI
run: |
make test
- name: Run examples
working-directory: ${{ github.workspace }}/examples
run: |
python heatf_ex.py
python pymt_heatf_ex.py
build-test-windows:
if:
github.event_name == 'push' || github.event.pull_request.head.repo.full_name != github.repository
runs-on: windows-latest
env:
LIBRARY_PREFIX: $env:CONDA_PREFIX\Library
defaults:
run:
shell: pwsh
steps:
- uses: actions/checkout@v4
with:
submodules: true
- uses: ilammy/msvc-dev-cmd@v1
- uses: mamba-org/setup-micromamba@v2
with:
micromamba-version: latest
environment-file: environment.yml
init-shell: >-
powershell
# The Fortran conda compiler, flang, needs to be set over the gfortran installed by chocolatety.
- name: Set the FC environment variable
run: |
echo "FC=$env:CONDA_PREFIX\Library\bin\flang-new.exe" | Out-File -FilePath $Env:GITHUB_ENV -Encoding utf8 -Append
# A link.exe installed by chocolatey was ahead of the MSVC link.exe in the path.
- name: Remove link.exe in the Git install
run: |
Remove-Item -Path "C:\Program Files\Git\usr\bin\link.exe" -Force
# The flang FortranRuntime.lib wasn't being found. This recommendation comes from the Meson docs.
- name: Add conda environment libpath to Windows LIB (not LIBPATH)
run: |
echo "LIB=$env:LIB;$env:CONDA_PREFIX\Library\lib" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
- name: View environment variables
run: |
ls env:
# The install prefix must be quoted.
- name: Configure, build, and install HeatModelF
run: |
pushd ./external/bmi-example-fortran
cmake -B ${{ env.BUILD_DIR }} -LA -G Ninja -DCMAKE_INSTALL_PREFIX="${{ env.LIBRARY_PREFIX }}" -DCMAKE_BUILD_TYPE=Release
cmake --build ${{ env.BUILD_DIR }} --target install --config Release
popd
- name: Build and install package
run: |
make install
- name: Test imports
working-directory: ${{ github.workspace }}/examples
run: |
python -c 'import pymt_heatf'
python -c 'from pymt.models import HeatModelF'
# Weird Windows stuff here. If the examples in the next step run to completion, the BMI works.
# - name: Test BMI
# working-directory: ${{ github.workspace }}
# run: |
# bmi-test pymt_heatf._bmi:HeatModelF --config-file=${{ github.workspace }}\examples\test.cfg --root-dir=examples -vvv
- name: Run examples
working-directory: ${{ github.workspace }}/examples
run: |
python heatf_ex.py
python pymt_heatf_ex.py