Custom build (manual) #81
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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: | |
- OpenFOAMv2312 | |
- OpenFOAMv2306 | |
- OpenFOAMv2212 | |
- OpenFOAMv2206 | |
- OpenFOAMv2112 | |
- OpenFOAMv2106 | |
- OpenFOAMv2012 | |
- OpenFOAMv2006 | |
- OpenFOAMv1912 | |
- OpenFOAM10 | |
- OpenFOAM9 | |
- OpenFOAM8 | |
- OpenFOAM7 | |
- OpenFOAM6 | |
- OpenFOAM5 | |
versionpreCICE: | |
description: 'Version of preCICE to build with' | |
default: 'v3.0.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 preCICE (no cache) | |
uses: precice/setup-precice-action@main | |
with: | |
precice-version: ${{ github.event.inputs.versionpreCICE }} | |
- name: Install OpenFOAM (no cache) | |
id: installOpenFOAM | |
run: | | |
case "${{ github.event.inputs.versionOpenFOAM }}" in | |
OpenFOAMv2312) | |
wget -q -O - https://dl.openfoam.com/add-debian-repo.sh | sudo bash | |
sudo apt-get install openfoam2312-dev | |
echo "{openfoam_exec}={/usr/bin/openfoam2312}" >> $GITHUB_OUTPUT;; | |
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: 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/* |