- fix an issue with local variable shadowing const #941
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: Build and Test | |
| on: | |
| workflow_dispatch: | |
| inputs: | |
| build_type: | |
| description: CMake build type | |
| type: choice | |
| required: true | |
| default: Release | |
| options: | |
| - Release | |
| - Debug | |
| - RelWithDebInfo | |
| - MinSizeRel | |
| run_valgrind: | |
| description: Run tests under Valgrind (Ubuntu only) | |
| type: boolean | |
| required: false | |
| default: false | |
| push: | |
| paths: | |
| - "**" | |
| - "!.github/**" | |
| - ".github/workflows/copasi_se.yml" | |
| env: | |
| BUILD_TYPE: ${{ github.event.inputs.build_type || 'Release' }} | |
| jobs: | |
| build: | |
| name: | |
| ${{ matrix.platform }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| platform: [ubuntu-latest, macos-latest, windows-latest] | |
| runs-on: ${{ matrix.platform }} | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: seanmiddleditch/gha-setup-ninja@master | |
| - name: Add msbuild to PATH (Windows) | |
| if: matrix.platform == 'windows-latest' | |
| uses: ilammy/msvc-dev-cmd@v1.6.0 | |
| - name: Create Build Environment | |
| # Some projects don't allow in-source building, so create a separate build directory | |
| # We'll use this as our working directory for all subsequent commands | |
| shell: bash | |
| run: | | |
| cmake --version | |
| curl -L https://github.com/copasi/copasi-dependencies/releases/latest/download/${{ matrix.platform }}.zip -o ${{ matrix.platform }}.zip | |
| unzip -n -qq ${{ matrix.platform }}.zip -d dependencies | |
| - name: Patch dependencies (windows) | |
| shell: bash | |
| if: matrix.platform == 'windows-latest' | |
| working-directory: ${{github.workspace}}/dependencies/lib/cmake | |
| run: | | |
| sed -i 's|D:/a/copasi-dependencies/copasi-dependencies/install/|${_IMPORT_PREFIX}/|g' *.cmake | |
| - name: Patch dependencies (ubuntu) | |
| shell: bash | |
| if: matrix.platform == 'ubuntu-latest' | |
| working-directory: ${{github.workspace}}/dependencies/lib/cmake | |
| run: | | |
| sed -i 's|/home/runner/work/copasi-dependencies/copasi-dependencies/install/|${_IMPORT_PREFIX}/|g' *.cmake | |
| sudo apt update | |
| sudo apt install -y uuid-dev | |
| - name: Patch dependencies (mac) | |
| shell: bash | |
| if: matrix.platform == 'macos-latest' | |
| working-directory: ${{github.workspace}}/dependencies/lib/cmake | |
| run: | | |
| sed -i '.tmp' 's|/Users/runner/work/copasi-dependencies/copasi-dependencies/install/|${_IMPORT_PREFIX}/|g' *.cmake | |
| rm lapack* | |
| rm ../libblas.a | |
| rm ../liblapack.a | |
| rm ../libf2c.a | |
| rm ../../include/clapack.h | |
| rm ../../include/lapack.h | |
| rm ../../include/blaswrap.h | |
| rm ../../include/f2c.h | |
| - name: Update COPASI Version | |
| shell: bash | |
| working-directory: ${{github.workspace}} | |
| run: ./gitTools/UpdateCopasiVersion | |
| - name: Download SBML Test Suite cases | |
| shell: bash | |
| working-directory: ${{github.workspace}} | |
| run: | | |
| curl -L https://copasi.org/static/test-suite.zip -o test-suite.zip | |
| unzip -n -qq test-suite.zip | |
| - name: Configure COPASI (mac) | |
| shell: bash | |
| if: matrix.platform == 'macos-latest' | |
| run: | | |
| cmake -G Ninja -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DCOPASI_INSTALL_C_API=ON -DSBML_TESTSUITE_RUN=ON -DBUILD_TESTS=ON -DBUILD_GUI=OFF -DENABLE_JIT=OFF -DCOPASI_DEPENDENCY_DIR=./dependencies/ -DCMAKE_INSTALL_PREFIX=./install/ -DBUILD_SBML_TESTSUITE:BOOL=ON -DSBML_TESTSUITE_CASES_DIR:PATH=$PWD/test-suite -S . -B ./build_copasi | |
| - name: Configure COPASI | |
| shell: bash | |
| if: matrix.platform != 'macos-latest' | |
| run: | | |
| cmake -G Ninja -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DCOPASI_INSTALL_C_API=ON -DSBML_TESTSUITE_RUN=ON -DBUILD_TESTS=ON -DBUILD_GUI=OFF -DCOPASI_DEPENDENCY_DIR=./dependencies/ -DCMAKE_INSTALL_PREFIX=./install/ -DBUILD_SBML_TESTSUITE:BOOL=ON -DSBML_TESTSUITE_CASES_DIR:PATH=$PWD/test-suite -S . -B ./build_copasi | |
| - name: Build COPASI | |
| shell: bash | |
| working-directory: ${{github.workspace}}/build_copasi | |
| run: cmake --build . --config $BUILD_TYPE | |
| - name: Install COPASI | |
| shell: bash | |
| working-directory: ${{github.workspace}}/build_copasi | |
| run: cmake --build . --config $BUILD_TYPE --target install | |
| - name: Run test_api under GDB and valgrind | |
| if: matrix.platform == 'ubuntu-latest' && github.event.inputs.run_valgrind == 'true' | |
| working-directory: ${{github.workspace}}/build_copasi | |
| shell: bash | |
| run: | | |
| export srcdir="${{github.workspace}}/tests" | |
| TEST_API="$PWD/tests/test_api" | |
| sudo apt-get install -y gdb valgrind | |
| gdb -batch \ | |
| -ex "set pagination off" \ | |
| -ex run \ | |
| -ex "thread apply all bt full" \ | |
| -ex quit \ | |
| -- "$TEST_API" || true | |
| valgrind --leak-check=full --show-leak-kinds=all --track-origins=yes --error-exitcode=1 --error-limit=no $TEST_API | |
| - name: Test | |
| working-directory: ${{github.workspace}}/build_copasi | |
| shell: bash | |
| run: ctest -C $BUILD_TYPE -V | |
| - name: binary archive | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: | |
| copasi-se-${{ matrix.platform }} | |
| path: ${{github.workspace}}/install/* | |
| retention-days: 10 | |
| if-no-files-found: error |