Skip to content

fix arch (#644)

fix arch (#644) #93

name: Vcpkg Build
on:
push:
branches:
- master
pull_request:
jobs:
build_vcpkg:
name: build-vcpkg-${{ matrix.os }}-${{ matrix.gcc }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: true
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
gcc: [11, 12, 13]
include:
- os: windows-latest
extension: .exe
exclude:
#- os: macos-latest # Allow one gcc variant for mac/windows, since they don't use gcc
#gcc: 11
- os: macos-latest
gcc: 12
- os: macos-latest
gcc: 13
#- os: windows-latest
#gcc: 11
- os: windows-latest
gcc: 12
- os: windows-latest
gcc: 13
env:
# Indicates the CMake build directory where project files and binaries are being produced.
CMAKE_BUILD_DIR: ${{ github.workspace }}/build
# Indicates the location of the vcpkg as a Git submodule of the project repository.
VCPKG_ROOT: ${{ github.workspace }}/external/vcpkg
steps:
- name: Install Dependencies (Linux)
run: |
sudo apt-get update && \
sudo apt-get install --no-install-recommends \
libboost-dev \
libsodium-dev \
libprotobuf-dev \
protobuf-compiler \
libgflags-dev \
libutempter-dev \
build-essential \
ninja-build \
libcurl4-openssl-dev \
curl \
zip \
unzip \
tar \
cmake \
libutempter-dev \
libunwind-dev
if: matrix.os == 'ubuntu-latest'
- name: Install Dependencies (Windows)
run: choco install -y ninja
if: matrix.os == 'windows-latest'
- name: Install Dependencies (macOS)
run: brew update && brew install ninja cmake automake autoconf libtool
if: matrix.os == 'macos-latest'
- uses: actions/checkout@v4
with:
submodules: recursive
- name: Set up GCC (Ubuntu)
uses: egor-tensin/setup-gcc@v1
with:
version: ${{ matrix.gcc }}
platform: x64
if: matrix.os == 'ubuntu-latest'
# Restore both vcpkg and its artifacts from the GitHub cache service.
- name: Restore vcpkg and its artifacts.
uses: actions/cache@v4
with:
path: |
${{ 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.
# The key includes: hash of the vcpkg.json file, the hash of the vcpkg Git commit id, and the used vcpkg's triplet. The vcpkg's commit id would suffice, but computing an hash out it does not harm.
# 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: |
et-vcpkg-${{ hashFiles( 'vcpkg.json' ) }}-${{ hashFiles( '.git/modules/external/vcpkg/HEAD' )}}-${{ matrix.os }}-${{ matrix.gcc }}-master-1
- name: Show content of workspace after cache has been restored
run: find $RUNNER_WORKSPACE
shell: bash
# On Windows runners, let's ensure to have the Developer Command Prompt environment setup correctly. As used here the Developer Command Prompt created is targeting x64 and using the default the Windows SDK.
- uses: ilammy/msvc-dev-cmd@v1
# Run CMake to generate Ninja project files, using the vcpkg's toolchain file to resolve and install the dependencies as specified in vcpkg.json.
- name: Install dependencies and generate project files (linux)
env:
CC: gcc-${{ matrix.gcc }}
CXX: g++-${{ matrix.gcc }}
run: |
cmake -S "${{ github.workspace }}" -B "${{ env.CMAKE_BUILD_DIR }}" -GNinja -DCMAKE_BUILD_TYPE=RelWithDebInfo
if: matrix.os == 'ubuntu-latest'
- name: Install dependencies and generate project files (mac)
run: |
cmake -S "${{ github.workspace }}" -B "${{ env.CMAKE_BUILD_DIR }}" -GNinja -DCMAKE_BUILD_TYPE=RelWithDebInfo
if: matrix.os == 'macos-latest'
- name: Install dependencies and generate project files (windows)
run: |
cmake -S "${{ github.workspace }}" -B "${{ env.CMAKE_BUILD_DIR }}" -GNinja -DCMAKE_BUILD_TYPE=RelWithDebInfo
if: matrix.os == 'windows-latest'
# Build the whole project with Ninja (which is spawn by CMake).
- name: Build
run: |
cmake --build "${{ env.CMAKE_BUILD_DIR }}"
- uses: actions/upload-artifact@v4
with:
name: et-client-${{matrix.os}}-gcc${{matrix.gcc}}
path: ${{ env.CMAKE_BUILD_DIR }}/et${{matrix.extension}}