From 6e60a0aa38d1553861afe5d7349ebd5b7ae37417 Mon Sep 17 00:00:00 2001 From: Mark Piper Date: Fri, 20 Oct 2023 14:42:21 -0600 Subject: [PATCH] Update CI (#16) * Rename workflow file to match other examples * Use micromamba; use one job for all os-es * Clean up workflow file * Change workflow name to match other examples --- .github/workflows/conda-and-cmake.yml | 106 -------------------------- .github/workflows/test.yml | 68 +++++++++++++++++ 2 files changed, 68 insertions(+), 106 deletions(-) delete mode 100644 .github/workflows/conda-and-cmake.yml create mode 100644 .github/workflows/test.yml diff --git a/.github/workflows/conda-and-cmake.yml b/.github/workflows/conda-and-cmake.yml deleted file mode 100644 index 4102e03..0000000 --- a/.github/workflows/conda-and-cmake.yml +++ /dev/null @@ -1,106 +0,0 @@ -name: Build/Test CI - -on: [push, pull_request] - -jobs: - build-linux-and-macos: - - if: - github.event_name == 'push' || github.event.pull_request.head.repo.full_name != - github.repository - - runs-on: ${{ matrix.os }} - - defaults: - run: - shell: bash -l {0} - - strategy: - matrix: - os: [ubuntu-latest, macos-latest] - python-version: ["3.8"] - build-type: [Release] - - steps: - - uses: actions/checkout@v2 - - - uses: conda-incubator/setup-miniconda@v2 - with: - auto-update-conda: true - python-version: ${{ matrix.python-version }} - channels: conda-forge - channel-priority: true - - - name: Show conda installation info - run: conda info - - - name: Install build tools and dependencies into env - run: | - conda install c-compiler cmake pkg-config bmi-c - conda list - - - name: Make cmake build directory - run: cmake -E make_directory build - - - name: Configure cmake - working-directory: ${{ github.workspace }}/build - run: cmake $GITHUB_WORKSPACE -DCMAKE_BUILD_TYPE=${{ matrix.build-type }} - - - name: Build - working-directory: ${{ github.workspace }}/build - run: cmake --build . --config ${{ matrix.build-type }} - - - name: Test - working-directory: ${{ github.workspace }}/build - run: ctest -C ${{ matrix.build-type }} --output-on-failure - - build-windows: - - if: - github.event_name == 'push' || github.event.pull_request.head.repo.full_name != - github.repository - - runs-on: windows-latest - - env: - build-type: Release - - steps: - - uses: actions/checkout@v2 - - - uses: conda-incubator/setup-miniconda@v2 - with: - auto-update-conda: true - python-version: 3.8 - channels: conda-forge - channel-priority: true - - - name: Show conda installation info - run: conda info - - - name: Install build tools and dependencies into env - run: | - conda install c-compiler cmake pkg-config bmi-c - conda list - - - name: Make cmake build directory - run: cmake -E make_directory build - - - name: Configure, build, and test - shell: cmd /C CALL {0} - working-directory: ${{ github.workspace }}\build - run: | - call "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Auxiliary\Build\vcvars64.bat" -vcvars_ver=14.16 10.0.19041.0 - - :: Configure - cmake ^ - -LAH -G "NMake Makefiles" ^ - -DPKG_CONFIG_EXECUTABLE:FILEPATH=C:/Miniconda/envs/test/Library/bin/pkg-config.exe ^ - -DCMAKE_BUILD_TYPE=${{ env.build-type }} ^ - .. - - :: Build and install - cmake --build . --target install --config ${{ env.build-type }} - - :: Test - ctest --output-on-failure -C ${{ env.build-type }} -V diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 0000000..d683523 --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,68 @@ +name: Build/Test + +on: [push, pull_request] + +jobs: + build-and-test: + + if: + github.event_name == 'push' || github.event.pull_request.head.repo.full_name != + github.repository + + runs-on: ${{ matrix.os }} + + defaults: + run: + shell: bash -l {0} + + strategy: + matrix: + os: [ubuntu-latest, macos-latest, windows-latest] + build-type: [Release] + + steps: + - uses: actions/checkout@v4 + + - uses: mamba-org/setup-micromamba@v1 + with: + micromamba-version: latest + environment-name: testing + init-shell: >- + bash + powershell + create-args: >- + make + cmake + c-compiler + pkg-config + bmi-c + + - name: Make CMake build directory + run: cmake -E make_directory build + + - name: Configure CMake (Unix) + if: matrix.os == 'ubuntu-latest' || matrix.os == 'macos-latest' + working-directory: ${{ github.workspace }}/build + run: | + cmake ${{ github.workspace }} \ + -DCMAKE_BUILD_TYPE=${{ matrix.build-type }} \ + -DCMAKE_INSTALL_PREFIX=$CONDA_PREFIX + + - name: Configure CMake (Windows) + if: matrix.os == 'windows-latest' + working-directory: ${{ github.workspace }}\build + shell: pwsh + run: | + & "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvars64.bat" x86 + + cmake ${{ github.workspace }} ` + -DCMAKE_INSTALL_PREFIX:PATH=$env:CONDA_PREFIX\Library ` + -DCMAKE_BUILD_TYPE=${{ matrix.build-type }} + + - name: Build and install + working-directory: ${{ github.workspace }}/build + run: cmake --build . --target install --config ${{ matrix.build-type }} + + - name: Test + working-directory: ${{ github.workspace }}/build + run: ctest -C ${{ matrix.build-type }} --output-on-failure -VV