From 3ebe5440bdec02babc3ddbbe0f6474f9e407e872 Mon Sep 17 00:00:00 2001 From: Alicia Klinvex <64440832+amklinv-nnl@users.noreply.github.com> Date: Tue, 18 May 2021 15:10:34 -0400 Subject: [PATCH] Add github actions --- .github/workflows/cmake.yml | 101 ++++++++++++++++++++++++++++++++++++ 1 file changed, 101 insertions(+) create mode 100644 .github/workflows/cmake.yml diff --git a/.github/workflows/cmake.yml b/.github/workflows/cmake.yml new file mode 100644 index 0000000..53ba073 --- /dev/null +++ b/.github/workflows/cmake.yml @@ -0,0 +1,101 @@ +name: CMake + +on: [push, pull_request] + +env: + BUILD_TYPE: RelWithDebInfo + +jobs: + build-mdspan: + runs-on: ubuntu-latest + + steps: + + - id: get-sha + run: echo ::set-output name=sha::$( curl https://api.github.com/repos/kokkos/mdspan/git/ref/heads/stable | jq .object.sha | tr -d '"' ) + + - name: Determine whether mdspan needs to be rebuilt + id: cache-mdspan + uses: actions/cache@v2 + with: + path: ${{github.workspace}}/mdspan-install + key: mdspan-${{ steps.get-sha.outputs.sha }} + + - name: Create Build Environment + if: steps.cache-mdspan.outputs.cache-hit != 'true' + run: cmake -E make_directory ${{github.workspace}}/mdspan-build + + - name: Check Out + if: steps.cache-mdspan.outputs.cache-hit != 'true' + uses: actions/checkout@v2 + with: + repository: kokkos/mdspan + path: ${{github.workspace}}/mdspan-src + + - name: Configure CMake + if: steps.cache-mdspan.outputs.cache-hit != 'true' + shell: bash + working-directory: ${{github.workspace}}/mdspan-build + run: cmake $GITHUB_WORKSPACE/mdspan-src -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DCMAKE_INSTALL_PREFIX=$GITHUB_WORKSPACE/mdspan-install + + - name: Build + if: steps.cache-mdspan.outputs.cache-hit != 'true' + shell: bash + working-directory: ${{github.workspace}}/mdspan-build + run: make + + - name: Install + if: steps.cache-mdspan.outputs.cache-hit != 'true' + shell: bash + working-directory: ${{github.workspace}}/mdspan-build + run: make install + + - name: Upload + uses: actions/upload-artifact@v2 + with: + name: mdspan + path: ${{github.workspace}}/mdspan-install + + build-mdarray: + runs-on: ubuntu-latest + needs: build-mdspan + + steps: + + - name: Download mdspan + if: steps.cache-mdspan.outputs.cache-hit != 'true' + uses: actions/download-artifact@v2 + with: + name: mdspan + path: ${{github.workspace}}/mdspan-install + + - name: Install gtest manually + run: sudo apt-get install libgtest-dev && cd /usr/src/gtest && sudo cmake CMakeLists.txt && sudo make && sudo cp lib/*.a /usr/lib && sudo ln -s /usr/lib/libgtest.a /usr/local/lib/libgtest.a && sudo ln -s /usr/lib/libgtest_main.a /usr/local/lib/libgtest_main.a + + - name: Create Build Environment + run: cmake -E make_directory ${{github.workspace}}/mdarray-build + + - name: Check Out + uses: actions/checkout@v2 + with: + path: ${{github.workspace}}/mdarray-src + + - name: Configure CMake + shell: bash + working-directory: ${{github.workspace}}/mdarray-build + run: cmake $GITHUB_WORKSPACE/mdarray-src -Dmdspan_DIR=$GITHUB_WORKSPACE/mdspan-install/lib/cmake/mdspan -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DMDARRAY_ENABLE_TESTS=ON -DMDARRAY_ENABLE_EXAMPLES=ON -DCMAKE_INSTALL_PREFIX=$GITHUB_WORKSPACE/mdarray-install + + - name: Build + shell: bash + working-directory: ${{github.workspace}}/mdarray-build + run: make + + - name: Test + working-directory: ${{github.workspace}}/mdarray-build + shell: bash + run: ctest + + - name: Install + shell: bash + working-directory: ${{github.workspace}}/mdarray-build + run: make install