-
-
Notifications
You must be signed in to change notification settings - Fork 87
246 lines (245 loc) · 11.4 KB
/
build-custom.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
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
name: Custom build (manual) # Unfortunately, we cannot modify the name: https://github.community/t/github-actions-dynamic-name-of-the-workflow-with-workflow-dispatch/150327
on:
workflow_dispatch:
inputs:
virtualEnvironment:
description: 'Virtual Environment'
default: 'ubuntu-18.04'
required: true
type: choice
options:
- ubuntu-22.04
- ubuntu-20.04
- ubuntu-18.04
refAdapter:
description: 'Ref (branch/tag/commit) of the OpenFOAM adapter to build'
default: 'develop'
required: true
versionOpenFOAM:
description: 'Version of OpenFOAM to build with'
required: true
type: choice
options:
- OpenFOAMv2306
- OpenFOAMv2212
- OpenFOAMv2206
- OpenFOAMv2112
- OpenFOAMv2106
- OpenFOAMv2012
- OpenFOAMv2006
- OpenFOAMv1912
- OpenFOAM10
- OpenFOAM9
- OpenFOAM8
- OpenFOAM7
- OpenFOAM6
- OpenFOAM5
versionpreCICE:
description: 'Version of preCICE to build with'
default: '2.5.0'
required: true
runTutorialHeatedPlate:
description: Run tutorial flow-over-heated-plate
type: boolean
default: true
required: true
runTutorialQuickstart:
description: Run tutorial quickstart
type: boolean
default: true
required: true
runTutorialPartitionedPipe:
description: Run tutorial partitioned-pipe
type: boolean
default: true
required: true
branchTutorials:
description: 'Branch of the tutorials to use'
default: 'master'
required: true
jobs:
build:
runs-on: ${{ github.event.inputs.virtualEnvironment }}
steps:
- name: Report log
run: |
echo "Initiated by: ${{ github.actor }}"
echo "Runs on: ${{ github.event.inputs.virtualEnvironment }}"
echo "Adapter ref (branch/tag/commit): ${{ github.event.inputs.refAdapter }}"
echo "OpenFOAM version: ${{ github.event.inputs.versionOpenFOAM }}"
echo "preCICE version: ${{ github.event.inputs.versionpreCICE }}"
echo "Run tutorial flow-over-heated-plate: ${{ github.event.inputs.runTutorialHeatedPlate }}"
echo "Run tutorial quickstart: ${{ github.event.inputs.runTutorialQuickstart }}"
echo "Run tutorial partitioned-pipe: ${{ github.event.inputs.runTutorialPartitionedPipe }}"
echo "Tutorials branch: ${{ github.event.inputs.branchTutorials }}"
- name: Check out repository
uses: actions/checkout@v4
with:
ref: ${{ github.event.inputs.refAdapter }}
- name: Install OpenFOAM (no cache)
id: installOpenFOAM
run: |
case "${{ github.event.inputs.versionOpenFOAM }}" in
OpenFOAMv2306)
wget -q -O - https://dl.openfoam.com/add-debian-repo.sh | sudo bash
sudo apt-get install openfoam2306-dev
echo "{openfoam_exec}={/usr/bin/openfoam2306}" >> $GITHUB_OUTPUT;;
OpenFOAMv2212)
wget -q -O - https://dl.openfoam.com/add-debian-repo.sh | sudo bash
sudo apt-get install openfoam2212-dev
echo "{openfoam_exec}={/usr/bin/openfoam2212}" >> $GITHUB_OUTPUT;;
OpenFOAMv2206)
wget -q -O - https://dl.openfoam.com/add-debian-repo.sh | sudo bash
sudo apt-get install openfoam2206-dev
echo "{openfoam_exec}={/usr/bin/openfoam2206}" >> $GITHUB_OUTPUT;;
OpenFOAMv2112)
wget -q -O - https://dl.openfoam.com/add-debian-repo.sh | sudo bash
sudo apt-get install openfoam2112-dev
echo "{openfoam_exec}={/usr/bin/openfoam2112}" >> $GITHUB_OUTPUT;;
OpenFOAMv2106)
wget -q -O - https://dl.openfoam.com/add-debian-repo.sh | sudo bash
sudo apt-get install openfoam2106-dev
echo "{openfoam_exec}={/usr/bin/openfoam2106}" >> $GITHUB_OUTPUT;;
OpenFOAMv2012)
wget -q -O - https://dl.openfoam.com/add-debian-repo.sh | sudo bash
sudo apt-get install openfoam2012-dev
echo "{openfoam_exec}={/usr/bin/openfoam2012}" >> $GITHUB_OUTPUT;;
OpenFOAMv2006)
wget -q -O - https://dl.openfoam.com/add-debian-repo.sh | sudo bash
sudo apt-get install openfoam2006-dev
echo "{openfoam_exec}={/usr/bin/openfoam2006}" >> $GITHUB_OUTPUT;;
OpenFOAMv1912)
wget -q -O - https://dl.openfoam.com/add-debian-repo.sh | sudo bash
sudo apt-get install openfoam1912-dev
echo "{openfoam_exec}={/usr/bin/openfoam1912}" >> $GITHUB_OUTPUT;;
OpenFOAM10)
sudo sh -c "wget -O - https://dl.openfoam.org/gpg.key | apt-key add -"
sudo add-apt-repository http://dl.openfoam.org/ubuntu
sudo apt-get update
sudo apt-get -y install openfoam10
echo "{openfoam_exec}={. /opt/openfoam10/etc/bashrc &&}" >> $GITHUB_OUTPUT;;
OpenFOAM9)
sudo sh -c "wget -O - https://dl.openfoam.org/gpg.key | apt-key add -"
sudo add-apt-repository http://dl.openfoam.org/ubuntu
sudo apt-get update
sudo apt-get -y install openfoam9
echo "{openfoam_exec}={. /opt/openfoam9/etc/bashrc &&}" >> $GITHUB_OUTPUT;;
OpenFOAM8)
sudo sh -c "wget -O - https://dl.openfoam.org/gpg.key | apt-key add -"
sudo add-apt-repository http://dl.openfoam.org/ubuntu
sudo apt-get update
sudo apt-get -y install openfoam8
echo "{openfoam_exec}={. /opt/openfoam8/etc/bashrc &&}" >> $GITHUB_OUTPUT;;
OpenFOAM7)
sudo sh -c "wget -O - https://dl.openfoam.org/gpg.key | apt-key add -"
sudo add-apt-repository http://dl.openfoam.org/ubuntu
sudo apt-get update
sudo apt-get -y install openfoam7
echo "{openfoam_exec}={. /opt/openfoam7/etc/bashrc &&}" >> $GITHUB_OUTPUT;;
OpenFOAM6)
echo "OpenFOAM 6 is only available on Ubuntu 18.04 or older."
sudo sh -c "wget -O - https://dl.openfoam.org/gpg.key | apt-key add -"
sudo add-apt-repository http://dl.openfoam.org/ubuntu
sudo apt-get update
sudo apt-get -y install openfoam6
echo "{openfoam_exec}={. /opt/openfoam6/etc/bashrc &&}" >> $GITHUB_OUTPUT;;
OpenFOAM5)
echo "OpenFOAM 5 is only available on Ubuntu 18.04 or older."
sudo sh -c "wget -O - https://dl.openfoam.org/gpg.key | apt-key add -"
sudo add-apt-repository http://dl.openfoam.org/ubuntu
sudo apt-get update
sudo apt-get -y install openfoam5
echo "{openfoam_exec}={. /opt/openfoam5/etc/bashrc &&}" >> $GITHUB_OUTPUT;;
*)
echo "I cannot find ${{ github.event.inputs.refAdapter }} in my known options."
exit 1;;
esac
- name: Install preCICE (no cache)
run: |
if [ "${{ github.event.inputs.virtualEnvironment }}" == "ubuntu-22.04" ]
then
wget "https://github.com/precice/precice/releases/download/v${{ github.event.inputs.versionpreCICE }}/libprecice2_${{ github.event.inputs.versionpreCICE }}_jammy.deb"
sudo apt install "./libprecice2_${{ github.event.inputs.versionpreCICE }}_jammy.deb"
elif [ "${{ github.event.inputs.virtualEnvironment }}" == "ubuntu-20.04" ]
then
wget "https://github.com/precice/precice/releases/download/v${{ github.event.inputs.versionpreCICE }}/libprecice2_${{ github.event.inputs.versionpreCICE }}_focal.deb"
sudo apt install "./libprecice2_${{ github.event.inputs.versionpreCICE }}_focal.deb"
elif [ "${{ github.event.inputs.virtualEnvironment }}" == "ubuntu-18.04" ]
then
wget "https://github.com/precice/precice/releases/download/v${{ github.event.inputs.versionpreCICE }}/libprecice2_${{ github.event.inputs.versionpreCICE }}_bionic.deb"
sudo apt install "./libprecice2_${{ github.event.inputs.versionpreCICE }}_bionic.deb"
fi
- name: Build OpenFOAM-preCICE adapter
run: |
${{steps.installOpenFOAM.outputs.openfoam_exec}} ./Allwmake
- name: Get tutorials
run: |
git clone https://github.com/precice/tutorials.git --branch ${{ github.event.inputs.branchTutorials }} --depth 1
- name: Run tutorial flow-over-heated-plate
run: |
if ${{ github.event.inputs.runTutorialHeatedPlate }}
then
cd tutorials/flow-over-heated-plate/fluid-openfoam
${{steps.installOpenFOAM.outputs.openfoam_exec}} ./run.sh | tee fluid-openfoam.log 2>&1 &
PIDfluid=$!
cd ../solid-openfoam
${{steps.installOpenFOAM.outputs.openfoam_exec}} ./run.sh | tee solid-openfoam.log 2>&1
wait $PIDfluid
fi
- name: Run tutorial quickstart
run: |
if ${{ github.event.inputs.runTutorialQuickstart }}
then
cd tutorials/quickstart/fluid-openfoam
if [ "${{ github.event.inputs.versionOpenFOAM }}" == "OpenFOAM5" ]
then
echo "Manually changing from pimpleFoam to pimpleDyMFoam for compatibility with OpenFOAM 5."
sed -i 's/pimpleFoam/pimpleDyMFoam/g' system/controlDict
fi
if [ "${{ github.event.inputs.versionOpenFOAM }}" == "OpenFOAM9" ]
then
echo "Manually changing from solver to motionSolver in dynamicMeshDict for compatibility with OpenFOAM 9."
sed -i 's/solver/motionSolver/g' constant/dynamicMeshDict
fi
${{steps.installOpenFOAM.outputs.openfoam_exec}} ./run.sh | tee fluid-openfoam.log 2>&1 &
PIDfluid=$!
cd ../solid-cpp
cmake . && make && ./run.sh | tee solid-cpp.log 2>&1
wait $PIDfluid
fi
- name: Run tutorial partitioned-pipe
run: |
if ${{ github.event.inputs.runTutorialPartitionedPipe }}
then
cd tutorials/partitioned-pipe/fluid1-openfoam-pimplefoam
${{steps.installOpenFOAM.outputs.openfoam_exec}} ./run.sh | tee fluid1-openfoam-pimplefoam.log 2>&1 &
PIDfluid=$!
cd ../fluid2-openfoam-pimplefoam
${{steps.installOpenFOAM.outputs.openfoam_exec}} ./run.sh | tee fluid2-openfoam-pimplefoam.log 2>&1 &
wait $PIDfluid
fi
- name: Archive logs
uses: actions/upload-artifact@v4
with:
name: logs
path: |
Allwmake.log
wmake.log
ldd.log
tutorials/flow-over-heated-plate/fluid-openfoam/fluid-openfoam.log
tutorials/flow-over-heated-plate/solid-openfoam/solid-openfoam.log
tutorials/quickstart/fluid-openfoam/fluid-openfoam.log
tutorials/quickstart/solid-cpp/solid-cpp.log
tutorials/partitioned-pipe/fluid1-openfoam-pimplefoam/fluid1-openfoam-pimplefoam.log
tutorials/partitioned-pipe/fluid2-openfoam-pimplefoam/fluid2-openfoam-pimplefoam.log
- name: Archive case files
uses: actions/upload-artifact@v4
with:
name: case-files
path: |
tutorials/flow-over-heated-plate/fluid-openfoam/*
tutorials/flow-over-heated-plate/solid-openfoam/*
tutorials/quickstart/fluid-openfoam/*
tutorials/quickstart/solid-cpp/*
tutorials/partitioned-pipe/fluid1-openfoam-pimplefoam/*
tutorials/partitioned-pipe/fluid2-openfoam-pimplefoam/*