Skip to content

Unit tests

Unit tests #1485

Workflow file for this run

name: Unit tests
on:
pull_request:
branches: [main]
push:
branches: [main]
workflow_dispatch:
inputs:
debug_enabled:
type: boolean
description: 'Run the build with tmate debugging enabled'
required: false
default: false
env:
# Increase to reset cache manually
CACHE_NUMBER: 1
POCL_CACHE_NUMBER: 1
jobs:
ci:
runs-on: ubuntu-latest
defaults:
run:
shell: bash -l {0}
strategy:
matrix:
compiler: [gcc-10, clang-12]
fail-fast: false
name: "${{ matrix.compiler }}"
env:
CC: ${{ matrix.compiler }}
steps:
- name: Setup Github actions
uses: actions/checkout@v3
- name: Setup tmate session
uses: mxschmitt/action-tmate@v3.13
if: ${{ inputs.debug_enabled }}
- name: Setup conda-forge
id: setup_conda
uses: conda-incubator/setup-miniconda@v2
with:
activate-environment: libnomp
use-mamba: false
- name: Cache conda environment
uses: actions/cache@v3
with:
path: ${{ env.CONDA }}/envs/libnomp
key: conda-${{ runner.os }}-${{ hashFiles('environment.yml') }}-${{ hashFiles('requirements.txt') }}-${{ env.CACHE_NUMBER }}
id: cache
- name: Update environment
id: update_env
run: |
conda env update -n libnomp -f environment.yml
if: steps.cache.outputs.cache-hit != 'true'
- uses: actions/cache@v3
with:
path: ~/conda_pkgs_dir/pocl
key: ${{ runner.os }}-build-pocl-${{ env.POCL_CACHE_NUMBER }}
id: pocl_cache
- name: Install pocl
id: install_pocl
run: |
conda install -c conda-forge pocl
if: (steps.pocl_cache.outputs.cache-hit != 'true') || (steps.cache.outputs.cache-hit != 'true')
- name: Build libnomp
id: build_libnomp
run: |
echo "NOMP_INSTALL_DIR=${PWD}/../install" >> $GITHUB_ENV
./lncfg -idir ../install -opencl --opencl-lib "${CONDA_PREFIX}/lib/libOpenCL.so"
./lninstall --no
- name: Run libnomp tests
id: run_libnomp
run: |
"${NOMP_INSTALL_DIR}/bin/lnrun" test
- name: Block to allow inspecting failures
run: sleep 30m
if: ${{ failure() && inputs.debug_enabled }}