Skip to content

Update test-build.yml #4

Update test-build.yml

Update test-build.yml #4

Workflow file for this run

##############################################################################
# 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 }} - ${{ matrix.build_type }}"
strategy:
fail-fast: false
matrix:
platform: [ubuntu-latest, macos-latest, windows-latest]
build_type: [Debug, Release]
runs-on: ${{ matrix.platform }}
steps:
# Checkout the code
- uses: actions/checkout@v3
# Install dependencies and build on Ubuntu
- name: Build on Linux
if: runner.os == 'Linux'
run: |
sudo apt-get update || true
sudo apt-get install -y build-essential libboost-all-dev
mkdir -p build && cd build
cmake -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} ..
make
# Install dependencies and build on macOS
- name: Build on macOS
if: runner.os == 'macOS'
run: |
brew update || true
brew install cmake boost
mkdir -p build && cd build
cmake -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} ..
make
# Set up Conda on Windows
- name: Set up Conda (Windows)
if: runner.os == 'Windows'
uses: conda-incubator/setup-miniconda@v3
with:
architecture: x64
activate-environment: AdTreeEnv
auto-activate-base: false
channels: conda-forge,defaults
# Install Boost via Conda on Windows
- name: Install Dependencies (Windows)
if: runner.os == 'Windows'
shell: bash -l {0}
run: conda install -y boost
# Configure CMake on Windows
- name: Configure (Windows)
if: runner.os == 'Windows'
shell: bash -l {0}
run: |
cmake -S . -B build/${{ matrix.build_type }} \
-G "Visual Studio 17 2022" \
-A x64 \
-DBOOST_ROOT="$CONDA_PREFIX/Library"
# Build on Windows
- name: Build (Windows)
if: runner.os == 'Windows'
shell: bash -l {0}
run: cmake --build build/${{ matrix.build_type }} --config ${{ matrix.build_type }}