Skip to content

Fix: test compile and run #236

Fix: test compile and run

Fix: test compile and run #236

Workflow file for this run

# This is a basic workflow to help you get started with Actions
name: Run all CMake Tests
# Controls when the workflow will run
on:
# Triggers the workflow on push or pull request events but only for the "master" branch
push:
branches: [ "master", "release" ]
tags: ["v*"]
pull_request:
branches: [ "master" ]
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
env:
OMP_NUM_THREADS: 2
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
# This workflow contains a single job called "build"
ubuntu-test:
# The type of runner that the job will run on
runs-on: ubuntu-24.04
strategy:
matrix:
openmp: [TRUE, FALSE]
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- name: Checkout
uses: actions/checkout@v3
- name: Install dependencies
run: |
sudo apt-get -qq update
sudo apt-get -qq install libarmadillo-dev libopenblas-dev libgsl-dev libopenmpi-dev catch2
# Runs the test container to run test scripts
- name: CMake test
run: |
cmake -B build -S . -DCMAKE_BUILD_TYPE:STRING=Debug -DENABLE_OpenMP=${{ matrix.openmp }}
cmake --build build --config Debug
ctest --test-dir build --output-on-failure
windows-test:
runs-on: windows-2019
strategy:
matrix:
openmp: [TRUE, FALSE]
env:
USERNAME: GWmodel-Lab
FEED_URL: https://nuget.pkg.github.com/GWmodel-Lab/index.json
VCPKG_BINARY_SOURCES: "clear;nuget,github,readwrite"
VCPKG_USE_NUGET_CACHE: 1
permissions:
contents: read
packages: write
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Scrollback Vcpkg
shell: pwsh
run: |
cd "$env:VCPKG_INSTALLATION_ROOT"
git switch 2023.12.12 --detach
- name: Setup NuGet Credentials
shell: pwsh
run: |
$VCPKG_EXE="$env:VCPKG_INSTALLATION_ROOT/vcpkg.exe"
$NUGET_EXE="$(.$VCPKG_EXE fetch nuget)"
.$NUGET_EXE sources add -Source ${{ env.FEED_URL }} -Name github -UserName ${{ env.USERNAME }} -Password ${{ secrets.GITHUB_TOKEN }} -StorePasswordInClearText
.$NUGET_EXE setapikey ${{ secrets.GITHUB_TOKEN }} -Source "${{ env.FEED_URL }}"
- name: Vcpkg Package Restore
shell: pwsh
run: |
$VCPKG_EXE="$env:VCPKG_INSTALLATION_ROOT/vcpkg.exe"
.$VCPKG_EXE install armadillo gsl catch2 openblas[threads] --triplet x64-windows
- name: CMake build and test
run: |
mkdir build
cmake -B build -S . "-DCMAKE_TOOLCHAIN_FILE=$env:VCPKG_INSTALLATION_ROOT\scripts\buildsystems\vcpkg.cmake" -DCMAKE_BUILD_TYPE=Debug -DENABLE_OpenMP=${{ matrix.openmp }}
cmake --build build --config Debug
ctest --test-dir build -C Debug --output-on-failure
macos-test:
runs-on: macos-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Install Dependencies
run: brew install gsl armadillo catch2
- name: CMake build and test
run: |
mkdir build
cmake -B build -S . -DCMAKE_BUILD_TYPE=Debug -DENABLE_OpenMP=FALSE
cmake --build build --config Debug
ctest --test-dir build --output-on-failure