Skip to content

Commit ad0015a

Browse files
committed
test building AdTree on Windows, Ubuntu, and macOS
1 parent ddc1fc1 commit ad0015a

File tree

2 files changed

+85
-30
lines changed

2 files changed

+85
-30
lines changed

.github/workflows/test-build-gcc.yml

Lines changed: 0 additions & 30 deletions
This file was deleted.

.github/workflows/test-build.yml

Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
##############################################################################
2+
# GitHub Actions Workflow to test building AdTree on Windows, Ubuntu, and macOS.
3+
#
4+
# Copyright (C) 2022 Liangliang Nan <liangliang.nan@gmail.com>
5+
#
6+
# Licensed under GNU LGPL.3, see LICENCE file
7+
##############################################################################
8+
name: Test Build AdTree
9+
10+
on: [push, pull_request]
11+
12+
jobs:
13+
build:
14+
name: "Build on ${{ matrix.platform }} with ${{ matrix.compiler }}"
15+
strategy:
16+
fail-fast: false
17+
matrix:
18+
platform: [windows-latest, ubuntu-latest, macos-latest]
19+
compiler: [gcc, clang, msvc]
20+
runs-on: ${{ matrix.platform }}
21+
22+
steps:
23+
# Checkout the code
24+
- uses: actions/checkout@v3
25+
26+
# Install dependencies for Ubuntu
27+
- name: Install Dependencies (Linux)
28+
if: runner.os == 'Linux'
29+
run: |
30+
sudo apt-get update || true
31+
sudo apt-get install -y \
32+
build-essential \
33+
${{ matrix.compiler }} \
34+
libglu1-mesa-dev mesa-common-dev \
35+
libxrandr-dev libxinerama-dev libxcursor-dev libxi-dev libboost-all-dev
36+
37+
# Install dependencies for macOS
38+
- name: Install Dependencies (macOS)
39+
if: runner.os == 'macOS'
40+
run: |
41+
brew update || true
42+
brew install cmake boost
43+
44+
# Set up Miniconda on Windows
45+
- name: Set up Conda (Windows)
46+
if: runner.os == 'Windows'
47+
uses: conda-incubator/setup-miniconda@v3
48+
with:
49+
architecture: x64
50+
auto-activate-base: true
51+
channels: conda-forge,defaults
52+
53+
# Install dependencies for Windows using Conda
54+
- name: Install Dependencies (Windows)
55+
if: runner.os == 'Windows'
56+
run: |
57+
conda install -y ninja boost
58+
59+
# Configure the project
60+
- name: Configure (Linux & macOS)
61+
if: runner.os != 'Windows'
62+
run: |
63+
mkdir -p build && cd build
64+
cmake .. \
65+
-DCMAKE_BUILD_TYPE=Release \
66+
-DCMAKE_CXX_COMPILER=$([[ ${{ matrix.platform }} == "ubuntu-latest" ]] && echo ${{ matrix.compiler }} || echo "clang++")
67+
68+
- name: Configure (Windows)
69+
if: runner.os == 'Windows'
70+
run: |
71+
mkdir -p build && cd build
72+
cmake .. \
73+
-G "Visual Studio 17 2022" \
74+
-A x64 \
75+
-DCMAKE_BUILD_TYPE=Release
76+
77+
# Build the project
78+
- name: Build (Linux & macOS)
79+
if: runner.os != 'Windows'
80+
run: |
81+
cmake --build build -- -j$(nproc)
82+
83+
- name: Build (Windows)
84+
if: runner.os == 'Windows'
85+
run: cmake --build build --config Release

0 commit comments

Comments
 (0)