Skip to content

Commit

Permalink
Modify CI files to use the new build system.
Browse files Browse the repository at this point in the history
* Modify Alpine build to use new build system.
* Fix musl arch specialization.
* Set LIBDD_OUTPUT_FOLDER in alpine build image.
  • Loading branch information
hoolioh committed Aug 28, 2024
1 parent 49d0bfe commit 11a149d
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 20 deletions.
32 changes: 20 additions & 12 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,16 +48,16 @@ jobs:
- name: "Remove nextest CI report"
shell: bash
run: rm -rf target/nextest/ci/junit.xml
- name: "[${{ steps.rust-version.outputs.version}}] cargo build --workspace --verbose"
run: cargo build --workspace --verbose
- name: "[${{ steps.rust-version.outputs.version}}] cargo nextest run --workspace --profile ci --verbose -E '!test(tracing_integration_tests::)'"
- name: "[${{ steps.rust-version.outputs.version}}] cargo build --workspace --exclude builder --verbose"
run: cargo build --workspace --exclude builder --verbose
- name: "[${{ steps.rust-version.outputs.version}}] cargo nextest run --workspace --exclude builder --profile ci --verbose -E '!test(tracing_integration_tests::)'"
# Run doc tests with cargo test and run tests with nextest and generate junit.xml
run: cargo test --workspace --doc --verbose && cargo nextest run --workspace --profile ci --verbose -E '!test(tracing_integration_tests::)'
run: cargo test --workspace --exclude builder --doc --verbose && cargo nextest run --workspace --exclude builder --profile ci --verbose -E '!test(tracing_integration_tests::)'
env:
RUST_BACKTRACE: 1
- name: "[${{ steps.rust-version.outputs.version}}] Tracing integration tests: cargo nextest run --workspace --profile ci --verbose -E 'test(tracing_integration_tests::)'"
- name: "[${{ steps.rust-version.outputs.version}}] Tracing integration tests: cargo nextest run --workspace --exclude builder --profile ci --verbose -E 'test(tracing_integration_tests::)'"
if: runner.os == 'Linux'
run: cargo nextest run --workspace --profile ci --verbose -E 'test(tracing_integration_tests::)'
run: cargo nextest run --workspace --exclude builder --profile ci --verbose -E 'test(tracing_integration_tests::)'
env:
RUST_BACKTRACE: 1
- name: "[${{ steps.rust-version.outputs.version}}] RUSTFLAGS=\"-C prefer-dynamic\" cargo nextest run --package test_spawn_from_lib --features prefer-dynamic -E '!test(tracing_integration_tests::)'"
Expand All @@ -69,7 +69,7 @@ jobs:
if: success() || failure()
uses: mikepenz/action-junit-report@v4
with:
report_paths: "target/nextest/ci/junit.xml"
report_paths: "target/nextestgci/junit.xml"
check_name: "[${{ matrix.platform }}:${{ matrix.rust_version }}] test report"
include_passed: true

Expand All @@ -83,6 +83,12 @@ jobs:
include:
- platform: "ubuntu-latest"
rust_version: "${RUST_VERSION}"
- platform: "ubuntu-latest"
flags: "-C relocation-model=pic"
- platform: "macos-12"
flags: "-C relocation-model=pic"
- platform: "windows-latest"
flags: "-C target-feature=+crt-static"
steps:
- name: Checkout sources
uses: actions/checkout@v4
Expand All @@ -94,7 +100,7 @@ jobs:
if [[ "${{ matrix.platform }}" == "windows-latest" ]]; then
WORKSPACE_PATH=$(cygpath -ua '${{ github.workspace }}')
fi
echo "OUTPUT_FOLDER=$WORKSPACE_PATH/artifacts" >> $GITHUB_ENV
echo "LIBDD_OUTPUT_FOLDER=$WORKSPACE_PATH/artifacts" >> $GITHUB_ENV
- name: Free Disk Space (Ubuntu only)
if: runner.os == 'Linux' && matrix.platform == 'ubuntu-latest'
Expand Down Expand Up @@ -128,8 +134,10 @@ jobs:

- name: "Generate profiling FFI"
shell: bash
env:
RUSTFLAGS: "${{ matrix.flags }}"
run: |
cargo build -p builder --features profiling,telemetry,data-pipeline,symbolizer,crashtracker --release
cargo build -p builder --features profiling,telemetry,data-pipeline,symbolizer,crashtracker --release -vv
- name: 'Publish libdatadog'
uses: actions/upload-artifact@v4
Expand Down Expand Up @@ -202,9 +210,9 @@ jobs:
with:
rust_version: cross-centos7
- run: cargo install cross || true
- run: cross build --workspace --target x86_64-unknown-linux-gnu
- run: cross test --workspace --target x86_64-unknown-linux-gnu -- --skip "::single_threaded_tests::" --skip "tracing_integration_tests::"
- run: cross test --workspace --target x86_64-unknown-linux-gnu --exclude bin_tests -- --skip "::tests::" --skip "::api_tests::" --test-threads 1 --skip "tracing_integration_tests::"
- run: cross build --workspace --target x86_64-unknown-linux-gnu --exclude builder
- run: cross test --workspace --target x86_64-unknown-linux-gnu --exclude builder -- --skip "::single_threaded_tests::" --skip "tracing_integration_tests::"
- run: cross test --workspace --target x86_64-unknown-linux-gnu --exclude builder --exclude bin_tests -- --skip "::tests::" --skip "::api_tests::" --test-threads 1 --skip "tracing_integration_tests::"

ffi_bake:
strategy:
Expand Down
10 changes: 5 additions & 5 deletions builder/build/arch/musl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ pub const PROF_DYNAMIC_LIB: &str = "libdatadog_profiling.so";
pub const PROF_STATIC_LIB: &str = "libdatadog_profiling.a";
pub const PROF_DYNAMIC_LIB_FFI: &str = "libdatadog_profiling_ffi.so";
pub const PROF_STATIC_LIB_FFI: &str = "libdatadog_profiling_ffi.a";
pub const REMOVE_RPATH: bool = true;
pub const REMOVE_RPATH: bool = false;
pub const BUILD_CRASHTRACKER: bool = true;

pub fn fix_rpath(lib_path: &str) {
Expand All @@ -22,27 +22,27 @@ pub fn fix_rpath(lib_path: &str) {
}

pub fn strip_libraries(lib_path: &str) {
command::new("objcopy")
Command::new("objcopy")
.arg("--remove-section")
.arg(".llvmbc")
.arg(lib_path.to_owned() + "/libdatadog_profiling.a")
.spawn()
.expect("failed to remove llvm section");

command::new("objcopy")
Command::new("objcopy")
.arg("--only-keep-debug")
.arg(lib_path.to_owned() + "/libdatadog_profiling.so")
.arg(lib_path.to_owned() + "/libdatadog_profiling.debug")
.spawn()
.expect("failed to create debug file");

command::new("strip")
Command::new("strip")
.arg("-s")
.arg(lib_path.to_owned() + "/libdatadog_profiling.so")
.spawn()
.expect("failed to strip the library");

command::new("objcopy")
Command::new("objcopy")
.arg("--add-gnu-debuglink=".to_string() + lib_path + "/libdatadog_profiling.debug")
.arg(lib_path.to_owned() + "/libdatadog_profiling.so")
.spawn()
Expand Down
6 changes: 3 additions & 3 deletions tools/docker/Dockerfile.build
Original file line number Diff line number Diff line change
Expand Up @@ -156,12 +156,12 @@ COPY --from=ffi_build_platform_agnostic_cache /root/.cargo /root/.cargo/
COPY --from=ffi_build_platform_agnostic_cache /build /build
WORKDIR /build
# cache debug dependency build
RUN cargo build --lib --all
RUN cargo build --lib --workspace --exclude builder
# cache release dependency build
RUN cargo build --release --lib --all
RUN cargo build --release --lib --workspace --exclude builder