Skip to content
This repository has been archived by the owner on Sep 18, 2024. It is now read-only.

Add github actions #8

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
101 changes: 101 additions & 0 deletions .github/workflows/cmake.yml
Original file line number Diff line number Diff line change
@@ -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