-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
3fdcb34
commit b1032e8
Showing
4 changed files
with
197 additions
and
139 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,188 @@ | ||
name: compile-package | ||
description: compile and package collect | ||
inputs: | ||
major_version: | ||
description: "collect major version" | ||
required: true | ||
minor_version: | ||
description: "collect minor version" | ||
required: true | ||
distrib: | ||
description: linux distrib (bookworm, bullseye...) | ||
required: true | ||
package_extension: | ||
description: rpm or deb | ||
required: true | ||
arch: | ||
description: amd64 or arm64 | ||
required: true | ||
release: | ||
description: "release id" | ||
required: true | ||
commit_hash: | ||
description: "github sha" | ||
required: true | ||
stability: | ||
description: "unstable, testing, stable or canary " | ||
required: true | ||
rpm_gpg_key: | ||
description: The rpm gpg key | ||
required: true | ||
rpm_gpg_signing_key_id: | ||
description: The rpm gpg signing key identifier | ||
required: true | ||
rpm_gpg_signing_passphrase: | ||
description: The rpm gpg signing passphrase | ||
required: true | ||
|
||
runs: | ||
using: composite | ||
|
||
steps: | ||
- name: Checkout sources | ||
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 | ||
|
||
- name: Install sccache | ||
run: | | ||
if [ "${{ inputs.package_extension }}" = "deb" ]; then | ||
apt-get update | ||
apt-get install -y wget | ||
elif [ "${{ inputs.package_extension }}" = "rpm" ]; then | ||
dnf install -y wget | ||
fi | ||
if [ "${{ inputs.arch }}" = "amd64" ]; then | ||
wget https://github.com/mozilla/sccache/releases/download/v0.7.4/sccache-v0.7.4-x86_64-unknown-linux-musl.tar.gz | ||
tar xzf sccache-v0.7.4-x86_64-unknown-linux-musl.tar.gz | ||
mv sccache-v0.7.4-x86_64-unknown-linux-musl/sccache /usr/bin/ | ||
elif [ "${{ inputs.arch }}" = "arm64" ]; then | ||
wget https://github.com/mozilla/sccache/releases/download/v0.7.4/sccache-v0.7.4-aarch64-unknown-linux-musl.tar.gz | ||
tar xzf sccache-v0.7.4-aarch64-unknown-linux-musl.tar.gz | ||
mv sccache-v0.7.4-aarch64-unknown-linux-musl/sccache /usr/bin/ | ||
fi | ||
${SCCACHE_PATH} --start-server | ||
shell: bash | ||
|
||
- name: Generate selinux binaries | ||
if: ${{ inputs.package_extension == 'rpm' }} | ||
run: | | ||
cd selinux | ||
for MODULE in "centreon-engine" "centreon-broker" "centreon-monitoring-agent"; do | ||
cd $MODULE | ||
sed -i "s/@VERSION@/${{ inputs.major_version }}.${{ inputs.minor_version }}/g" $MODULE.te | ||
make -f /usr/share/selinux/devel/Makefile | ||
cd - | ||
done | ||
shell: bash | ||
|
||
- name: Remove selinux packaging files on debian | ||
if: ${{ inputs.package_extension == 'deb' }} | ||
run: rm -f packaging/*-selinux.yaml | ||
shell: bash | ||
|
||
- name: Compile sources | ||
run: | | ||
CMAKE="cmake3" | ||
if [ "${{ inputs.package_extension }}" = "deb" ]; then | ||
CMAKE="cmake" | ||
fi | ||
if [ "${{ inputs.arch }}" = "arm64" ]; then | ||
export VCPKG_FORCE_SYSTEM_BINARIES=1 | ||
export TRIPLET=arm64-linux-release | ||
else | ||
export TRIPLET=x64-linux-release | ||
fi | ||
mv /root/.cache /github/home/ | ||
export VCPKG_ROOT="/vcpkg" | ||
export PATH="$VCPKG_ROOT:$PATH" | ||
$CMAKE \ | ||
-B build \ | ||
-DVCPKG_OVERLAY_TRIPLETS=/custom-triplets \ | ||
-DVCPKG_TARGET_TRIPLET=$TRIPLET \ | ||
-DVCPKG_OVERLAY_PORTS=/overlays \ | ||
-GNinja \ | ||
-DDEBUG_ROBOT=OFF \ | ||
-DWITH_TESTING=OFF \ | ||
-DWITH_BENCH=ON \ | ||
-DWITH_MODULE_SIMU=OFF \ | ||
-DCMAKE_INSTALL_PREFIX=/usr \ | ||
-DWITH_STARTUP_SCRIPT=systemd \ | ||
-DWITH_ENGINE_LOGROTATE_SCRIPT=ON \ | ||
-DWITH_USER_BROKER=centreon-broker \ | ||
-DWITH_GROUP_BROKER=centreon-broker \ | ||
-DWITH_USER_ENGINE=centreon-engine \ | ||
-DWITH_GROUP_ENGINE=centreon-engine \ | ||
-DWITH_VAR_DIR=/var/log/centreon-engine \ | ||
-DWITH_DAEMONS=ON \ | ||
-DWITH_CREATE_FILES=OFF \ | ||
-DWITH_CONFIG_FILES=ON \ | ||
-DCMAKE_BUILD_TYPE=RelWithDebInfo \ | ||
-DCMAKE_C_COMPILER_LAUNCHER=${SCCACHE_PATH} \ | ||
-DCMAKE_CXX_COMPILER_LAUNCHER=${SCCACHE_PATH} \ | ||
-S . | ||
ninja -Cbuild | ||
shell: bash | ||
|
||
- name: Cache statistics | ||
run: ${SCCACHE_PATH} --show-stats | ||
shell: bash | ||
|
||
- name: Stop sccache server | ||
run: ${SCCACHE_PATH} --stop-server | ||
shell: bash | ||
|
||
- name: Generate debug files | ||
run: | | ||
for file in $(find build/{broker,engine,clib,connectors} -name '*.so' -type f); do | ||
echo "Making a debug file of $file" | ||
objcopy --only-keep-debug $file $file.debug | ||
objcopy --strip-debug $file | ||
objcopy --add-gnu-debuglink $file.debug $file | ||
done | ||
exe=("build/broker/cbd" | ||
"build/broker/watchdog/cbwd" | ||
"build/engine/centengine" | ||
"build/engine/centenginestats" | ||
"build/engine/modules/bench/centengine_bench_passive" | ||
"build/connectors/perl/centreon_connector_perl" | ||
"build/connectors/ssh/centreon_connector_ssh" | ||
"build/ccc/ccc" | ||
"build/agent/centagent") | ||
for file in ${exe[@]}; do | ||
echo "Making a debug file of $file" | ||
objcopy --only-keep-debug $file $file.debug | ||
objcopy --strip-debug $file | ||
objcopy --add-gnu-debuglink $file.debug $file | ||
done | ||
shell: bash | ||
|
||
- uses: ./.github/actions/package | ||
with: | ||
nfpm_file_pattern: "packaging/*.yaml" | ||
distrib: ${{ inputs.distrib }} | ||
package_extension: ${{ inputs.package_extension }} | ||
major_version: ${{ inputs.major_version }} | ||
minor_version: ${{ inputs.minor_version }} | ||
release: ${{ inputs.release }} | ||
arch: ${{ inputs.arch }} | ||
commit_hash: ${{ inputs.commit_hash }} | ||
cache_key: ${{ github.run_id }}-${{ github.sha }}-${{ inputs.package_extension}}-centreon-collect-${{ inputs.distrib }}-${{ inputs.arch }}-${{ github.head_ref || github.ref_name }} | ||
rpm_gpg_key: ${{ inputs.rpm_gpg_key }} | ||
rpm_gpg_signing_key_id: ${{ inputs.rpm_gpg_signing_key_id }} | ||
rpm_gpg_signing_passphrase: ${{ inputs.rpm_gpg_signing_passphrase }} | ||
stability: ${{ inputs.stability }} | ||
|
||
- name: Cleaning not needed packages | ||
shell: bash | ||
run: rm -rf *-debuginfo*.${{ inputs.package_extension }} | ||
|
||
# set condition to true if artifacts are needed | ||
- if: ${{ false }} | ||
name: Upload package artifacts | ||
uses: actions/upload-artifact@65462800fd760344b1a7b4382951275a0abb4808 # v4.3.3 | ||
with: | ||
name: packages-${{ inputs.distrib }}-${{ inputs.arch }} | ||
path: ./*.${{ inputs.package_extension}} | ||
retention-days: 1 |
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
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 |
---|---|---|
|
@@ -17,7 +17,7 @@ jobs: | |
steps: | ||
- name: Checkout sources | ||
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 | ||
|
||
- name: install msvc command prompt | ||
uses: ilammy/[email protected] | ||
|
||
|
@@ -51,4 +51,3 @@ jobs: | |
Write-Host "aws s3 cp $file_name_extension s3://centreon-collect-robot-report/$file_name_extension" | ||
[System.Environment]::SetEnvironmentVariable("AWS_EC2_METADATA_DISABLED","true") | ||
aws s3 cp $file_name_extension s3://centreon-collect-robot-report/$file_name_extension | ||
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