test: Fix runSimulation tests #184
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
# The validation pipeline. Currently, runs the example provided by OpenMalaria | |
# itself and generates the same xml (in terms of input) via | |
# openMalariaUtilities. Both files are used for a simulation and the two output | |
# files compared, as they should be identical. | |
# REVIEW Over time, this should be extended to a more involved example and also | |
# include steps like the data processing. As this workflow gets more | |
# involved, it is probably a good idea to limit it to the master branch | |
# or only to releases. | |
on: | |
push: | |
branches: | |
- master | |
- develop | |
pull_request: | |
branches: | |
- master | |
- develop | |
name: OpenMalaria validation | |
jobs: | |
job_1: | |
name: OpenMalaria example | |
runs-on: ubuntu-20.04 | |
steps: | |
- name: Setup OpenMalaria | |
shell: bash | |
run : | | |
wget https://github.com/SwissTPH/openmalaria/releases/download/schema-44.0/openMalaria-ubuntu-20.04.tar.gz -O openMalaria-ubuntu-20.04.tar.gz | |
tar -xf openMalaria-ubuntu-20.04.tar.gz && rm openMalaria-ubuntu-20.04.tar.gz | |
sudo apt-get install -y libboost-dev libgsl-dev libxerces-c-dev xsdcxx | |
echo "$GITHUB_WORKSPACE/openMalaria-ubuntu-20.04" >> $GITHUB_PATH | |
- name: Run OpenMalaria example xml | |
shell: bash | |
run : | | |
cd openMalaria-ubuntu-20.04 | |
openMalaria -s example_scenario.xml --verbose | |
- name: Store OpenMalaria output | |
uses: actions/upload-artifact@v3 | |
with: | |
name: output-OM | |
path: openMalaria-ubuntu-20.04/output.txt | |
job_2: | |
name: openMalariaUtilities example | |
runs-on: ubuntu-20.04 | |
strategy: | |
fail-fast: false | |
env: | |
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} | |
R_KEEP_PKG_SOURCE: yes | |
steps: | |
- uses: actions/checkout@v2 | |
- uses: r-lib/actions/setup-r@v2 | |
with: | |
r-version: ${{ matrix.config.r }} | |
http-user-agent: ${{ matrix.config.http-user-agent }} | |
use-public-rspm: true | |
- uses: r-lib/actions/setup-r-dependencies@v2 | |
with: | |
extra-packages: devtools | |
- name: Setup OpenMalaria | |
shell: bash | |
run : | | |
wget https://github.com/SwissTPH/openmalaria/releases/download/schema-44.0/openMalaria-ubuntu-20.04.tar.gz -O openMalaria-ubuntu-20.04.tar.gz | |
tar -xf openMalaria-ubuntu-20.04.tar.gz && rm openMalaria-ubuntu-20.04.tar.gz | |
sudo apt-get install -y libboost-dev libgsl-dev libxerces-c-dev xsdcxx | |
echo "$GITHUB_WORKSPACE/openMalaria-ubuntu-20.04" >> $GITHUB_PATH | |
- name: Run OMU script in R | |
run: | | |
source(".github/workflows/example.R") | |
shell: Rscript {0} | |
- name: Store package output | |
uses: actions/upload-artifact@v3 | |
with: | |
name: output-package | |
path: exp_test/outputs/exp_test_1_out.txt | |
job_3: | |
name: Compare results | |
needs: [job_1, job_2] | |
runs-on: ubuntu-latest | |
steps: | |
- name: Download result from job 1 | |
uses: actions/download-artifact@v3 | |
with: | |
name: output-OM | |
- name: Download result from job 2 | |
uses: actions/download-artifact@v3 | |
with: | |
name: output-package | |
- name: Compare results | |
shell: bash | |
run: | | |
if cmp --silent -- exp_test_1_out.txt output.txt; then | |
echo "### SUCCESS: Output files are identical! ###" | |
exit 0 | |
else | |
echo "### Warning: Output files differ! ###" | |
exit 1 | |
fi |