Skip to content

Build

Build #2059

Workflow file for this run

name: Build
on:
workflow_dispatch:
push:
branches:
- "master"
- "stable_master"
- "dev"
paths:
- "**.hpp"
- "**.cpp"
- "**.h"
- "**.c"
- "**CMakeLists.txt"
- "**.cmake"
- ".github/workflows/build.yml"
- "docker/**"
pull_request:
branches:
- "master"
- "stable_master"
paths:
- "**.hpp"
- "**.cpp"
- "**.h"
- "**.c"
- "**CMakeLists.txt"
- "**.cmake"
- ".github/workflows/build.yml"
- "docker/**"
jobs:
build-windows:
name: Windows build
runs-on: windows-2019
strategy:
matrix:
arch: [Win32, x64]
steps:
- uses: actions/checkout@v3
with:
clean: true
submodules: recursive
fetch-depth: 0
- name: Declare build output variables
id: vars
shell: bash
env:
HEAD_REF: ${{ github.head_ref || github.ref_name }}
run: |
echo "build_version=$(git describe --always --tags "refs/remotes/origin/${HEAD_REF}")" >> $GITHUB_OUTPUT
echo "build_config=RelWithDebInfo" >> $GITHUB_OUTPUT
- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: '3.10'
- name: Install CMake
uses: lukka/get-cmake@latest
with:
cmakeVersion: "3.23.2"
- name: Install latest conan
run: |
python -m pip install --upgrade pip
pip install -v "conan==1.57.0"
- name: Try to restore conan cache
id: conan-cache-restore
uses: actions/cache/restore@v3
env:
cache-name: cache-conan-modules
with:
path: ~/.conan/data
key: conan-windows-${{ matrix.arch }}-${{ hashFiles('CMakeLists.txt', 'lib/CMakeLists.txt', 'SDK/CMakeLists.txt', 'SDK/lib/cmake-conan/conan.cmake', 'SDK/lib/cmake-conan/conan-omp.cmake') }}
- name: Generate build files
run: |
$env:OMP_BUILD_VERSION=$(git rev-list $(git rev-list --max-parents=0 HEAD) HEAD | Measure-Object -Line).Lines
$env:OMP_BUILD_COMMIT=$(git rev-parse HEAD)
mkdir build
cd build
cmake -DCMAKE_BUILD_TYPE=${{ steps.vars.outputs.build_config }} .. -A ${{ matrix.arch }} -T "ClangCL"
- name: Try to save conan cache
if: steps.conan-cache-restore.outputs.cache-hit != 'true'
uses: actions/cache/save@v3
env:
cache-name: cache-conan-modules
with:
path: ~/.conan/data
key: ${{ steps.conan-cache-restore.outputs.cache-primary-key }}
- name: Build
run: |
cd build
cmake --build . --config ${{ steps.vars.outputs.build_config }}
- name: Create a build archive
id: build
shell: bash
env:
HEAD_REF: ${{ github.head_ref || github.ref_name }}
run: |
version=${{ steps.vars.outputs.build_version }}
artifact_name="open.mp-win-${{ matrix.arch }}-${version}"
echo "artifact_name=${artifact_name}" >> $GITHUB_OUTPUT
cd build/Output/*
powershell -NoLogo -NoProfile -Command Compress-Archive -DestinationPath "${artifact_name}.zip" -Path "Server"
- name: Upload build artifacts
uses: actions/upload-artifact@v3
with:
name: ${{ steps.build.outputs.artifact_name }}
path: build/Output/${{ steps.vars.outputs.build_config }}/${{ steps.build.outputs.artifact_name }}.zip
if-no-files-found: error
build-linux:
name: Linux build
runs-on: ubuntu-latest
strategy:
matrix:
arch: [x86, x86_64]
ssl: [dynamic, static]
steps:
- uses: actions/checkout@v3
with:
clean: true
submodules: recursive
fetch-depth: 0
- name: Declare build output variables
id: vars
shell: bash
env:
HEAD_REF: ${{ github.head_ref || github.ref_name }}
run: |
echo "build_version=$(git describe --always --tags "refs/remotes/origin/${HEAD_REF}")" >> $GITHUB_OUTPUT
echo "build_config=RelWithDebInfo" >> $GITHUB_OUTPUT
echo "build_ubuntu_version=18.04" >> $GITHUB_OUTPUT
echo "build_shared=${{ matrix.ssl == 'dynamic' }}" >> $GITHUB_OUTPUT
echo "build_server=1" >> $GITHUB_OUTPUT
echo "build_tools=0" >> $GITHUB_OUTPUT
echo "build_target_arch=${{ matrix.arch }}" >> $GITHUB_OUTPUT
- name: Set ownership
run: |
# this is to fix GIT not liking owner of the checkout dir
chown -R $(id -u):$(id -g) $PWD
- name: Try to restore conan cache
id: conan-cache-restore
uses: actions/cache/restore@v3
env:
cache-name: cache-conan-modules
with:
path: docker/conan/data
key: conan-linux-${{ matrix.arch }}-${{ matrix.ssl }}-${{ hashFiles('CMakeLists.txt', 'lib/CMakeLists.txt', 'SDK/CMakeLists.txt', 'SDK/lib/cmake-conan/conan.cmake', 'SDK/lib/cmake-conan/conan-omp.cmake') }}
- name: Build
run: |
cd docker
CONFIG=${{ steps.vars.outputs.build_config }} UBUNTU_VERSION=${{ steps.vars.outputs.build_ubuntu_version }} BUILD_SHARED=${{ steps.vars.outputs.build_shared }} BUILD_SERVER=${{ steps.vars.outputs.build_server }} BUILD_TOOLS=${{ steps.vars.outputs.build_tools }} TARGET_BUILD_ARCH=${{ steps.vars.outputs.build_target_arch }} ./build.sh
- name: Try to save conan cache
if: steps.conan-cache-restore.outputs.cache-hit != 'true'
uses: actions/cache/save@v3
env:
cache-name: cache-conan-modules
with:
path: docker/conan/data
key: ${{ steps.conan-cache-restore.outputs.cache-primary-key }}
- name: Create a build archive
id: build
env:
HEAD_REF: ${{ github.head_ref || github.ref_name }}
run: |
version=${{ steps.vars.outputs.build_version }}
artifact_name="open.mp-linux-${{ matrix.arch }}${{ matrix.ssl == 'dynamic' && '-dynssl' || '' }}-${version}"
echo "artifact_name=${artifact_name}" >> $GITHUB_OUTPUT
cd docker/build/Output/*
sudo tar -cJvf "${artifact_name}.tar.xz" "Server"
- name: Upload build artifacts
uses: actions/upload-artifact@v3
with:
name: ${{ steps.build.outputs.artifact_name }}
path: docker/build/Output/${{ steps.vars.outputs.build_config }}/${{ steps.build.outputs.artifact_name }}.tar.xz
if-no-files-found: error
abi-check:
if: github.event_name == 'pull_request'
name: SDK ABI check
needs: build-linux
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
clean: true
submodules: recursive
fetch-depth: 0
- name: Declare build variables
id: vars
shell: bash
env:
HEAD_REF: ${{ github.head_ref || github.ref_name }}
run: |
echo "build_version=$(git describe --always --tags "refs/remotes/origin/${HEAD_REF}")" >> $GITHUB_OUTPUT
- uses: actions/download-artifact@v3
id: download
with:
name: open.mp-linux-x86-dynssl-${{ steps.vars.outputs.build_version }}
path: docker/ref
- name: Build & run abi-check
shell: bash
run: |
cd docker
chmod +x ./abicheck.sh
chmod +x ./abicheck_ubuntu-18.04/docker-entrypoint.sh
CONFIG=RelWithDebInfo NIGHTLY_REPO="${{ github.repository }}" REF_ARCHIVE="open.mp-linux-x86-dynssl-${{ steps.vars.outputs.build_version }}.tar.xz" UBUNTU_VERSION=18.04 BUILD_SERVER=0 BUILD_TOOLS=1 ./abicheck.sh
build-arm-gnu:
name: ARM build (GNU)
runs-on: ubuntu-latest
strategy:
matrix:
arch: [arm32, aarch64]
ssl: [dynamic, static]
steps:
- uses: actions/checkout@v3
with:
clean: true
submodules: recursive
fetch-depth: 0
- name: Declare build output variables
id: vars
shell: bash
env:
HEAD_REF: ${{ github.head_ref || github.ref_name }}
run: |
echo "build_version=$(git describe --always --tags "refs/remotes/origin/${HEAD_REF}")" >> $GITHUB_OUTPUT
echo "build_config=RelWithDebInfo" >> $GITHUB_OUTPUT
- name: Try to restore conan cache
id: conan-cache-restore
uses: actions/cache/restore@v3
env:
cache-name: cache-conan-modules
with:
path: docker/conan/data
key: conan-linux-${{ matrix.arch }}-${{ matrix.ssl }}-${{ hashFiles('CMakeLists.txt', 'lib/CMakeLists.txt', 'SDK/CMakeLists.txt', 'SDK/lib/cmake-conan/conan.cmake', 'SDK/lib/cmake-conan/conan-omp.cmake') }}
- name: Run ARM build
uses: pguyot/[email protected]
with:
base_image: ${{ matrix.arch == 'arm32' && 'raspios_lite' || 'raspios_lite_arm64' }}:2022-04-04
image_additional_mb: 10000
bind_mount_repository: true
cpu: cortex-a7
commands: |
apt update && apt install -y ninja-build clang-11 python3-pip libstdc++6 libc6
pip install --upgrade pip setuptools wheel
pip3 install --user -v "conan==1.59.0"
pip3 install --user -v "cmake==3.23.3"
export CC=/usr/bin/clang-11
export CXX=/usr/bin/clang++-11
export PATH=~/.local/bin:${PATH}
mkdir -p docker/conan/data
mkdir ~/.conan
mv docker/conan/data ~/.conan
cmake -S . -B build -G Ninja -DTARGET_BUILD_ARCH=${{ matrix.arch == 'arm32' && 'armv7' || 'armv8' }} -DCMAKE_BUILD_TYPE=${{ steps.vars.outputs.build_config }} -DSHARED_OPENSSL=${{ matrix.ssl == 'dynamic' }} -DSTATIC_STDCXX=true -DBUILD_SERVER=1 -DBUILD_ABI_CHECK_TOOL=0
cmake --build build --config ${{ steps.vars.outputs.build_config }} --parallel $(nproc)
mv ~/.conan/data docker/conan
- name: Upload build artifacts
uses: actions/upload-artifact@v3
with:
name: open.mp-linux-${{ matrix.arch }}${{ matrix.ssl == 'dynamic' && '-dynssl' || '' }}-${{ steps.vars.outputs.build_version }}
path: build/Output/${{ steps.vars.outputs.build_config }}/Server
if-no-files-found: error
- name: Try to save conan cache
if: steps.conan-cache-restore.outputs.cache-hit != 'true'
uses: actions/cache/save@v3
env:
cache-name: cache-conan-modules
with:
path: docker/conan/data
key: ${{ steps.conan-cache-restore.outputs.cache-primary-key }}