Skip to content

Commit

Permalink
build: speed up CI pipeline
Browse files Browse the repository at this point in the history
  • Loading branch information
mhx committed Aug 14, 2024
1 parent dda3b02 commit 7838b99
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 39 deletions.
45 changes: 21 additions & 24 deletions .docker/build-linux.sh
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,20 @@ if [[ "-$BUILD_TYPE-" == *-nostacktrace-* ]]; then
CMAKE_ARGS="${CMAKE_ARGS} -DENABLE_STACKTRACE=0"
fi

CMAKE_ARGS="${CMAKE_ARGS} -DWITH_TESTS=1 -DWITH_LEGACY_FUSE=1"
if [[ "-$BUILD_TYPE-" == *-source-* ]]; then
CMAKE_ARGS="${CMAKE_ARGS} -DDWARFS_OPTIMIZE=0"
else
CMAKE_ARGS="${CMAKE_ARGS} -DWITH_LEGACY_FUSE=1"
fi

if [[ "-$BUILD_TYPE-" == *-notest-* ]]; then
CMAKE_ARGS="${CMAKE_ARGS} -DWITH_TESTS=0"
RUN_TESTS="echo 'skipping tests'"
else
CMAKE_ARGS="${CMAKE_ARGS} -DWITH_TESTS=1"
RUN_TESTS="ctest --output-on-failure -j$(nproc)"
fi

CMAKE_ARGS="${CMAKE_ARGS} -DDWARFS_ARTIFACTS_DIR=/artifacts"

if [[ "-$BUILD_TYPE-" == *-shared-* ]]; then
Expand Down Expand Up @@ -188,7 +201,7 @@ if [[ "$BUILD_FROM_TARBALL" == "1" ]]; then
*-full-*)
cmake ../dwarfs/ $CMAKE_ARGS
time $BUILD_TOOL
ctest --output-on-failure -j$(nproc)
$RUN_TESTS
DESTDIR="$INSTALLDIR" $BUILD_TOOL install
$BUILD_TOOL distclean
;;
Expand All @@ -197,23 +210,23 @@ if [[ "$BUILD_FROM_TARBALL" == "1" ]]; then
# ==== libdwarfs ====
cmake ../dwarfs/ $CMAKE_ARGS -DWITH_LIBDWARFS=ON -DWITH_TOOLS=OFF -DWITH_FUSE_DRIVER=OFF
time $BUILD_TOOL
ctest --output-on-failure -j$(nproc)
$RUN_TESTS
DESTDIR="$INSTALLDIR" $BUILD_TOOL install
$BUILD_TOOL distclean
rm -rf *

# ==== dwarfs tools ====
cmake ../dwarfs/ $CMAKE_ARGS -DWITH_LIBDWARFS=OFF -DWITH_TOOLS=ON -DWITH_FUSE_DRIVER=OFF -DCMAKE_PREFIX_PATH="$PREFIXPATH"
time $BUILD_TOOL
ctest --output-on-failure -j$(nproc)
$RUN_TESTS
DESTDIR="$INSTALLDIR" $BUILD_TOOL install
$BUILD_TOOL distclean
rm -rf *

# ==== dwarfs fuse driver ====
cmake ../dwarfs/ $CMAKE_ARGS -DWITH_LIBDWARFS=OFF -DWITH_TOOLS=OFF -DWITH_FUSE_DRIVER=ON -DCMAKE_PREFIX_PATH="$PREFIXPATH"
time $BUILD_TOOL
ctest --output-on-failure -j$(nproc)
$RUN_TESTS
DESTDIR="$INSTALLDIR" $BUILD_TOOL install
$BUILD_TOOL distclean
;;
Expand All @@ -229,9 +242,7 @@ else

time $BUILD_TOOL

if [[ "-$BUILD_TYPE-" != *-source-* ]]; then
ctest --output-on-failure -j$(nproc)
fi
$RUN_TESTS

if [[ "-$BUILD_TYPE-" == *-coverage-* ]]; then
rm -f /tmp-runner/dwarfs-coverage.txt
Expand Down Expand Up @@ -271,7 +282,7 @@ else

time $BUILD_TOOL

ctest --output-on-failure -j$(nproc)
$RUN_TESTS
fi

$BUILD_TOOL strip
Expand All @@ -287,20 +298,6 @@ else
cp artifacts.env /tmp-runner
cp dwarfs-universal-* /tmp-runner/artifacts
cp dwarfs-*-Linux*.tar.zst /tmp-runner/artifacts

if [[ "$VERSION" != "" ]]; then
# also perform a non-static build based on the source tarball

$BUILD_TOOL distclean
unset LDFLAGS

# shellcheck disable=SC2086
cmake ../dwarfs/ $CMAKE_ARGS_NONSTATIC

time $BUILD_TOOL

ctest --output-on-failure -j$(nproc)
fi
elif [[ "-$BUILD_TYPE-" == *-source-* ]]; then
$BUILD_TOOL package_source
$BUILD_TOOL copy_source_artifacts
Expand All @@ -309,7 +306,7 @@ else
if [[ "-$BUILD_TYPE-" != *-[at]san-* ]] && \
[[ "-$BUILD_TYPE-" != *-ubsan-* ]] && \
[[ "-$BUILD_TYPE-" != *-source-* ]] && \
( [[ "-$BUILD_TYPE-" != *-static-* ]] || [[ "$VERSION" != "" ]] ); then
[[ "-$BUILD_TYPE-" != *-static-* ]]; then
INSTALLDIR="$HOME/install"
rm -rf "$INSTALLDIR"
DESTDIR="$INSTALLDIR" $BUILD_TOOL install
Expand Down
28 changes: 13 additions & 15 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ jobs:
shell: cmd
run: |
copy "C:\Program Files (x86)\WinFsp\bin\winfsp-x64.dll" ${{ runner.temp }}\build
ctest --test-dir ${{ runner.temp }}\build --output-on-failure -j8
ctest --test-dir ${{ runner.temp }}\build --output-on-failure -j
- name: Build Package
shell: cmd
Expand Down Expand Up @@ -131,7 +131,7 @@ jobs:
--mount type=bind,source=/home/mhx/github-ccache,target=/ccache \
--mount type=bind,source=/home/mhx/github-local,target=/local \
--mount type=bind,source=/mnt/opensource/artifacts/dwarfs,target=/artifacts \
--env BUILD_TYPE=clang-release-ninja-source \
--env BUILD_TYPE=clang-release-ninja-source-notest \
--env BUILD_ARCH=amd64 \
--env BUILD_DIST=arch \
--env GITHUB_REF_NAME \
Expand Down Expand Up @@ -249,23 +249,11 @@ jobs:
- fedora
- arch
build_type:
- gcc-debug-shared-ninja
- gcc-release-ninja
- gcc-release-shared-ninja
- clang-release-shared-ninja
exclude:
- arch: arm64v8
dist: arch
build_type: gcc-debug-shared-ninja
- arch: arm64v8
dist: arch
build_type: gcc-release-ninja
- arch: arm64v8
dist: arch
build_type: gcc-release-shared-ninja
- arch: arm64v8
dist: arch
build_type: clang-release-shared-ninja
include:
- arch: amd64
dist: ubuntu
Expand Down Expand Up @@ -420,7 +408,6 @@ jobs:
matrix:
arch:
- ARM64
- X64
build_mode:
- Release
- Debug
Expand All @@ -429,6 +416,17 @@ jobs:
cmake_args:
- name: Benchmark
cmake_args: -DWITH_BENCHMARKS=ON
include:
- arch: X64
build_mode: Release
config:
- name: Normal
cmake_args:
- arch: X64
build_mode: Debug
config:
- name: Benchmark
cmake_args: -DWITH_BENCHMARKS=ON

steps:
- name: Unpack Source Tarball
Expand Down

0 comments on commit 7838b99

Please sign in to comment.