moved inventory gui and logic to the engine, where it belongs best (f… #93
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: CMake | |
on: | |
push: | |
branches: [master] | |
pull_request: | |
branches: [master] | |
env: | |
BUILD_TYPE: Release | |
# Indicates the CMake build directory where project files and binaries are being produced. | |
CMAKE_BUILD_NAME: build | |
CMAKE_BUILD_DIR: ${{ github.workspace }}/build | |
# Indicates the location of the vcpkg as a Git submodule of the project repository. | |
VCPKG_ROOT: ${{ github.workspace }}/vcpkg | |
jobs: | |
build: | |
runs-on: ${{ matrix.config.os }} | |
name: ${{ matrix.config.name }} | |
strategy: | |
fail-fast: false | |
matrix: | |
config: | |
- { | |
name: "Windows Latest MSVC", | |
os: windows-latest, os_short: "Windows", | |
build_type: "Release", cc: "cl", cxx: "cl", | |
environment_script: "C:/Program Files (x86)/Microsoft Visual Studio/2019/Enterprise/VC/Auxiliary/Build/vcvars64.bat" | |
} | |
- { | |
name: "Ubuntu GCC", | |
os: ubuntu-latest, os_short: "Ubuntu", | |
build_type: "Release", cc: "gcc", cxx: "g++" | |
} | |
- { | |
name: "macOS Latest Clang", | |
os: macos-latest, os_short: "macOS", | |
build_type: "Release", cc: "clang", cxx: "clang++" | |
} | |
steps: | |
- uses: actions/checkout@v2 | |
with: | |
submodules: true | |
- name: Restore vcpkg and its artifacts | |
uses: actions/cache@v2 | |
with: | |
# The first path is where vcpkg generates artifacts while consuming the vcpkg.json manifest file. | |
# The second path is the location of vcpkg (it contains the vcpkg executable and data files). | |
# The other paths starting with '!' are exclusions: they contain termporary files generated during the build of the installed packages. | |
path: | | |
${{ env.CMAKE_BUILD_DIR }}/vcpkg_installed/ | |
${{ env.VCPKG_ROOT }} | |
!${{ env.VCPKG_ROOT }}/buildtrees | |
!${{ env.VCPKG_ROOT }}/packages | |
!${{ env.VCPKG_ROOT }}/downloads | |
# The key is composed in a way that it gets properly invalidated: this must happen whenever vcpkg's Git commit id changes, or the list of packages changes. In this case a cache miss must happen and a new entry with a new key with be pushed to GitHub the cache service. | |
# Note: given a key, the cache content is immutable. If a cache entry has been created improperly, in order the recreate the right content the key must be changed as well, and it must be brand new (i.e. not existing already). | |
key: ${{ matrix.config.os }}-${{ matrix.config.name }}-${{ hashFiles('vcpkg.json', '.git/modules/vcpkg/HEAD') }} | |
- name: Update compilers | |
if: ${{ matrix.config.cc }} == 'gcc' && ${{ matrix.config.os_short }} == 'Ubuntu' | |
shell: bash | |
run: | | |
if [[ ${{ matrix.config.cc }} == 'gcc-8' && ${{ matrix.config.os_short }} == 'Ubuntu' ]]; then | |
sudo apt-add-repository -y ppa:ubuntu-toolchain-r/test | |
sudo apt-get -yq install g++-8 gcc-8 | |
elif [[ ${{ matrix.config.cc }} == 'clang' && ${{ matrix.config.os_short }} == 'Ubuntu' ]]; then | |
wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key 2>/dev/null | sudo apt-key add - | |
sudo add-apt-repository 'deb http://apt.llvm.org/bionic/ llvm-toolchain-bionic-9 main' -y | |
sudo apt-get update -q | |
sudo apt-get install -y clang-9 lld-9 libc++-9-dev libc++abi-9-dev clang-tools-9 | |
elif [[ ${{ matrix.config.os_short }} == 'macOS' ]]; then | |
brew install gcc && brew link gcc && CXX=/usr/local/bin/g++-9 | |
fi | |
- name: Configure CMake | |
shell: bash | |
run: cmake -B "${{ env.CMAKE_BUILD_DIR }}" -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DCMAKE_C_COMPILER=${{ matrix.config.cc }} -DCMAKE_CXX_COMPILER=${{ matrix.config.cxx }} | |
- name: Build | |
shell: bash | |
run: | | |
cmake --build "${{ env.CMAKE_BUILD_DIR }}" --config $BUILD_TYPE | |
- name: Organize files for upload | |
shell: bash | |
run: | | |
mkdir artifact | |
if [[ ${{ matrix.config.os_short }} == 'Ubuntu' || ${{ matrix.config.os_short }} == 'macOS' ]]; then | |
cp ${{ env.CMAKE_BUILD_NAME }}/roguelike artifact | |
elif [[ ${{ matrix.config.os_short }} == 'Windows' ]]; then | |
cp ${{ env.CMAKE_BUILD_NAME }}/$BUILD_TYPE/roguelike.exe artifact | |
fi | |
cp terminal.png artifact | |
- name: Upload artifact | |
uses: actions/upload-artifact@v2 | |
with: | |
name: ${{ matrix.config.os_short }}-version | |
path: artifact |