Skip to content

Update README.md

Update README.md #194

Workflow file for this run

name: Sourcehold
on: [push, pull_request]
env:
# Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.)
BUILD_TYPE: Release
jobs:
build:
# The CMake configure and build commands are platform agnostic and should work equally
# well on Windows or Mac. You can convert this to a matrix build if you need
# cross-platform coverage.
# See: https://docs.github.com/en/free-pro-team@latest/actions/learn-github-actions/managing-complex-workflows#using-a-build-matrix
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [macos-latest, ubuntu-latest, windows-latest]
target-platform: ["host"]
include:
- os: ubuntu-latest
install-dependencies: "sh ./ubuntu/install-dependencies.sh"
#TODO: (seidl, @github: skrax)
# enable warnings as errors later
cmake-configure-options: "-DWARNINGS_AS_ERRORS=OFF
-DENABLE_COVERAGE=ON
-DENABLE_SANITIZER_UNDEFINED_BEHAVIOR=ON
-DENABLE_CLANG_TIDY=ON
-DENABLE_SANITIZER_ADDRESS=ON
-DENABLE_SANITIZER_LEAK=ON"
cmake-build-options: ""
uploaded-artifact-name: "sourcehold-linux-amd64"
- os: macos-latest
install-dependencies: "sh ./apple/install-dependencies-macos.sh"
cmake-configure-options: ""
cmake-build-options: ""
uploaded-artifact-name: "sourcehold-mac-os"
# Use different target platform here just to force new job spawning
- target-platform: "ios-simulator"
os: macos-latest
install-dependencies: "sh ./apple/install-dependencies-ios.sh -s -d 11.0 ./thirdparty/ios"
#TODO: add gtest install script for ios
cmake-configure-options: '-GXcode -DCMAKE_SYSTEM_NAME=iOS -DCMAKE_OSX_DEPLOYMENT_TARGET=11.0 -DCMAKE_OSX_ARCHITECTURES="x86_64" -DSOURCEHOLD_BUILD_TESTS=OFF'
cmake-build-options: "-- -sdk iphonesimulator"
uploaded-artifact-name: "sourcehold-ios"
- os: windows-latest
install-dependencies: "sh ./windows/install-dependencies.sh"
# this assumes cmake is run from the project root
cmake-configure-options: "-DCMAKE_TOOLCHAIN_FILE=./vcpkg/scripts/buildsystems/vcpkg.cmake"
cmake-build-options: ""
uploaded-artifact-name: "sourcehold-windows64"
name: ${{ matrix.os }} - ${{ matrix.target-platform }}
steps:
- name: Set up environment variables
# Unfortunately workflow level env variables can not be accessed at job level
# (see https://github.community/t/how-to-set-and-access-a-workflow-variable/17335)
# in our case this is BUILD_TYPE. Thus we have to define it here in such weird way.
shell: bash
run: |
if [[ ${{ matrix.target-platform }} == 'ios-simulator' ]]; then
echo "BUILD_ARTIFACT_PARENT_DIR_PATH=${{ github.workspace }}/build/${{ env.BUILD_TYPE }}-iphonesimulator" >> $GITHUB_ENV
echo "BUILD_ARTIFACT_NAME=Stronghold.app" >> $GITHUB_ENV
elif [[ ${{ matrix.os }} == 'windows-latest' ]]; then
echo "BUILD_ARTIFACT_PARENT_DIR_PATH=${{ github.workspace }}\build" >> $GITHUB_ENV
echo "BUILD_ARTIFACT_NAME=Stronghold.exe" >> $GITHUB_ENV
echo "VCPKG_BINARY_SOURCES=clear;nuget,GitHub,readwrite" >> $GITHUB_ENV
else
echo "BUILD_ARTIFACT_PARENT_DIR_PATH=${{ github.workspace }}/build" >> $GITHUB_ENV
echo "BUILD_ARTIFACT_NAME=Stronghold" >> $GITHUB_ENV
fi
- name: Checkout sources
uses: actions/checkout@v2
with:
submodules: 'true'
- name: Cache dependencies
if: ${{ matrix.target-platform == 'ios-simulator' }}
uses: actions/cache@v2
env:
cache-name: cache-${{ matrix.target-platform }}-dependencies
with:
path: ${{ github.workspace }}/thirdparty/ios
key: ${{ env.cache-name }}
- name: Setup vcpkg for Windows
if: ${{ matrix.os == 'windows-latest' }}
shell: bash
run: |
git clone https://github.com/microsoft/vcpkg
rm -rf "$VCPKG_INSTALLATION_ROOT"
./vcpkg/bootstrap-vcpkg.sh
- name: Setup NuGet Credentials
if: ${{ matrix.os == 'windows-latest' }}
shell: bash
run: |
`./vcpkg/vcpkg fetch nuget | tail -n 1` \
sources Add -Source "https://nuget.pkg.github.com/${{ github.actor }}/index.json" \
-StorePasswordInClearText \
-Name "GitHub" \
-UserName "${{ github.actor }}" \
-Password "${{ secrets.GITHUB_TOKEN }}"
- name: Install dependencies
shell: bash
env:
INSTALL_DEPENDENCIES: ${{ matrix.install-dependencies }}
# Install all the required dependencies to build Sourcehold
run: $INSTALL_DEPENDENCIES
- name: Create build environment
# Some projects don't allow in-source building, so create a separate build directory
# We'll use this as our working directory for all subsequent commands
run: cmake -E make_directory ${{ github.workspace }}/build
- name: Configure CMake
# Use a bash shell so we can use the same syntax for environment variable
# access regardless of the host operating system
shell: bash
env:
CMAKE_CONFIGURE_OPTIONS: ${{ matrix.cmake-configure-options }}
run: cmake -B build -DCMAKE_BUILD_TYPE=$BUILD_TYPE $CMAKE_CONFIGURE_OPTIONS
- name: Build
shell: bash
env:
CMAKE_BUILD_OPTIONS: ${{ matrix.cmake-build-options }}
# Execute the build. You can specify a specific target with "--target <NAME>"
run: cmake --build build --config $BUILD_TYPE $CMAKE_BUILD_OPTIONS
- name: Make artifacts
shell: bash
run: |
cd "$BUILD_ARTIFACT_PARENT_DIR_PATH"
if [[ ${{ matrix.os }} == 'windows-latest' ]]; then
7z a "${{ github.workspace }}\${{ matrix.uploaded-artifact-name }}.zip" -tzip "$BUILD_ARTIFACT_NAME"
else
zip -r ${{ github.workspace }}/${{ matrix.uploaded-artifact-name }}.zip "$BUILD_ARTIFACT_NAME"
fi
- name: Run tests
shell: bash
run: |
if [[ ${{ matrix.target-platform }} != 'ios-simulator' ]]; then
pushd build/test
ctest --output-on-failure
popd
fi
- name: Upload artifacts
uses: actions/upload-artifact@v2
with:
name: ${{ matrix.uploaded-artifact-name }}
path: ${{ github.workspace }}/${{ matrix.uploaded-artifact-name }}.zip