Skip to content

Commit

Permalink
Convert GitHub actions to use build matrix [skip appveyor]
Browse files Browse the repository at this point in the history
This matrix covers win32 and win64, ubuntu 18 and 16, as well as macOS
  • Loading branch information
adam4813 authored and milesrout committed Nov 25, 2019
1 parent 154727f commit 02a0b95
Showing 1 changed file with 95 additions and 46 deletions.
141 changes: 95 additions & 46 deletions .github/workflows/tec.yml
Expand Up @@ -3,71 +3,120 @@ name: Trillek Engine CI
on: [pull_request]

jobs:
build-linux:

runs-on: ubuntu-latest

build:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, ubuntu-16.04, macOS-latest]
include:
- os: ubuntu-16.04
compiler: gcc
version: "7"
arch: x64
vcpkg-triplet: x64-linux
- os: ubuntu-latest
compiler: gcc
version: "7"
arch: x64
vcpkg-triplet: x64-linux
- os: macOS-latest
arch: x64
vcpkg-triplet: x64-osx
env:
VCPKG_INSTALLATION_ROOT: /usr/local/share/vcpkg
steps:
- uses: actions/checkout@v1
with:
submodules: true
- name: Install os deps
run: sudo apt-get install libgl1-mesa-dev xorg-dev libglu1-mesa-dev libxinerama-dev libxcursor-dev p7zip-full -y
- name: Cache vcpkg installed
- name: Cache vcpkg (MacOS)
uses: actions/cache@v1
if: runner.os == 'macOS'
with:
key: ${{ runner.OS }}-vcpkg
key: vcpkg-${{ matrix.os }}-${{ matrix.arch }}
path: /usr/local/share/vcpkg
- name: Cache vcpkg installed (Linux)
uses: actions/cache@v1
if: runner.os == 'Linux'
with:
key: vcpkg-${{ matrix.os }}-${{ matrix.arch }}
path: /usr/local/share/vcpkg/installed

# Linux specific
- name: Install GCC (Linux)
if: runner.os == 'Linux'
run: |
sudo apt-get update
if [ "${{ matrix.compiler }}" = "gcc" ]; then
sudo apt-get install -y g++-${{ matrix.version }} g++-${{ matrix.version }}-multilib
echo "::set-env name=CC::gcc-${{ matrix.version }}"
echo "::set-env name=CXX::g++-${{ matrix.version }}"
else
sudo apt-get install -y clang-${{ matrix.version }} g++-multilib
echo "::set-env name=CC::clang-${{ matrix.version }}"
echo "::set-env name=CXX::clang++-${{ matrix.version }}"
fi
- name: Install os deps (Linux)
if: runner.os == 'Linux'
run: sudo apt-get install libgl1-mesa-dev xorg-dev libglu1-mesa-dev libxinerama-dev libxcursor-dev p7zip-full -y

# MacOS specific
- name: Checkout vcpkg (MacOS)
if: runner.os == 'macOS'
run: if [ ! -d "$VCPKG_INSTALLATION_ROOT" ]; then git clone https://github.com/microsoft/vcpkg.git $VCPKG_INSTALLATION_ROOT; fi
- name: Bootstrap vcpkg (MacOS)
if: runner.os == 'macOS'
run: $VCPKG_INSTALLATION_ROOT/bootstrap-vcpkg.sh

# Shared
- name: Install deps vcpkg
run: vcpkg install asio bullet3 glew glfw3 glm lua openal-soft protobuf zlib imgui spdlog
- name: Configure cmake
run: mkdir -p build && cd build && cmake -DCMAKE_TOOLCHAIN_FILE=${VCPKG_INSTALLATION_ROOT}/scripts/buildsystems/vcpkg.cmake ..
run: $VCPKG_INSTALLATION_ROOT/vcpkg install asio glew glfw3 glm lua openal-soft protobuf zlib imgui spdlog --triplet ${{ matrix.vcpkg-triplet }}

- name: Install bullet with vcpkg (non MacOS)
if: runner.os != 'macOS'
run: $VCPKG_INSTALLATION_ROOT/vcpkg install bullet3 --triplet ${{ matrix.vcpkg-triplet }}
- name: Install bullet with brew (MacOS)
if: runner.os == 'macOS'
run: brew install bullet

- name: Create Build Environment
run: cmake -E make_directory ${{runner.workspace}}/build
- name: Configure CMake
working-directory: ${{runner.workspace}}/build
run: cmake $GITHUB_WORKSPACE -DCMAKE_TOOLCHAIN_FILE=$VCPKG_INSTALLATION_ROOT/scripts/buildsystems/vcpkg.cmake
- name: Build
run: cmake --build build
working-directory: ${{runner.workspace}}/build
run: cmake --build .

build-windows:

runs-on: windows-latest

runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [windows-latest]
arch: [Win32, x64]
include:
- arch: x64
vcpkg-triplet: x64-windows
- arch: Win32
vcpkg-triplet: x86-windows
steps:
- uses: actions/checkout@v1
with:
submodules: true
- name: Cache vcpkg installed
uses: actions/cache@v1
with:
key: ${{ runner.OS }}-vcpkg
key: vcpkg-${{ matrix.os }}-${{ matrix.arch }}
path: C:/vcpkg/installed
- name: Install deps vcpkg
run: vcpkg install asio bullet3 glew glfw3 glm lua openal-soft protobuf zlib imgui spdlog --triplet x64-windows
- name: Configure cmake
run: cmake -G"Visual Studio 16 2019" -Ax64 -Bbuild -S. -DCMAKE_TOOLCHAIN_FILE=C:/vcpkg/scripts/buildsystems/vcpkg.cmake
- name: Build
run: cmake --build build

build-macos:

runs-on: macOS-latest

steps:
- uses: actions/checkout@v1
with:
submodules: true
- name: Cache vcpkg installed
uses: actions/cache@v1
with:
key: ${{ runner.OS }}-vcpkg
path: ../vcpkg
- name: Checkout vcpkg
run: if [ ! -d '../vcpkg' ]; then git clone https://github.com/microsoft/vcpkg.git ../vcpkg; fi
- name: Bootstrap vcpkg
run: ../vcpkg/bootstrap-vcpkg.sh
- name: Install deps vcpkg
run: ../vcpkg/vcpkg install asio glew glfw3 glm lua openal-soft protobuf zlib imgui spdlog
- name: install bullet
run: brew install bullet
run: vcpkg install asio bullet3 glew glfw3 glm lua openal-soft protobuf zlib imgui spdlog --triplet ${{ matrix.vcpkg-triplet }}
- name: Create Build Environment
run: cmake -E make_directory ${{runner.workspace}}/build
- name: Configure cmake
run: cmake -B build -DCMAKE_TOOLCHAIN_FILE=../../vcpkg/scripts/buildsystems/vcpkg.cmake
working-directory: ${{runner.workspace}}/build
run: cmake $env:GITHUB_WORKSPACE -DCMAKE_GENERATOR_PLATFORM=${{matrix.arch}} -DCMAKE_TOOLCHAIN_FILE="$env:VCPKG_INSTALLATION_ROOT/scripts/buildsystems/vcpkg.cmake"
- name: Build
run: cmake --build build

working-directory: ${{runner.workspace}}/build
run: cmake --build .

0 comments on commit 02a0b95

Please sign in to comment.