mirror of
https://github.com/maxDcb/C2LinuxImplant
synced 2026-06-08 15:48:43 +00:00
Maj CI/CD
This commit is contained in:
@@ -0,0 +1,72 @@
|
||||
name: CI
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
pull_request:
|
||||
push:
|
||||
branches:
|
||||
- "**"
|
||||
tags-ignore:
|
||||
- "*"
|
||||
|
||||
env:
|
||||
BUILD_DIR: build-ci
|
||||
BUILD_TYPE: Release
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
jobs:
|
||||
build-test:
|
||||
name: Build and test Linux
|
||||
runs-on: ubuntu-22.04
|
||||
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
submodules: recursive
|
||||
|
||||
- name: Set up Python
|
||||
uses: actions/setup-python@v5
|
||||
with:
|
||||
python-version: "3.x"
|
||||
|
||||
- name: Install Linux dependencies
|
||||
run: |
|
||||
sudo apt-get update
|
||||
sudo apt-get install -y libsmbclient-dev
|
||||
|
||||
- name: Install Conan
|
||||
run: |
|
||||
python -m pip install --upgrade pip
|
||||
python -m pip install "conan>=2,<3"
|
||||
conan profile detect --force
|
||||
|
||||
- name: Cache Conan packages
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: ~/.conan2
|
||||
key: conan-${{ runner.os }}-${{ hashFiles('conanfile.txt') }}
|
||||
restore-keys: |
|
||||
conan-${{ runner.os }}-
|
||||
|
||||
- name: Configure CI tests
|
||||
run: |
|
||||
cmake \
|
||||
-S . \
|
||||
-B "$BUILD_DIR" \
|
||||
-DCMAKE_BUILD_TYPE="$BUILD_TYPE" \
|
||||
-DC2CORE_BUILD_TESTS=ON \
|
||||
-DC2CORE_BUILD_FUNCTIONAL_TESTS=OFF \
|
||||
-DCMAKE_PROJECT_TOP_LEVEL_INCLUDES="$GITHUB_WORKSPACE/conan_provider.cmake"
|
||||
|
||||
- name: Build
|
||||
run: cmake --build "$BUILD_DIR" --config "$BUILD_TYPE" --parallel "$(nproc)"
|
||||
|
||||
- name: Run CI tests
|
||||
run: ctest --test-dir "$BUILD_DIR" --output-on-failure --timeout 60
|
||||
|
||||
- name: Functional tests
|
||||
if: ${{ false }}
|
||||
run: echo "Functional tests require a lab/runtime environment and are intentionally skipped in standard CI."
|
||||
@@ -1,16 +1,13 @@
|
||||
name: CI CD
|
||||
name: CD
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
pull_request:
|
||||
push:
|
||||
branches:
|
||||
- "**"
|
||||
tags:
|
||||
- "*"
|
||||
|
||||
env:
|
||||
BUILD_DIR: build-conan
|
||||
BUILD_DIR: build-release
|
||||
BUILD_TYPE: Release
|
||||
RELEASE_TARBALL: Release.tar.gz
|
||||
RELEASE_ARTIFACT: C2LinuxImplant-Linux-Release
|
||||
@@ -19,8 +16,8 @@ permissions:
|
||||
contents: read
|
||||
|
||||
jobs:
|
||||
build-test:
|
||||
name: Build and test Linux deliverables
|
||||
build-package:
|
||||
name: Build Linux release
|
||||
runs-on: ubuntu-22.04
|
||||
|
||||
steps:
|
||||
@@ -53,20 +50,25 @@ jobs:
|
||||
restore-keys: |
|
||||
conan-${{ runner.os }}-
|
||||
|
||||
- name: Configure
|
||||
- name: Configure release
|
||||
run: |
|
||||
cmake \
|
||||
-S . \
|
||||
-B "$BUILD_DIR" \
|
||||
-DCMAKE_BUILD_TYPE="$BUILD_TYPE" \
|
||||
-DC2CORE_BUILD_TESTS=ON \
|
||||
-DC2CORE_BUILD_TESTS=OFF \
|
||||
-DC2CORE_BUILD_FUNCTIONAL_TESTS=OFF \
|
||||
-DCMAKE_PROJECT_TOP_LEVEL_INCLUDES="$GITHUB_WORKSPACE/conan_provider.cmake"
|
||||
|
||||
- name: Build
|
||||
run: cmake --build "$BUILD_DIR" --config "$BUILD_TYPE" --parallel "$(nproc)"
|
||||
|
||||
- name: Test
|
||||
run: ctest --test-dir "$BUILD_DIR" --output-on-failure --timeout 60
|
||||
- name: Validate release configuration
|
||||
run: |
|
||||
set -euo pipefail
|
||||
|
||||
grep -qx "C2CORE_BUILD_TESTS:BOOL=OFF" "$BUILD_DIR/CMakeCache.txt"
|
||||
grep -qx "C2CORE_BUILD_FUNCTIONAL_TESTS:BOOL=OFF" "$BUILD_DIR/CMakeCache.txt"
|
||||
|
||||
- name: Validate deliverables
|
||||
run: |
|
||||
@@ -164,7 +166,7 @@ jobs:
|
||||
release:
|
||||
name: Publish GitHub release
|
||||
runs-on: ubuntu-22.04
|
||||
needs: build-test
|
||||
needs: build-package
|
||||
if: startsWith(github.ref, 'refs/tags/')
|
||||
permissions:
|
||||
contents: write
|
||||
|
||||
+7
-2
@@ -9,11 +9,17 @@ set(CMAKE_POSITION_INDEPENDENT_CODE ON)
|
||||
|
||||
option(BUILD_TEAMSERVER "Build teamserver-side command parsing/help code" OFF)
|
||||
option(C2CORE_BUILD_TESTS "Enable C2Core tests from the parent project" OFF)
|
||||
option(C2CORE_BUILD_FUNCTIONAL_TESTS "Enable manual/env-driven C2Core functional tests" OFF)
|
||||
if(BUILD_TEAMSERVER)
|
||||
add_compile_definitions(BUILD_TEAMSERVER)
|
||||
endif()
|
||||
if(C2CORE_BUILD_TESTS)
|
||||
add_compile_definitions(C2CORE_BUILD_TESTS)
|
||||
endif()
|
||||
if(C2CORE_BUILD_FUNCTIONAL_TESTS)
|
||||
add_compile_definitions(C2CORE_BUILD_FUNCTIONAL_TESTS)
|
||||
endif()
|
||||
if(C2CORE_BUILD_TESTS OR C2CORE_BUILD_FUNCTIONAL_TESTS)
|
||||
enable_testing()
|
||||
endif()
|
||||
|
||||
@@ -82,7 +88,7 @@ IMPORTED_LOCATION "${DONUT_BUILD_DIR}/lib/libdonut.a"
|
||||
|
||||
add_subdirectory(core/modules)
|
||||
add_subdirectory(core/beacon)
|
||||
if(C2CORE_BUILD_TESTS)
|
||||
if(C2CORE_BUILD_TESTS OR C2CORE_BUILD_FUNCTIONAL_TESTS)
|
||||
add_subdirectory(core/beacon/tests)
|
||||
add_subdirectory(core/listener/tests)
|
||||
endif()
|
||||
@@ -92,4 +98,3 @@ include_directories(core/beacon)
|
||||
include_directories(core/modules/ModuleCmd)
|
||||
add_subdirectory(beacon/beacon)
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user