Skip to content

Enable CMAKE_COLOR_DIAGNOSTICS #179

Enable CMAKE_COLOR_DIAGNOSTICS

Enable CMAKE_COLOR_DIAGNOSTICS #179

Workflow file for this run

name: Build
on: [push]
jobs:
build:
name: ${{ matrix.config.name }}
runs-on: ${{ matrix.config.os }}
strategy:
fail-fast: false
matrix:
config:
- {
name: "Windows",
os: windows-latest,
cxx: "clang++.exe",
cxxflags: "",
release_flags: "era=win10 static lto=full small"
}
- {
name: "Ubuntu",
os: ubuntu-latest,
cxx: "clang++-15",
cxxflags: "-stdlib=libc++",
release_flags: "static lto=full small"
}
- {
name: 'Tarball',
os: ubuntu-latest,
cxx: "clang++-15",
cxxflags: "-stdlib=libc++",
release_flags: "static lto=full small"
}
- {
name: "macOS",
os: macos-13,
cxx: "clang++",
cxxflags: "",
release_flags: "era=11.0 static lto=full small"
}
steps:
- uses: actions/checkout@v3
- name: Get latest release version number
id: get_version
uses: battila7/get-version-action@v2
- name: Install dependencies
if: matrix.config.name != 'Tarball'
run: |
git submodule update --init --recursive
# Install toolchain
if [ "$RUNNER_OS" == "Linux" ]; then
sudo apt update
sudo apt install clang-15 libc++-15-dev libc++abi-15-dev lld-15 ninja-build
elif [ "$RUNNER_OS" == "Windows" ]; then
cmake -P 'cmake/download-llvm.cmake'
cmake -E tar x llvm.zip
mv llvm-mingw-* llvm-mingw
cmake -E tar x ninja.zip
cp ninja.exe "$PWD/llvm-mingw/bin/"
echo "$PWD" >> $GITHUB_PATH
echo "$PWD/llvm-mingw/bin" >> $GITHUB_PATH
echo "$PWD/llvm-mingw/lib" >> $GITHUB_PATH
else
brew install ninja
fi
# Install boost
export BOOST_SDK=https://github.com/ossia/score-sdk/releases/download/sdk28
export BOOST_VER=boost_1_83_0
(
BOOST="$BOOST_VER.tar.gz"
curl -L -0 "$BOOST_SDK/$BOOST" --output "$BOOST"
cmake -E tar xzf "$BOOST"
mv $BOOST_VER boost
)
shell: bash
- name: Configure
if: matrix.config.name != 'Tarball'
env:
CXXFLAGS: ${{ matrix.config.cxxflags }}
CXX: ${{ matrix.config.cxx }}
run: |
export PATH="$PWD/llvm-mingw/bin:$PATH"
cmake \
-S $PWD \
-B build \
-GNinja \
-DBOOST_ROOT="$PWD/boost" \
-DBoost_INCLUDE_DIR="$PWD/boost"
shell: bash
- name: Build
if: matrix.config.name != 'Tarball'
run: cmake --build build
- name: Test
if: matrix.config.name != 'Tarball'
run: |
cd build
ctest -V || true
shell: bash
- name: Deploy binaries
if: matrix.config.name != 'Tarball'
run: |
export ROOT_PATH=$PWD
export CNINJA_FLAGS=${{ matrix.config.release_flags }}
# Of course Windows requires DLLs to be copied...
if [ "$RUNNER_OS" == "Windows" ]; then
cp $PWD/llvm-mingw/bin/libc++.dll build/
cp $PWD/llvm-mingw/bin/libunwind.dll build/
export PATH="$PWD/llvm-mingw/bin:$PATH"
fi
build/cninja \
-S $PWD \
-B build-final \
$CNINJA_FLAGS \
-- \
-DBOOST_ROOT="$PWD/boost" \
-DBoost_INCLUDE_DIR="$PWD/boost"
cmake --build build-final --target install
cd build-final/install/bin
export VERSION=$(echo ${{ steps.get_version.outputs.version }} | sed 's/refs\/heads\///')
if [ "$RUNNER_OS" == "Windows" ]; then
cmake -E tar cf "cninja-$VERSION-$RUNNER_OS.zip" --format=zip cninja.exe
else
tar -czf "cninja-$VERSION-$RUNNER_OS.tar.gz" cninja
fi
mv cninja-* "$ROOT_PATH/"
shell: bash
- name: Deploy source tarball
if: matrix.config.name == 'Tarball'
run: |
# Deploy source archive too
git submodule update --init --recursive
if [ ${{ matrix.config.name }} == 'Tarball' ]; then
find . -name .git -exec rm -rf {} \; || true
find . -name .git -exec rm -rf {} \; || true
export VERSION=$(echo ${{ steps.get_version.outputs.version }} | sed 's/refs\/heads\///')
tar caf cninja-$VERSION-src.tar.gz \
3rdparty cmake src tests configs \
CMakeLists.txt LICENSE.md README.md
echo "${{ secrets.GPG_PRIVATE_KEY }}" | gpg --import -
gpg -ab cninja-$VERSION-src.tar.gz
fi
shell: bash
- name: Upload
if: startsWith(github.ref, 'refs/tags')
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: cninja-*
tag: ${{ github.ref }}
overwrite: true
file_glob: true