Skip to content

Add workflow to build deb packages #320

Add workflow to build deb packages

Add workflow to build deb packages #320

# Copyright (c) 2021-2022-2023-2024 Luca Cappa
# Released under the term specified in file LICENSE.txt
# SPDX short identifier: MIT
#
# The peculiarity of this workflow is that assumes vcpkg stored as a submodule of this repository.
# The workflow runs on x64 and ARM platforms.
# Workflow steps:
# - Setup vcpkg and cache it on the GitHub Action cloud based cache.
# - Runs CMake with CMakePreset.json using a presest configuration
# that leverages the vcpkg's toolchain file. This will automatically run vcpkg
# to install dependencies described by the vcpkg.json manifest file.
# This stage also runs vcpkg with Binary Caching leveraging GitHub Action cache to
# store the built packages artifacts, hence it will be a no-op if those are restored
# from cache (e.g., already previously built).
# - Finally builds the sources with Ninja, and tests as well.
name: hosted-ninja-vcpkg_submod-autocache
on:
push:
pull_request:
branches:
- v11
- main
jobs:
job:
name: ${{ matrix.os }}-${{ github.workflow }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-13, macos-14, windows-latest]
include:
- os: windows-latest
triplet: x64-windows
- os: ubuntu-latest
triplet: x64-linux
- os: macos-13
triplet: x64-osx
- os: macos-14
triplet: arm64-osx
permissions:
contents: 'read'
id-token: 'write'
env:
#
# [OPTIONAL] Define the vcpkg's triplet
# you want to enforce, otherwise the default one
# for the hosting system will be automatically
# choosen (x64 is the default on all platforms,
# e.g. x64-osx).
VCPKG_DEFAULT_TRIPLET: ${{ matrix.triplet }}
steps:
- uses: actions/checkout@v4
with:
submodules: true
- uses: lukka/[email protected]
- name: Restore from cache and setup vcpkg executable and data files.
uses: lukka/run-vcpkg@v11
with:
vcpkgJsonGlob: 'vcpkg.json'
# Retrieve google credentials through WIF - needed to run tests
# see https://github.com/google-github-actions/auth?tab=readme-ov-file#workload-identity-federation-through-a-service-account
- uses: google-github-actions/auth@v2
with:
service_account: 'khiops-gcs-driver-test-sa@ino-olr-dak-ideal-sbx.iam.gserviceaccount.com'
workload_identity_provider: 'projects/322269704080/locations/global/workloadIdentityPools/github/providers/my-repo'
- name: Install coverage tools
if: matrix.os == 'ubuntu-latest'
run: |
sudo apt-get update
sudo apt-get install lcov gcovr
# Note: if the preset misses the "configuration", it is possible to explicitly select the
# configuration with the additional `--config` flag, e.g.:
# buildPreset: 'ninja-vcpkg'
# buildPresetAdditionalArgs: "[`--config`, `Release`]"
# testPreset: 'ninja-vcpkg'
# testPresetAdditionalArgs: "[`--config`, `Release`]"
- name: Build debug version and run sanitizer checks.
if: matrix.os == 'ubuntu-latest'
uses: lukka/run-cmake@v10
with:
configurePreset: 'ninja-multi-vcpkg'
configurePresetAdditionalArgs: "['-DCMAKE_BUILD_TYPE=Debug']"
buildPreset: 'ninja-vcpkg-debug'
testPreset: 'test-debug'
testPresetAdditionalArgs: "['--output-on-failure']"
- name: Generate coverage report
if: matrix.os == 'ubuntu-latest'
run: |
cmake --build --preset ninja-vcpkg-debug --target khiops-gcs_coverage --target khiops-gcs_cobertura
- name: Upload coverage results
uses: actions/upload-artifact@v4
if: matrix.os == 'ubuntu-latest'
with:
name: coverage
path: |
builds/ninja-multi-vcpkg/coverage/*
builds/ninja-multi-vcpkg/coverage.*
if-no-files-found: ignore
- name: Run CMake+vcpkg+Ninja+CTest to build packages and generate/build/test the code.
uses: lukka/run-cmake@v10
with:
configurePreset: 'ninja-multi-vcpkg'
configurePresetAdditionalArgs: "['-DCMAKE_BUILD_TYPE=Release']"
buildPreset: 'ninja-vcpkg-release'
testPreset: 'test-release'
testPresetAdditionalArgs: "['--output-on-failure']"
- name: Upload the packages as artifacts
uses: actions/upload-artifact@v4
with:
name: binary-${{ matrix.os }}
path: |
builds/ninja-multi-vcpkg/lib/*.dylib
builds/ninja-multi-vcpkg/lib/*.so
builds/ninja-multi-vcpkg/bin/*.dll
if-no-files-found: ignore