Fix hard coded values and add conda libraries preferentially during d… #78
This file contains hidden or 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: Verify that MATLAB & C++ versions return the same answers | |
| 'on': | |
| push: | |
| branches-ignore: | |
| - gh-pages | |
| tags: | |
| - '*' | |
| schedule: | |
| - cron: 0 10 * * 1 | |
| jobs: | |
| build_cxx: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Check out repository code | |
| uses: actions/checkout@v4 | |
| with: | |
| submodules: true | |
| - name: Check out MATLAB repository code | |
| run: | | |
| git clone https://github.com/cropsinsilico/ePhotosynthesis.git | |
| cd ePhotosynthesis | |
| git checkout C3-metabolic-and-leaf-model-compare | |
| cd .. | |
| - name: Set up MATLAB | |
| uses: matlab-actions/setup-matlab@v2 | |
| - name: Set up miniconda test environment | |
| uses: conda-incubator/setup-miniconda@v3 | |
| with: | |
| activate-environment: ephoto | |
| environment-file: environment.yml | |
| auto-update-conda: true | |
| channels: conda-forge | |
| channel-priority: strict | |
| miniforge-variant: Miniforge3 | |
| miniforge-version: latest | |
| - name: Install compilers using conda on Linux/Mac | |
| run: | | |
| conda install c-compiler cxx-compiler | |
| - name: Global config flags | |
| shell: bash -l {0} | |
| run: | | |
| echo "CMAKE_BUILD_TYPE_TEST=Debug" >> "$GITHUB_ENV" | |
| echo "CMAKE_ARGS=-DCMAKE_VERBOSE_MAKEFILE:BOOL=ON -DMAKE_EQUIVALENT_TO_MATLAB:BOOL=ON" >> "$GITHUB_ENV" | |
| echo "DEVTASKS_ARGS=--driver 4 --matlab-repo ePhotosynthesis" >> "$GITHUB_ENV" | |
| - name: Configure (CONDA) | |
| shell: bash -l {0} | |
| run: | | |
| mkdir build | |
| cd build | |
| which cmake | |
| cmake .. ${{ env.CMAKE_ARGS }} | |
| - name: Build C++ & C (CONDA) | |
| shell: bash -l {0} | |
| run: | | |
| cd build | |
| cmake --build . --config ${{ env.CMAKE_BUILD_TYPE_TEST }} -- -j 4 | |
| - name: Run C++ version & Generate MATLAB script | |
| shell: bash -l {0} | |
| run: | | |
| python scripts/devtasks.py compare-matlab ${{ env.DEVTASKS_ARGS }} --generate-matlab-script run_ephoto.m --dont-run-matlab | |
| # ./build/ePhoto -d 4 --enzyme InputEnzyme.txt --grn InputGRNC_MATLAB.txt --outputParam | |
| - name: Run MATLAB version | |
| uses: matlab-actions/run-command@v2 | |
| with: | |
| # command: cd("ePhotosynthesis"), ePhotosynthesis(4, "../InputEvn_MATLAB.txt", "../InputEnzyme.txt", "../InputGRNC_MATLAB.txt", "../InputATPCost.txt", "output.data", 1) | |
| command: run_ephoto | |
| startup-options: -nodisplay -nosplash -nodesktop -nojvm -logfile matlab_log.txt | |
| - name: Display MATLAB log | |
| run: cat matlab_log.txt | |
| - name: Get diff | |
| shell: bash -l {0} | |
| run: | | |
| python scripts/devtasks.py compare-matlab ${{ env.DEVTASKS_ARGS }} --diff --abstol 0.01 --reltol 0.001 |