Merge pull request #322 from akutuva21/master #352
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
| # This workflows will upload a Python Package using Twine when a release is created | |
| # For more information see: https://help.github.com/en/actions/language-and-framework-guides/using-python-with-github-actions#publishing-to-package-registries | |
| name: validation | |
| on: | |
| push: | |
| branches: [ master ] | |
| pull_request: | |
| branches: [ master ] | |
| env: | |
| # Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.) | |
| BUILD_TYPE: Release | |
| jobs: | |
| build_and_validate: | |
| # The type of runner that the job will run on | |
| name: ${{ matrix.config.name }} | |
| runs-on: ${{ matrix.config.os }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| config: | |
| - { | |
| name: "windows", | |
| os: windows-latest, | |
| artifact: "bng_windows_cygwin.7z", | |
| build_type: "Release", | |
| cc: "gcc", | |
| cxx: "g++", | |
| archiver: "7z a", | |
| generators: "Ninja" | |
| } | |
| - { | |
| name: "linux", | |
| os: ubuntu-22.04, | |
| artifact: "bng_ubuntu_gcc.7z", | |
| build_type: "Release", | |
| cc: "gcc", | |
| cxx: "g++", | |
| archiver: "7z a", | |
| generators: "Ninja" | |
| } | |
| - { | |
| name: "mac", | |
| os: macos-latest, | |
| artifact: "bng_macos_clang.7z", | |
| build_type: "Release", | |
| cc: "clang", | |
| cxx: "clang++", | |
| archiver: "7za a", | |
| generators: "Ninja" | |
| } | |
| steps: | |
| - name: Checkout repo # and submodules | |
| uses: actions/checkout@v4 | |
| with: | |
| submodules: recursive | |
| # Windows setup | |
| - name: Set up Cygwin | |
| if: startsWith(matrix.config.os, 'windows') | |
| uses: egor-tensin/setup-cygwin@v4 | |
| with: | |
| packages: cmake gcc-g++ autoconf automake libtool dos2unix pkg-config make | |
| # - name: Setup tmate session | |
| # uses: mxschmitt/action-tmate@v3 | |
| - name: Setup ninja on windows | |
| if: startsWith(matrix.config.os, 'windows') | |
| uses: seanmiddleditch/gha-setup-ninja@v3 | |
| - name: Setup windows and untar libs | |
| if: startsWith(matrix.config.os, 'windows') | |
| working-directory: ./bng2 | |
| shell: C:\tools\cygwin\bin\bash.exe --login --norc -eo pipefail -o igncr '{0}' | |
| run: | | |
| cd /cygdrive/d/a/bionetgen/bionetgen/bng2/Network3 | |
| mkdir -p m4 | |
| dos2unix configure.ac Makefile.am Makefile.cmake | |
| tar xvfz ../libsource/cvode-2.6.0.tar.gz | |
| tar xvfz ../libsource/muparser_v2_2_4.tar.gz | |
| # Unix setup | |
| - name: Install dependencies on ubuntu | |
| if: startsWith(matrix.config.name, 'linux') | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install cmake | |
| cmake --version | |
| gcc --version | |
| - name: Install dependencies on macos | |
| if: startsWith(matrix.config.os, 'mac') | |
| # also install p7zip if we are achiving | |
| run: | | |
| brew install cmake | |
| cmake --version | |
| # look at environment variables for debugging | |
| - name: Print env | |
| run: | | |
| echo github.event.action: ${{ github.event.action }} | |
| echo github.event_name: ${{ github.event_name }} | |
| # Mac compilation | |
| - name: Make-Mac | |
| if: ${{ startsWith(matrix.config.name, 'mac') }} | |
| shell: bash | |
| working-directory: ./bng2 | |
| run: | | |
| # Set flags to make universal binaries | |
| export "CC=clang" | |
| export "CXX=clang++" | |
| export "CFLAGS=-arch arm64 -arch x86_64" | |
| export "CXXFLAGS=-arch arm64 -arch x86_64" | |
| export "LDFLAGS=-arch arm64 -arch x86_64" | |
| export "CMAKE_OSX_ARCHITECTURES=arm64;x86_64" | |
| make | |
| # Linux compilation | |
| - name: Make-Linux | |
| if: ${{ startsWith(matrix.config.name, 'linux') }} | |
| shell: bash | |
| working-directory: ./bng2 | |
| run: | | |
| make | |
| # Windows compilation | |
| - name: Make-network-windows | |
| if: startsWith(matrix.config.name, 'windows') | |
| shell: C:\tools\cygwin\bin\bash.exe --login --norc -eo pipefail -o igncr '{0}' | |
| run: | | |
| cd /cygdrive/d/a/bionetgen/bionetgen/bng2 | |
| export _BNGPATH=$PWD | |
| cd Network3 | |
| autoreconf --no-recursive --install | |
| ./configure --disable-shared --prefix=${_BNGPATH} | |
| make | |
| mkdir -p /cygdrive/d/a/bionetgen/bionetgen/bng2/bin | |
| cp src/run_network.exe /cygdrive/d/a/bionetgen/bionetgen/bng2/bin/run_network.exe | |
| # now everything is compiled, we validate | |
| # windows validation | |
| - name: validate for windows | |
| if: startsWith(matrix.config.name, 'windows') | |
| shell: C:\tools\cygwin\bin\bash.exe --login --norc -eo pipefail -o igncr '{0}' | |
| run: | | |
| cd /cygdrive/d/a/bionetgen/bionetgen/bng2/Validate | |
| perl validate_examples.pl | |
| # unix validation | |
| - name: validate for mac/linux | |
| if: ${{ startsWith(matrix.config.name, 'mac') || startsWith(matrix.config.name, 'linux') }} | |
| shell: bash | |
| working-directory: ./bng2/Validate | |
| run: | | |
| perl validate_examples.pl | |
| # bundling everything | |
| # unix first | |
| - name: Prepare mac/linux bundle | |
| if: ${{ startsWith(matrix.config.name, 'mac') || startsWith(matrix.config.name, 'linux') }} | |
| working-directory: ./bng2 | |
| run: | | |
| mkdir -p bng_bundle | |
| cp BNG2.pl CHANGES.txt CREDITS.txt ../LICENSE VERSION bng_bundle/. | |
| cp -r Models2 Network3 Perl2 Validate bin bng_bundle/. | |
| tar cvf bng_bundle.tar bng_bundle | |
| - name: Archive mac/linux bundle | |
| if: ${{ startsWith(matrix.config.name, 'mac') || startsWith(matrix.config.name, 'linux') }} | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: bng_bundle_${{ matrix.config.name }} | |
| path: ${{github.workspace}}/bng2/bng_bundle.tar | |
| # windows next | |
| - name: Prepare windows bundle | |
| if: startsWith(matrix.config.name, 'windows') | |
| run: | | |
| cd D:/a/bionetgen/bionetgen/bng2 | |
| mkdir -p bng_bundle | |
| cp BNG2.pl bng_bundle/. | |
| cp CHANGES.txt bng_bundle/. | |
| cp CREDITS.txt bng_bundle/. | |
| cp ../LICENSE bng_bundle/. | |
| cp VERSION bng_bundle/. | |
| cp -r Models2 bng_bundle/. | |
| cp -r Network3 bng_bundle/. | |
| cp -r Perl2 bng_bundle/. | |
| cp -r Validate bng_bundle/. | |
| cp -r bin bng_bundle/. | |
| cp C:/tools/cygwin/bin/cygwin*dll bng_bundle/bin/. | |
| cp C:/tools/cygwin/bin/cygstdc*dll bng_bundle/bin/. | |
| cp C:/tools/cygwin/bin/cygz*dll bng_bundle/bin/. | |
| cp C:/tools/cygwin/bin/cyggcc*dll bng_bundle/bin/. | |
| tar cvf bng_bundle.tar bng_bundle | |
| # /c/tools/cygwin/bin/cygwin1.dll | |
| # needed files: cygwin1.dll,cygstdc++-6.dll,cygz.dll,cyggcc_s-seh-1.dll | |
| # potentially we also need 1) libgcc_s_dw2-1.dll, 2) libstdc++-6.dll | |
| - name: Archive windows bundle | |
| if: startsWith(matrix.config.name, 'windows') | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: bng_bundle_${{ matrix.config.name }} | |
| path: D:/a/bionetgen/bionetgen/bng2/bng_bundle.tar |