Calculated fvSource on the fly #207
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: codecov | |
on: [push, pull_request] | |
env: | |
REPO_NAME: 'dafoam' | |
DOCKER_WORKING_DIR: '/home/dafoamuser/dafoam/$REPO_NAME' | |
DOCKER_MOUNT_DIR: '/home/dafoamuser/mount/$REPO_NAME' | |
DOCKER_TAG: 'latest' | |
DOCKER_ENV_FILE: '/home/dafoamuser/dafoam/loadDAFoam.sh' | |
DOCKER_OF_ADF_BASHRC: '/home/dafoamuser/dafoam/OpenFOAM/OpenFOAM-v1812-ADF/etc/bashrc' | |
DOCKER_OF_ADR_BASHRC: '/home/dafoamuser/dafoam/OpenFOAM/OpenFOAM-v1812-ADR/etc/bashrc' | |
jobs: | |
code_coverage: | |
runs-on: ubuntu-20.04 | |
name: Codecov | |
strategy: | |
fail-fast: false | |
matrix: | |
testConfig: [incompressible, compressible, solid, forward, mphys_incomp, mphys_comp] | |
include: | |
- testConfig: incompressible | |
args: 'incompressible' | |
- testConfig: compressible | |
args: 'compressible' | |
- testConfig: solid | |
args: 'solid' | |
- testConfig: forward | |
args: 'forward' | |
- testConfig: mphys_incomp | |
args: 'mphys_incomp' | |
- testConfig: mphys_comp | |
args: 'mphys_comp' | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: codecov/codecov-action@v3 | |
- uses: actions/setup-python@v2 | |
with: | |
python-version: 3.8 | |
- name: Create the docker container and run the tests | |
run: | | |
docker pull dafoam/opt-packages:${{env.DOCKER_TAG}} | |
docker run -i -d -u dafoamuser --name regtest -v $GITHUB_WORKSPACE:${{env.DOCKER_MOUNT_DIR}} dafoam/opt-packages:${{env.DOCKER_TAG}} /bin/bash | |
docker exec -i regtest /bin/bash -c "rm -rf ${{env.DOCKER_WORKING_DIR}} && cp -r ${{env.DOCKER_MOUNT_DIR}} ${{env.DOCKER_WORKING_DIR}}" | |
docker exec regtest sed -i 's/-std=c++11/-std=c++11 -fprofile-arcs -ftest-coverage/g' ${{env.DOCKER_WORKING_DIR}}/src/adjoint/Make/options_Incompressible | |
docker exec regtest sed -i 's/-lfiniteVolume$(DF_LIB_SUFFIX)/-lfiniteVolume$(DF_LIB_SUFFIX) -lgcov/g' ${{env.DOCKER_WORKING_DIR}}/src/adjoint/Make/options_Incompressible | |
docker exec regtest sed -i 's/-std=c++11/-std=c++11 -fprofile-arcs -ftest-coverage/g' ${{env.DOCKER_WORKING_DIR}}/src/adjoint/Make/options_Compressible | |
docker exec regtest sed -i 's/-lfiniteVolume$(DF_LIB_SUFFIX)/-lfiniteVolume$(DF_LIB_SUFFIX) -lgcov/g' ${{env.DOCKER_WORKING_DIR}}/src/adjoint/Make/options_Compressible | |
docker exec regtest sed -i 's/-std=c++11/-std=c++11 -fprofile-arcs -ftest-coverage/g' ${{env.DOCKER_WORKING_DIR}}/src/adjoint/Make/options_Solid | |
docker exec regtest sed -i 's/-lfiniteVolume$(DF_LIB_SUFFIX)/-lfiniteVolume$(DF_LIB_SUFFIX) -lgcov/g' ${{env.DOCKER_WORKING_DIR}}/src/adjoint/Make/options_Solid | |
docker exec -i regtest /bin/bash -c "cd ${{env.DOCKER_WORKING_DIR}}/src && cp -r adjoint adjointAD && cp -r pyDASolvers pyDASolversAD" | |
if [ "${{matrix.args}}" = "forward" ]; then | |
docker exec -i regtest /bin/bash -c ". ${{env.DOCKER_ENV_FILE}} && cd ${{env.DOCKER_WORKING_DIR}} && ./Allmake incompressible" | |
docker exec -i -e DAFOAM_NO_WARNINGS=1 regtest /bin/bash -c ". ${{env.DOCKER_ENV_FILE}} && . ${{env.DOCKER_OF_ADF_BASHRC}} && cd ${{env.DOCKER_WORKING_DIR}}/src/adjointAD && ./Allmake incompressible && cd ../pyDASolversAD && ./Allmake incompressible " | |
elif [ "${{matrix.args}}" = "mphys_incomp" ]; then | |
docker exec -i regtest /bin/bash -c ". ${{env.DOCKER_ENV_FILE}} && cd ${{env.DOCKER_WORKING_DIR}} && ./Allmake incompressible" | |
docker exec -i -e DAFOAM_NO_WARNINGS=1 regtest /bin/bash -c ". ${{env.DOCKER_ENV_FILE}} && . ${{env.DOCKER_OF_ADR_BASHRC}} && cd ${{env.DOCKER_WORKING_DIR}}/src/adjointAD && ./Allmake incompressible && cd ../pyDASolversAD && ./Allmake incompressible " | |
elif [ "${{matrix.args}}" = "mphys_comp" ]; then | |
docker exec -i regtest /bin/bash -c ". ${{env.DOCKER_ENV_FILE}} && cd ${{env.DOCKER_WORKING_DIR}} && ./Allmake solid && ./Allclean && ./Allmake compressible" | |
docker exec -i -e DAFOAM_NO_WARNINGS=1 regtest /bin/bash -c ". ${{env.DOCKER_ENV_FILE}} && . ${{env.DOCKER_OF_ADR_BASHRC}} && cd ${{env.DOCKER_WORKING_DIR}}/src/adjointAD && ./Allmake solid && ./Allclean && ./Allmake compressible && cd ../pyDASolversAD && ./Allmake solid && ./Allclean && ./Allmake compressible " | |
else | |
docker exec -i regtest /bin/bash -c ". ${{env.DOCKER_ENV_FILE}} && cd ${{env.DOCKER_WORKING_DIR}} && ./Allmake ${{matrix.args}}" | |
docker exec -i -e DAFOAM_NO_WARNINGS=1 regtest /bin/bash -c ". ${{env.DOCKER_ENV_FILE}} && . ${{env.DOCKER_OF_ADR_BASHRC}} && cd ${{env.DOCKER_WORKING_DIR}}/src/adjointAD && ./Allmake ${{matrix.args}} && cd ../pyDASolversAD && ./Allmake ${{matrix.args}} " | |
fi | |
docker exec -i regtest /bin/bash -c ". ${{env.DOCKER_ENV_FILE}} && cd ${{env.DOCKER_WORKING_DIR}} && pip install ." | |
docker exec -i -e DF_CHECK_COVERAGE=1 regtest /bin/bash -c ". ${{env.DOCKER_ENV_FILE}} && cd ${{env.DOCKER_WORKING_DIR}}/tests && ./Allrun ${{matrix.args}}" | |
docker exec -i regtest /bin/bash -c ". ${{env.DOCKER_ENV_FILE}} && cd ${{env.DOCKER_WORKING_DIR}}/tests && coverage combine && coverage xml && echo dafoamuser | sudo -S cp -r coverage.xml ${{env.DOCKER_MOUNT_DIR}}/" | |
docker exec -i regtest /bin/bash -c ". ${{env.DOCKER_ENV_FILE}} && cd ${{env.DOCKER_WORKING_DIR}}/src/adjoint && cp -r ../include ./Make/linux*/DASolver/ && cp -r ../include ./Make/linux*/" | |
docker exec -i regtest /bin/bash -c ". ${{env.DOCKER_ENV_FILE}} && cd ${{env.DOCKER_WORKING_DIR}}/src/adjointAD && cp -r ../include ./Make/linux*/DASolver/ && cp -r ../include ./Make/linux*/" | |
docker exec -i regtest /bin/bash -c ". ${{env.DOCKER_ENV_FILE}} && cd ${{env.DOCKER_WORKING_DIR}} && lcov --capture --directory . --output-file coverage.info && echo dafoamuser | sudo -S cp -r coverage.info ${{env.DOCKER_MOUNT_DIR}}/" | |
curl -Os https://uploader.codecov.io/latest/linux/codecov | |
chmod +x codecov | |
./codecov |