forked from rlane/ubpf
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #109 from trail-of-forks/alessandro/build/add-cmak…
…e-support Add: CMake, CI, macOS/Windows support, packaging, scan-build
- Loading branch information
Showing
27 changed files
with
1,115 additions
and
7 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,170 @@ | ||
# | ||
# Copyright (c) 2022-present, IO Visor Project | ||
# All rights reserved. | ||
# | ||
# This source code is licensed in accordance with the terms specified in | ||
# the LICENSE file found in the root directory of this source tree. | ||
# | ||
|
||
name: Main | ||
|
||
on: | ||
schedule: | ||
- cron: '00 21 * * *' | ||
|
||
push: | ||
branches: | ||
- '*' | ||
|
||
pull_request: | ||
branches: | ||
- '*' | ||
|
||
concurrency: | ||
group: main-${{ github.event.pull_request.number || github.sha }} | ||
cancel-in-progress: true | ||
|
||
jobs: | ||
windows_release: | ||
uses: ./.github/workflows/windows.yml | ||
with: | ||
platform: windows-latest | ||
build_type: RelWithDebInfo | ||
upload_packages: true | ||
|
||
windows_debug: | ||
uses: ./.github/workflows/windows.yml | ||
with: | ||
platform: windows-latest | ||
build_type: Debug | ||
upload_packages: true | ||
|
||
macos_release: | ||
uses: ./.github/workflows/posix.yml | ||
with: | ||
platform: macos-11 | ||
build_type: RelWithDebInfo | ||
enable_sanitizers: false | ||
enable_coverage: false | ||
scan_build: false | ||
upload_packages: true | ||
|
||
macos_release_coverage: | ||
uses: ./.github/workflows/posix.yml | ||
with: | ||
platform: macos-11 | ||
build_type: RelWithDebInfo | ||
enable_sanitizers: false | ||
enable_coverage: true | ||
scan_build: false | ||
upload_packages: false | ||
|
||
macos_release_sanitizers: | ||
uses: ./.github/workflows/posix.yml | ||
with: | ||
platform: macos-11 | ||
build_type: RelWithDebInfo | ||
enable_sanitizers: true | ||
enable_coverage: false | ||
scan_build: false | ||
upload_packages: false | ||
|
||
macos_debug: | ||
uses: ./.github/workflows/posix.yml | ||
with: | ||
platform: macos-11 | ||
build_type: Debug | ||
enable_sanitizers: false | ||
enable_coverage: false | ||
scan_build: false | ||
upload_packages: false | ||
|
||
macos_debug_coverage: | ||
uses: ./.github/workflows/posix.yml | ||
with: | ||
platform: macos-11 | ||
build_type: Debug | ||
enable_sanitizers: false | ||
enable_coverage: true | ||
scan_build: false | ||
upload_packages: false | ||
|
||
macos_debug_sanitizers: | ||
uses: ./.github/workflows/posix.yml | ||
with: | ||
platform: macos-11 | ||
build_type: Debug | ||
enable_sanitizers: true | ||
enable_coverage: false | ||
scan_build: false | ||
upload_packages: false | ||
|
||
linux_release: | ||
uses: ./.github/workflows/posix.yml | ||
with: | ||
platform: ubuntu-20.04 | ||
build_type: RelWithDebInfo | ||
enable_sanitizers: false | ||
enable_coverage: false | ||
scan_build: false | ||
upload_packages: true | ||
|
||
linux_release_scan_build: | ||
uses: ./.github/workflows/posix.yml | ||
with: | ||
platform: ubuntu-20.04 | ||
build_type: RelWithDebInfo | ||
enable_sanitizers: false | ||
enable_coverage: false | ||
scan_build: true | ||
upload_packages: false | ||
|
||
linux_release_coverage: | ||
uses: ./.github/workflows/posix.yml | ||
with: | ||
platform: ubuntu-20.04 | ||
build_type: RelWithDebInfo | ||
enable_sanitizers: false | ||
enable_coverage: true | ||
scan_build: false | ||
upload_packages: false | ||
|
||
linux_release_sanitizers: | ||
uses: ./.github/workflows/posix.yml | ||
with: | ||
platform: ubuntu-20.04 | ||
build_type: RelWithDebInfo | ||
enable_sanitizers: true | ||
enable_coverage: false | ||
scan_build: false | ||
upload_packages: false | ||
|
||
linux_debug: | ||
uses: ./.github/workflows/posix.yml | ||
with: | ||
platform: ubuntu-20.04 | ||
build_type: Debug | ||
enable_sanitizers: false | ||
enable_coverage: false | ||
scan_build: false | ||
upload_packages: false | ||
|
||
linux_debug_coverage: | ||
uses: ./.github/workflows/posix.yml | ||
with: | ||
platform: ubuntu-20.04 | ||
build_type: Debug | ||
enable_sanitizers: false | ||
enable_coverage: true | ||
scan_build: false | ||
upload_packages: false | ||
|
||
linux_debug_sanitizers: | ||
uses: ./.github/workflows/posix.yml | ||
with: | ||
platform: ubuntu-20.04 | ||
build_type: Debug | ||
enable_sanitizers: true | ||
enable_coverage: false | ||
scan_build: false | ||
upload_packages: false |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,212 @@ | ||
# | ||
# Copyright (c) 2022-present, IO Visor Project | ||
# All rights reserved. | ||
# | ||
# This source code is licensed in accordance with the terms specified in | ||
# the LICENSE file found in the root directory of this source tree. | ||
# | ||
|
||
name: Posix | ||
|
||
on: | ||
workflow_call: | ||
inputs: | ||
platform: | ||
required: true | ||
type: string | ||
|
||
build_type: | ||
required: true | ||
type: string | ||
|
||
enable_sanitizers: | ||
required: true | ||
type: boolean | ||
|
||
enable_coverage: | ||
required: true | ||
type: boolean | ||
|
||
scan_build: | ||
required: true | ||
type: boolean | ||
|
||
upload_packages: | ||
required: true | ||
type: boolean | ||
|
||
jobs: | ||
build: | ||
runs-on: ${{ inputs.platform }} | ||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
|
||
- name: Generate the cache key | ||
id: cache_key | ||
run: echo ::set-output name=VALUE::platform-${{ inputs.platform }}_type-${{ inputs.build_type }}_sanitizers-${{ inputs.enable_sanitizers }}_coverage-${{ inputs.enable_coverage }}_scan_build-${{ inputs.scan_build }} | ||
|
||
- name: Update the cache (ccache) | ||
uses: actions/cache@v1.0.3 | ||
with: | ||
path: ccache | ||
key: ${{ steps.cache_key.outputs.VALUE }}_ccache | ||
|
||
- name: Create the build folders | ||
run: | | ||
mkdir -p \ | ||
ccache | ||
- name: Install system dependencies (Linux) | ||
if: inputs.platform == 'ubuntu-20.04' | ||
run: | | ||
sudo apt-get install -y \ | ||
ccache \ | ||
ninja-build \ | ||
cmake | ||
if [[ "${{ inputs.scan_build }}" == "true" ]] ; then | ||
sudo apt-get install -y \ | ||
clang-tools | ||
fi | ||
- name: Install system dependencies (macOS) | ||
if: inputs.platform == 'macos-11' | ||
run: | | ||
brew install \ | ||
cmake \ | ||
ninja \ | ||
ccache | ||
- name: Configure the project | ||
run: | | ||
export CCACHE_DIR="$(pwd)/ccache" | ||
if [[ "${{ inputs.scan_build }}" == "true" ]] ; then | ||
mkdir scan_build_report | ||
command_prefix="scan-build -o scan_build_report" | ||
fi | ||
${command_prefix} cmake \ | ||
-G Ninja \ | ||
-S . \ | ||
-B build \ | ||
-DCMAKE_BUILD_TYPE=${{ inputs.build_type }} \ | ||
-DUBPF_ENABLE_COVERAGE=${{ inputs.enable_sanitizers }} \ | ||
-DUBPF_ENABLE_SANITIZERS=${{ inputs.enable_coverage }} \ | ||
-DUBPF_ENABLE_TESTS=true \ | ||
-DUBPF_ENABLE_INSTALL=true | ||
- name: Build the project | ||
run: | | ||
export CCACHE_DIR="$(pwd)/ccache" | ||
if [[ "${{ inputs.scan_build }}" == "true" ]] ; then | ||
command_prefix="scan-build -o scan_build_report" | ||
fi | ||
${command_prefix} cmake \ | ||
--build build \ | ||
-- -v | ||
- name: Upload scan-build report | ||
if: inputs.scan_build == true | ||
uses: actions/upload-artifact@6673cd052c4cd6fcf4b4e6e60ea986c889389535 | ||
with: | ||
name: scan-build_report | ||
path: ${{github.workspace}}/scan_build_report | ||
retention-days: 5 | ||
|
||
- name: Run the tests | ||
run: | | ||
cmake \ | ||
--build build \ | ||
--target test \ | ||
-- -v | ||
- name: Run the install target | ||
run: | | ||
mkdir install | ||
export DESTDIR=$(pwd)/install | ||
cmake \ | ||
--build build \ | ||
--target install | ||
- name: Generate the DEB package | ||
if: inputs.platform == 'ubuntu-20.04' | ||
run: | | ||
cmake \ | ||
-S . \ | ||
-B build \ | ||
-DUBPF_ENABLE_PACKAGE=true \ | ||
-DCPACK_GENERATOR=DEB | ||
cmake \ | ||
--build build \ | ||
--target package | ||
- name: Generate the RPM package | ||
if: inputs.platform == 'ubuntu-20.04' | ||
run: | | ||
cmake \ | ||
-S . \ | ||
-B build \ | ||
-DUBPF_ENABLE_PACKAGE=true \ | ||
-DCPACK_GENERATOR=RPM | ||
cmake \ | ||
--build build \ | ||
--target package | ||
- name: Generate the TGZ package | ||
run: | | ||
cmake \ | ||
-S . \ | ||
-B build \ | ||
-DUBPF_ENABLE_PACKAGE=true \ | ||
-DCPACK_GENERATOR=TGZ | ||
cmake \ | ||
--build build \ | ||
--target package | ||
- name: Locate the packages | ||
id: package_locations | ||
if: inputs.upload_packages == true | ||
run: | | ||
echo ::set-output name=REL_DEB_PACKAGE_PATH::$(ls build/*.deb) | ||
echo ::set-output name=REL_RPM_PACKAGE_PATH::$(ls build/*.rpm) | ||
echo ::set-output name=REL_TGZ_PACKAGE_PATH::$(ls build/*.tar.gz) | ||
- name: Upload the DEB package | ||
if: inputs.upload_packages == true && inputs.platform == 'ubuntu-20.04' | ||
uses: actions/upload-artifact@6673cd052c4cd6fcf4b4e6e60ea986c889389535 | ||
with: | ||
name: linux_deb_package | ||
path: ${{ steps.package_locations.outputs.REL_DEB_PACKAGE_PATH }} | ||
retention-days: 5 | ||
|
||
- name: Upload the RPM package | ||
if: inputs.upload_packages == true && inputs.platform == 'ubuntu-20.04' | ||
uses: actions/upload-artifact@6673cd052c4cd6fcf4b4e6e60ea986c889389535 | ||
with: | ||
name: linux_rpm_package | ||
path: ${{ steps.package_locations.outputs.REL_RPM_PACKAGE_PATH }} | ||
retention-days: 5 | ||
|
||
- name: Upload the Linux TGZ package | ||
if: inputs.upload_packages == true && inputs.platform == 'ubuntu-20.04' | ||
uses: actions/upload-artifact@6673cd052c4cd6fcf4b4e6e60ea986c889389535 | ||
with: | ||
name: linux_tgz_package | ||
path: ${{ steps.package_locations.outputs.REL_TGZ_PACKAGE_PATH }} | ||
retention-days: 5 | ||
|
||
- name: Upload the macOS TGZ package | ||
if: inputs.upload_packages == true && inputs.platform == 'macos-11' | ||
uses: actions/upload-artifact@6673cd052c4cd6fcf4b4e6e60ea986c889389535 | ||
with: | ||
name: macos_tgz_package | ||
path: ${{ steps.package_locations.outputs.REL_TGZ_PACKAGE_PATH }} | ||
retention-days: 5 |
Oops, something went wrong.