-
Notifications
You must be signed in to change notification settings - Fork 39
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test building AdTree on Windows, Ubuntu, and macOS
- Loading branch information
1 parent
ddc1fc1
commit ad0015a
Showing
2 changed files
with
85 additions
and
30 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
############################################################################## | ||
# GitHub Actions Workflow to test building AdTree on Windows, Ubuntu, and macOS. | ||
# | ||
# Copyright (C) 2022 Liangliang Nan <[email protected]> | ||
# | ||
# Licensed under GNU LGPL.3, see LICENCE file | ||
############################################################################## | ||
name: Test Build AdTree | ||
|
||
on: [push, pull_request] | ||
|
||
jobs: | ||
build: | ||
name: "Build on ${{ matrix.platform }} with ${{ matrix.compiler }}" | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
platform: [windows-latest, ubuntu-latest, macos-latest] | ||
compiler: [gcc, clang, msvc] | ||
runs-on: ${{ matrix.platform }} | ||
|
||
steps: | ||
# Checkout the code | ||
- uses: actions/checkout@v3 | ||
|
||
# Install dependencies for Ubuntu | ||
- name: Install Dependencies (Linux) | ||
if: runner.os == 'Linux' | ||
run: | | ||
sudo apt-get update || true | ||
sudo apt-get install -y \ | ||
build-essential \ | ||
${{ matrix.compiler }} \ | ||
libglu1-mesa-dev mesa-common-dev \ | ||
libxrandr-dev libxinerama-dev libxcursor-dev libxi-dev libboost-all-dev | ||
# Install dependencies for macOS | ||
- name: Install Dependencies (macOS) | ||
if: runner.os == 'macOS' | ||
run: | | ||
brew update || true | ||
brew install cmake boost | ||
# Set up Miniconda on Windows | ||
- name: Set up Conda (Windows) | ||
if: runner.os == 'Windows' | ||
uses: conda-incubator/setup-miniconda@v3 | ||
with: | ||
architecture: x64 | ||
auto-activate-base: true | ||
channels: conda-forge,defaults | ||
|
||
# Install dependencies for Windows using Conda | ||
- name: Install Dependencies (Windows) | ||
if: runner.os == 'Windows' | ||
run: | | ||
conda install -y ninja boost | ||
# Configure the project | ||
- name: Configure (Linux & macOS) | ||
if: runner.os != 'Windows' | ||
run: | | ||
mkdir -p build && cd build | ||
cmake .. \ | ||
-DCMAKE_BUILD_TYPE=Release \ | ||
-DCMAKE_CXX_COMPILER=$([[ ${{ matrix.platform }} == "ubuntu-latest" ]] && echo ${{ matrix.compiler }} || echo "clang++") | ||
- name: Configure (Windows) | ||
if: runner.os == 'Windows' | ||
run: | | ||
mkdir -p build && cd build | ||
cmake .. \ | ||
-G "Visual Studio 17 2022" \ | ||
-A x64 \ | ||
-DCMAKE_BUILD_TYPE=Release | ||
# Build the project | ||
- name: Build (Linux & macOS) | ||
if: runner.os != 'Windows' | ||
run: | | ||
cmake --build build -- -j$(nproc) | ||
- name: Build (Windows) | ||
if: runner.os == 'Windows' | ||
run: cmake --build build --config Release |