Custom build (manual) #96
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: | |
- 2406 | |
- 2312 | |
- 2306 | |
- 2212 | |
- 2206 | |
- 2112 | |
- 2106 | |
- 2012 | |
- 2006 | |
- 1912 | |
- 10 | |
- 9 | |
- 8 | |
- 7 | |
- 6 | |
- 5 | |
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: Set up OpenFOAM | |
uses: gerlero/setup-openfoam@v1 | |
with: | |
openfoam-version: ${{ github.event.inputs.versionOpenFOAM }} | |
- name: Build OpenFOAM-preCICE adapter | |
run: | | |
./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 | |
./run.sh | tee fluid-openfoam.log 2>&1 & | |
PIDfluid=$! | |
cd ../solid-openfoam | |
./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 }}" == 5 ] | |
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 }}" == 9 ] | |
then | |
echo "Manually changing from solver to motionSolver in dynamicMeshDict for compatibility with OpenFOAM 9." | |
sed -i 's/solver/motionSolver/g' constant/dynamicMeshDict | |
fi | |
./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 | |
./run.sh | tee fluid1-openfoam-pimplefoam.log 2>&1 & | |
PIDfluid=$! | |
cd ../fluid2-openfoam-pimplefoam | |
./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/* |