Skip to content

Build and test kokkos before pushing an updated container #283

Build and test kokkos before pushing an updated container

Build and test kokkos before pushing an updated container #283

name: CI
on:
push:
branches:
- main
pull_request:
branches:
- main
schedule:
- cron: '0 5 * * FRI'
jobs:
CI:
strategy:
matrix:
config:
- {dockerfile: 'fedora', tag: 'latest'}
- {dockerfile: 'fedora', tag: 'rawhide', build_args: 'TAG=rawhide', continue-on-error: 'true'}
- {dockerfile: 'ubuntu', tag: 'latest'}
- {dockerfile: 'ubuntu', tag: 'rolling', build_args: 'TAG=rolling'}
- {dockerfile: 'ubuntu', tag: 'devel', build_args: 'TAG=devel', continue-on-error: 'true'}
- {dockerfile: 'ubuntu', tag: 'intel', build_args: 'TAG=22.04,INTEL=yes', cmake_args: '-DCMAKE_CXX_COMPILER=icpx -DCMAKE_CXX_FLAGS=-fp-model=precise', continue-on-error: 'true'}
- {dockerfile: 'opensuse', tag: 'latest'}
- {dockerfile: 'fedora', tag: 'intel', build_args: 'TAG=37,INTEL=yes', cmake_args: '-DCMAKE_CXX_COMPILER=icpc', continue-on-error: 'true'}
continue-on-error: ${{ matrix.config.continue-on-error == 'true' }}
env:
docker-tag: ghcr.io/kokkos/ci-containers/${{ matrix.config.dockerfile }}:${{ matrix.config.tag }}
runs-on: ubuntu-latest
steps:
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Login to Github Container Registry
uses: docker/login-action@v2
if: github.repository_owner == 'kokkos' && ( github.event_name == 'push' || github.event_name == 'schedule' )
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Convert build_args
id: build_args
run: |
echo "args<<EOF" >> $GITHUB_OUTPUT
echo ${{ matrix.config.build_args }} | sed 's/,/\n/g' >> $GITHUB_OUTPUT
echo "EOF" >> $GITHUB_OUTPUT
- name: Build new image and Load it into Docker for testing
uses: docker/build-push-action@v4
with:
tags: ${{ env.docker-tag }}
file: ${{ matrix.config.dockerfile }}
build-args: ${{ steps.build_args.outputs.args }}
pull: true
push: false
load: true
- name: Checkout kokkos
uses: actions/checkout@v3
with:
repository: kokkos/kokkos
ref: develop
path: kokkos
- name: Build and Test Kokkos using updated image
run: |
docker run -t --rm -v ${{ github.workspace }}/kokkos:/kokkos -w /kokkos ${{ env.docker-tag }} \
sh -c \
"cmake -B builddir \
${{ matrix.config.cmake_args }} \
-DKokkos_ENABLE_HWLOC=ON \
-DKokkos_ENABLE_BENCHMARKS=ON \
-DKokkos_ENABLE_EXAMPLES=ON \
-DKokkos_ENABLE_TESTS=ON \
-DKokkos_ENABLE_SERIAL=ON \
-DKokkos_ENABLE_OPENMP=ON && \
cmake --build builddir --parallel 2 && \
ctest --test-dir builddir --output-on-failure"
- name: Push the image into Github Container Registry
uses: docker/build-push-action@v4
if: ${{ github.repository_owner == 'kokkos' && ( github.event_name == 'push' || github.event_name == 'schedule' ) }}
with:
tags: ${{ env.docker-tag }}
file: ${{ matrix.config.dockerfile }}
push: true