Skip to content

Add a FORK_UNION_BUILD_TESTS option to the cmake #52

Add a FORK_UNION_BUILD_TESTS option to the cmake

Add a FORK_UNION_BUILD_TESTS option to the cmake #52

Workflow file for this run

name: Pre-Release
on:
push:
branches: ["main-dev"]
pull_request:
branches: ["main-dev"]
env:
GH_TOKEN: ${{ secrets.SEMANTIC_RELEASE_TOKEN }}
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
permissions:
contents: read
jobs:
versioning:
name: Update Version
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v5
with:
fetch-depth: 0
persist-credentials: false
- name: Run TinySemVer
uses: ashvardanian/tinysemver@v2.1.1
with:
verbose: "true"
version-file: "VERSION"
update-version-in: |
CMakeLists.txt:^\s*VERSION (\d+\.\d+\.\d+)
Cargo.toml:^version = "(\d+\.\d+\.\d+)"
README.md:^\s*GIT_TAG v(\d+\.\d+\.\d+)
README.md:^\s*fork_union\s*=\s*"(\d+\.\d+\.\d+)"
README.md:^\s*fork_union\s*=\s*\{\s*version\s*=\s*"(\d+\.\d+\.\d+)"
update-major-version-in: |
include/fork_union.hpp:^#define FORK_UNION_VERSION_MAJOR (\d+)
update-minor-version-in: |
include/fork_union.hpp:^#define FORK_UNION_VERSION_MINOR (\d+)
update-patch-version-in: |
include/fork_union.hpp:^#define FORK_UNION_VERSION_PATCH (\d+)
dry-run: "true"
test_ubuntu_gcc:
name: Ubuntu (GCC)
runs-on: ubuntu-24.04
env:
CC: gcc
CXX: g++
steps:
- name: Checkout
uses: actions/checkout@v5
- name: Build C/C++
run: |
sudo apt update
sudo apt install -y cmake build-essential libomp-dev
cmake -B build_artifacts -D CMAKE_BUILD_TYPE=RelWithDebInfo
cmake --build build_artifacts --config RelWithDebInfo
- name: Test C++
run: |
set -euxo pipefail
build_artifacts/fork_union_test_cpp17
build_artifacts/fork_union_test_cpp20
build_artifacts/fork_union_test_cpp23
- name: Set up Rust
run: |
rustup update stable
rustup default stable
rustc -vV
- name: Build Rust
run: cargo build
- name: Test Rust
run: cargo test
test_ubuntu_clang:
name: Ubuntu (Clang)
runs-on: ubuntu-24.04
env:
CC: clang
CXX: clang++
steps:
- name: Checkout
uses: actions/checkout@v5
# C/C++
- name: Build C/C++
run: |
sudo apt update
sudo apt install -y cmake build-essential clang
cmake -B build_artifacts -D CMAKE_BUILD_TYPE=RelWithDebInfo
cmake --build build_artifacts --config RelWithDebInfo
- name: Test C++
run: |
set -euxo pipefail
build_artifacts/fork_union_test_cpp17
build_artifacts/fork_union_test_cpp20
build_artifacts/fork_union_test_cpp23
- name: Set up Rust
run: |
rustup update stable
rustup default stable
rustc -vV
- name: Build Rust
run: cargo build
- name: Test Rust
run: cargo test
test_macos:
name: macOS
runs-on: macos-14
steps:
- name: Checkout
uses: actions/checkout@v5
- name: Build C/C++
run: |
brew update
brew reinstall cmake
cmake -B build_artifacts -D CMAKE_BUILD_TYPE=RelWithDebInfo
cmake --build build_artifacts --config RelWithDebInfo
- name: Test C++
run: |
set -euxo pipefail
build_artifacts/fork_union_test_cpp17
build_artifacts/fork_union_test_cpp20
build_artifacts/fork_union_test_cpp23
- name: Set up Rust
run: |
rustup update stable
rustup default stable
rustc -vV
- name: Build Rust
run: cargo build
- name: Test Rust
run: cargo test
test_macos_llvm_versions:
name: macOS LLVM Versions
runs-on: macos-15
strategy:
fail-fast: false
matrix:
llvm: [16, 17, 18, 19, 20]
config: [Debug, Release, RelWithDebInfo, MinSizeRel]
steps:
- name: Checkout
uses: actions/checkout@v5
- name: Install LLVM ${{ matrix.llvm }}
run: |
brew update
brew reinstall cmake llvm@${{ matrix.llvm }}
- name: Configure (CMake)
run: |
cmake -S . -B build_artifacts -D CMAKE_BUILD_TYPE=${{ matrix.config }} -D CMAKE_CXX_COMPILER=$(brew --prefix llvm@${{ matrix.llvm }})/bin/clang++
- name: Build
run: cmake --build build_artifacts --config ${{ matrix.config }} --parallel
- name: Run C++ tests
run: |
set -euxo pipefail
build_artifacts/fork_union_test_cpp17
build_artifacts/fork_union_test_cpp20
build_artifacts/fork_union_test_cpp23
test_windows:
name: Windows
runs-on: windows-2022
steps:
- name: Checkout
uses: actions/checkout@v5
- name: Build C/C++
run: |
choco install cmake
cmake -B build_artifacts -D CMAKE_BUILD_TYPE=RelWithDebInfo
cmake --build build_artifacts --config RelWithDebInfo
- name: List build artifacts
run: Get-ChildItem -Recurse .\build_artifacts
- name: Test C++
run: |
$ErrorActionPreference = "Stop"
.\build_artifacts\fork_union_test_cpp17.exe
.\build_artifacts\fork_union_test_cpp20.exe
.\build_artifacts\fork_union_test_cpp23.exe
- name: Set up Rust
run: |
rustup update stable
rustup default stable
rustc -vV
- name: Build Rust
run: cargo build
- name: Test Rust
run: cargo test
test_windows_msvc_matrix:
name: Windows MSVC Versions
runs-on: windows-2022
strategy:
fail-fast: false
matrix:
toolset: [v143, v142] # VS 2022 and VS 2019
config: [Debug, Release, RelWithDebInfo, MinSizeRel]
steps:
- name: Checkout
uses: actions/checkout@v5
- name: Build C/C++ with MSVC ${{ matrix.toolset }} (${{ matrix.config }})
run: |
choco install cmake
cmake -B build_artifacts -G "Visual Studio 17 2022" -T ${{ matrix.toolset }} -A x64
cmake --build build_artifacts --config ${{ matrix.config }}
- name: List build artifacts
run: Get-ChildItem -Recurse .\build_artifacts
- name: Test C++
run: |
$ErrorActionPreference = "Stop"
.\build_artifacts\fork_union_test_cpp17.exe
.\build_artifacts\fork_union_test_cpp20.exe
.\build_artifacts\fork_union_test_cpp23.exe
test_i386:
name: Cross-compilation (i386)
runs-on: ubuntu-24.04
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install cross-compilation tools
run: |
sudo apt update
sudo apt install -y cmake build-essential gcc-multilib g++-multilib
- name: Build C++
run: |
cmake -B build_i386 -D CMAKE_C_FLAGS=-m32 -D CMAKE_CXX_FLAGS=-m32 -D CMAKE_BUILD_TYPE=RelWithDebInfo
cmake --build build_i386 --target fork_union_test_cpp17 fork_union_test_cpp20
- name: Test C++
run: |
build_i386/fork_union_test_cpp17
build_i386/fork_union_test_cpp20
test_armhf:
name: Cross-compilation (armhf)
runs-on: ubuntu-24.04
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install cross-compilation tools
run: |
sudo apt update
sudo apt install -y cmake build-essential gcc-arm-linux-gnueabihf g++-arm-linux-gnueabihf qemu-user-static
- name: Build C++
run: |
cmake -B build_armhf -D CMAKE_CXX_COMPILER=arm-linux-gnueabihf-g++ -D CMAKE_BUILD_TYPE=RelWithDebInfo
cmake --build build_armhf --target fork_union_test_cpp17 fork_union_test_cpp20
- name: Test C++
run: |
qemu-arm-static -L /usr/arm-linux-gnueabihf build_armhf/fork_union_test_cpp17
qemu-arm-static -L /usr/arm-linux-gnueabihf build_armhf/fork_union_test_cpp20
test_s390x:
name: Cross-compilation (s390x)
runs-on: ubuntu-24.04
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install cross-compilation tools
run: |
sudo apt update
sudo apt install -y cmake build-essential gcc-s390x-linux-gnu g++-s390x-linux-gnu qemu-user-static
- name: Build C++
run: |
cmake -B build_s390x -D CMAKE_CXX_COMPILER=s390x-linux-gnu-g++ -D CMAKE_BUILD_TYPE=RelWithDebInfo
cmake --build build_s390x --target fork_union_test_cpp17 fork_union_test_cpp20
- name: Test C++
run: |
qemu-s390x-static -L /usr/s390x-linux-gnu build_s390x/fork_union_test_cpp17
qemu-s390x-static -L /usr/s390x-linux-gnu build_s390x/fork_union_test_cpp20