Repository navigation
102 lines (88 loc) · 3.35 KB
/
Copy pathunit-tests.yml
File metadata and controls
102 lines (88 loc) · 3.35 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
# SPDX-License-Identifier: MIT
# Copyright (c) 2026 Nihilai Collective Corp
# https://github.com/nihilai-collective/void-numerics
# .github/workflows/unit-tests.yml
name: Unit Tests
on:
push:
branches: [ "**" ]
pull_request:
branches: [ "**" ]
workflow_dispatch:
jobs:
build:
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-latest
compiler: clang
name: "Ubuntu Clang"
- os: ubuntu-latest
compiler: gcc
name: "Ubuntu GNU"
- os: macos-latest
compiler: clang
name: "macOS Clang"
- os: macos-latest
compiler: gcc
name: "macOS GNU"
- os: windows-latest
compiler: msvc
name: "Windows MSVC"
runs-on: ${{ matrix.os }}
name: Build on ${{ matrix.name }}
steps:
- name: Checkout Repository
uses: actions/checkout@v7
- name: Setup Clang (Ubuntu)
if: matrix.os == 'ubuntu-latest' && matrix.compiler == 'clang'
run: |
wget https://apt.llvm.org/llvm.sh
chmod u+x llvm.sh
DEV_VERSION=$(awk -F'[][]' '/LLVM_VERSION_PATTERNS/ {print $2}' llvm.sh | sort -n | tail -n 1)
sudo ./llvm.sh $DEV_VERSION
echo "CXX_BIN=/usr/bin/clang++-$DEV_VERSION" >> $GITHUB_ENV
- name: Setup GNU (Ubuntu)
if: matrix.os == 'ubuntu-latest' && matrix.compiler == 'gcc'
run: |
sudo add-apt-repository ppa:ubuntu-toolchain-r/test -y
sudo apt-get update
DEV_VERSION=$(apt-cache search '^g\+\+-[0-9]+$' | awk '{print $1}' | sort -V | tail -n 1 | sed 's/g++-//')
sudo apt-get install -y gcc-$DEV_VERSION g++-$DEV_VERSION
echo "CXX_BIN=/usr/bin/g++-$DEV_VERSION" >> $GITHUB_ENV
- name: Setup Clang (macOS)
if: matrix.os == 'macos-latest' && matrix.compiler == 'clang'
run: |
brew install llvm
echo "CXX_BIN=$(brew --prefix llvm)/bin/clang++" >> $GITHUB_ENV
- name: Setup GNU (macOS)
if: matrix.os == 'macos-latest' && matrix.compiler == 'gcc'
run: |
brew install gcc
GCC_VERSION=$(brew list --versions gcc | awk '{print $2}' | cut -d. -f1)
echo "CXX_BIN=g++-$GCC_VERSION" >> $GITHUB_ENV
- name: Setup MSVC (Windows)
if: matrix.os == 'windows-latest'
uses: ilammy/msvc-dev-cmd@v1
- name: Configure CMake (Unix)
if: runner.os != 'Windows'
run: cmake -S . -B ./Build -DCMAKE_BUILD_TYPE=Debug -DCMAKE_CXX_COMPILER=${{ env.CXX_BIN }} -DVN_UNIT_TESTS=TRUE -DVN_ASAN=TRUE -DVN_UBSAN=TRUE
- name: Configure CMake (Windows)
if: runner.os == 'Windows'
run: cmake -S . -B ./Build -DCMAKE_BUILD_TYPE=Debug -DCMAKE_CXX_COMPILER=cl -DVN_UNIT_TESTS=TRUE -DVN_ASAN=TRUE -DVN_UBSAN=TRUE
- name: Build
run: cmake --build ./Build --config=Debug -v
- name: Install
run: |
${{ runner.os != 'Windows' && 'sudo' || '' }} cmake --install ./Build --config=Debug
- name: Run (Unix)
if: runner.os != 'Windows'
run: |
sudo chmod +x /usr/local/bin/vn-unit-tests
/usr/local/bin/vn-unit-tests
- name: Run (Windows)
if: runner.os == 'Windows'
shell: pwsh
run: |
& "C:/Program Files (x86)/void-numerics/bin/vn-unit-tests.exe"