Skip to content

Matrix Build

Matrix Build #6233

Workflow file for this run

---
# Automatic building in CI
name: "Matrix Build"
on:
push:
pull_request:
branches: [main, develop]
merge_group:
jobs:
build:
strategy:
matrix:
os: [ubuntu-20.04, ubuntu-22.04, windows-2019, windows-2022]
fail-fast: false
runs-on: ${{matrix.os}}
env:
CMAKE_INSTALL_PREFIX: "${{ github.workspace }}/install"
steps:
- name: Checkout Sample-Server
uses: actions/checkout@v4
with:
path: Sample-Server
submodules: recursive
- name: Set Windows CMAKE_GENERATOR 2019
if: matrix.os == 'windows-2019'
run: |
#shellcheck disable=SC2154
echo "CMAKE_GENERATOR=Visual Studio 16 2019">> "$env:GITHUB_ENV"
echo "ARG_CTEST=-C Debug">> "$env:GITHUB_ENV"
- name: Set Windows CMAKE_GENERATOR 2022
if: matrix.os == 'windows-2022'
run: |
#shellcheck disable=SC2154
echo "CMAKE_GENERATOR=Visual Studio 17 2022">> "$env:GITHUB_ENV"
echo "ARG_CTEST=-C Debug">> "$env:GITHUB_ENV"
- name: Build server with dependencies
# yamllint disable rule:line-length
run: |
mkdir -p build
cd build
cmake ../Sample-Server/.github/ -DCMAKE_INSTALL_PREFIX:PATH=${{ env.CMAKE_INSTALL_PREFIX }}
cmake --build .
# yamllint enable rule:line-length
- name: Upload Artefacts
uses: actions/upload-artifact@v3
with:
name: Sample-Server-${{matrix.os}}
path: ${{ env.CMAKE_INSTALL_PREFIX }}/bin
- name: Test Sample-Server
run: |
cd build/SampleServer-build/
ctest --output-on-failure ${{ env.ARG_CTEST }}
docker:
runs-on: ubuntu-22.04
env:
# Check if this is not a pull request andGITHUB_TOKEN is set
# As all env variables are strings, you need to compare
# against "== 'true'" (not "== true")
IS_NOT_PR: "${{ !github.head_ref && true }}"
steps:
- name: Checkout Sample-Server
uses: actions/checkout@v4
with:
path: Sample-Server
submodules: recursive
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/[email protected]
- name: PrepareReg Names
# yamllint disable rule:line-length
run: |
echo IMAGE_REPOSITORY="$(echo "${{ github.repository }}" | tr '[:upper:]' '[:lower:]')" >> "$GITHUB_ENV"
echo IMAGE_TAG="$(echo "${{ github.ref }}" | tr '[:upper:]' '[:lower:]' | awk '{sub(/([^\/]*\/){2}/,""); gsub(/\/|_/, "-")}1')" >> "$GITHUB_ENV"
echo IS_NOT_PR="${{ env.IS_NOT_PR }})"
# yamllint enable rule:line-length
- name: Login to GitHub Container Registry
uses: docker/[email protected]
if: env.IS_NOT_PR == 'true' && ${{ github.actor }} != 'dependabot'
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build Docker Release
uses: "docker/[email protected]"
with:
provenance: false
file: "./Sample-Server/Dockerfile"
context: ./Sample-Server
platforms: linux/amd64
push: ${{env.IS_NOT_PR == 'true'}}
tags: |
ghcr.io/${{ env.IMAGE_REPOSITORY }}:${{ env.IMAGE_TAG }}