Skip to content

Commit

Permalink
ci: optimized debug workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
alandefreitas committed Aug 29, 2024
1 parent 5dc3884 commit d917f65
Show file tree
Hide file tree
Showing 2 changed files with 147 additions and 57 deletions.
202 changes: 146 additions & 56 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,17 @@ jobs:
msvc 14.40
standards: '20'
latest-factors: ''
factors: ''
factors: |
msvc Optimized-Debug
build-types: |
gcc: Release
clang: Release
msvc: RelWithDebInfo
msvc Optimized-Debug: Debug
ccflags: |
msvc Optimized-Debug: /Ob1 /O2 /Zi
cxxflags: |
msvc Optimized-Debug: /Ob1 /O2 /Zi
build:
needs: cpp-matrix
Expand Down Expand Up @@ -92,29 +102,6 @@ jobs:
cxx: ${{ steps.setup-cpp.outputs.cxx || matrix.cxx }}
cxxflags: ${{ matrix.cxxflags }}

- name: Install Fmt
id: fmt-install
shell: bash
run: |
set -x
cd ..
mkdir -p third-party
cd third-party
git clone https://github.com/fmtlib/fmt --branch 10.2.1 --depth 1
cd fmt
cmake -S . -B ./build -D FMT_DOC=OFF -D FMT_TEST=OFF -DCMAKE_BUILD_TYPE=${{ matrix.build-type }} -DCMAKE_CXX_COMPILER=${{ steps.setup-cpp.outputs.cxx }} -DCMAKE_C_COMPILER=${{ steps.setup-cpp.outputs.cc }}
N_CORES=$(nproc 2>/dev/null || echo 1)
cmake --build ./build --config ${{ matrix.build-type }} --parallel $N_CORES
cmake --install ./build --prefix ./install
fmt_root=$(pwd)/install
if [[ ${{ runner.os }} == 'Windows' ]]; then
fmt_root=$(echo "$fmt_root" | sed 's/\\/\//g')
fmt_root=$(echo $fmt_root | sed 's|^/d/|D:/|')
echo "$fmt_root"
fi
echo -E "fmt-root=$fmt_root" >> $GITHUB_OUTPUT
- name: Install Duktape
id: duktape-install
shell: bash
Expand All @@ -128,15 +115,16 @@ jobs:
cp ../mrdocs/third-party/duktape/CMakeLists.txt ./duktape-2.7.0/CMakeLists.txt
cp ../mrdocs/third-party/duktape/duktapeConfig.cmake.in ./duktape-2.7.0/duktapeConfig.cmake.in
cd duktape-2.7.0
if [[ "${{ matrix.shared && 'true' || 'false' }}" == 'true' ]]; then
sed -i 's/#undef DUK_F_DLL_BUILD/#define DUK_F_DLL_BUILD/g' "src/duk_config.h"
else
sed -i 's/#define DUK_F_DLL_BUILD/#undef DUK_F_DLL_BUILD/g' "src/duk_config.h"
fi
cmake -S . -B ./build -DCMAKE_BUILD_TYPE=${{ matrix.build-type }} -DCMAKE_CXX_COMPILER=${{ steps.setup-cpp.outputs.cxx }} -DCMAKE_C_COMPILER=${{ steps.setup-cpp.outputs.cc }}
cmake -S . -B ./build \
-D FMT_DOC=OFF \
-D FMT_TEST=OFF \
-D CMAKE_BUILD_TYPE="${{ matrix.build-type }}" \
-D CMAKE_CONFIGURATION_TYPES="${{ matrix.build-type }}" \
-D CMAKE_CXX_COMPILER="${{ steps.setup-cpp.outputs.cxx }}" \
-D CMAKE_C_COMPILER="${{ steps.setup-cpp.outputs.cc }}"
N_CORES=$(nproc 2>/dev/null || echo 1)
cmake --build ./build --config ${{ matrix.build-type }} --parallel $N_CORES
cmake --install ./build --prefix ./install
cmake --install ./build --prefix ./install --config ${{ matrix.build-type }}
duktape_root=$(pwd)/install
if [[ ${{ runner.os }} == 'Windows' ]]; then
Expand All @@ -146,6 +134,35 @@ jobs:
fi
echo -E "duktape-root=$duktape_root" >> $GITHUB_OUTPUT
- name: Install Fmt
id: fmt-install
shell: bash
run: |
set -x
cd ..
mkdir -p third-party
cd third-party
git clone https://github.com/fmtlib/fmt --branch 10.2.1 --depth 1
cd fmt
cmake -S . -B ./build \
-D FMT_DOC=OFF \
-D FMT_TEST=OFF \
-D CMAKE_BUILD_TYPE="${{ matrix.build-type }}" \
-D CMAKE_CONFIGURATION_TYPES="${{ matrix.build-type }}" \
-D CMAKE_CXX_COMPILER="${{ steps.setup-cpp.outputs.cxx }}" \
-D CMAKE_C_COMPILER="${{ steps.setup-cpp.outputs.cc }}"
N_CORES=$(nproc 2>/dev/null || echo 1)
cmake --build ./build --config ${{ matrix.build-type }} --parallel $N_CORES
cmake --install ./build --prefix ./install --config ${{ matrix.build-type }}
fmt_root=$(pwd)/install
if [[ ${{ runner.os }} == 'Windows' ]]; then
fmt_root=$(echo "$fmt_root" | sed 's/\\/\//g')
fmt_root=$(echo $fmt_root | sed 's|^/d/|D:/|')
echo "$fmt_root"
fi
echo -E "fmt-root=$fmt_root" >> $GITHUB_OUTPUT
- name: Install Libxml2
id: libxml2-install
if: matrix.compiler == 'msvc'
Expand All @@ -159,11 +176,46 @@ jobs:
git config --global advice.detachedHead false
git clone https://github.com/GNOME/libxml2 --branch v2.12.6 --depth 1
cd libxml2
cmake -S . -B ./build -DCMAKE_BUILD_TYPE=Release -DLIBXML2_WITH_PROGRAMS=ON -DLIBXML2_WITH_FTP=OFF -DLIBXML2_WITH_HTTP=OFF -DLIBXML2_WITH_ICONV=OFF -DLIBXML2_WITH_LEGACY=OFF -DLIBXML2_WITH_LZMA=OFF -DLIBXML2_WITH_ZLIB=OFF -DLIBXML2_WITH_ICU=OFF -DLIBXML2_WITH_TESTS=OFF -DLIBXML2_WITH_HTML=ON -DLIBXML2_WITH_C14N=ON -DLIBXML2_WITH_CATALOG=ON -DLIBXML2_WITH_DEBUG=ON -DLIBXML2_WITH_ISO8859X=ON -DLIBXML2_WITH_MEM_DEBUG=OFF -DLIBXML2_WITH_MODULES=ON -DLIBXML2_WITH_OUTPUT=ON -DLIBXML2_WITH_PATTERN=ON -DLIBXML2_WITH_PUSH=ON -DLIBXML2_WITH_PYTHON=OFF -DLIBXML2_WITH_READER=ON -DLIBXML2_WITH_REGEXPS=ON -DLIBXML2_WITH_SAX1=ON -DLIBXML2_WITH_SCHEMAS=ON -DLIBXML2_WITH_SCHEMATRON=ON -DLIBXML2_WITH_THREADS=ON -DLIBXML2_WITH_THREAD_ALLOC=OFF -DLIBXML2_WITH_TREE=ON -DLIBXML2_WITH_VALID=ON -DLIBXML2_WITH_WRITER=ON -DLIBXML2_WITH_XINCLUDE=ON -DLIBXML2_WITH_XPATH=ON -DLIBXML2_WITH_XPTR=ON -DCMAKE_CXX_COMPILER=${{ steps.setup-cpp.outputs.cxx || steps.parameters.outputs.clang-bin }} -DCMAKE_C_COMPILER=${{ steps.setup-cpp.outputs.cc || steps.parameters.outputs.clang-bin }}
cmake -S . -B ./build \
-D CMAKE_BUILD_TYPE=Release \
-D LIBXML2_WITH_PROGRAMS=ON \
-D LIBXML2_WITH_FTP=OFF \
-D LIBXML2_WITH_HTTP=OFF \
-D LIBXML2_WITH_ICONV=OFF \
-D LIBXML2_WITH_LEGACY=OFF \
-D LIBXML2_WITH_LZMA=OFF \
-D LIBXML2_WITH_ZLIB=OFF \
-D LIBXML2_WITH_ICU=OFF \
-D LIBXML2_WITH_TESTS=OFF \
-D LIBXML2_WITH_HTML=ON \
-D LIBXML2_WITH_C14N=ON \
-D LIBXML2_WITH_CATALOG=ON \
-D LIBXML2_WITH_DEBUG=ON \
-D LIBXML2_WITH_ISO8859X=ON \
-D LIBXML2_WITH_MEM_DEBUG=OFF \
-D LIBXML2_WITH_MODULES=ON \
-D LIBXML2_WITH_OUTPUT=ON \
-D LIBXML2_WITH_PATTERN=ON \
-D LIBXML2_WITH_PUSH=ON \
-D LIBXML2_WITH_PYTHON=OFF \
-D LIBXML2_WITH_READER=ON \
-D LIBXML2_WITH_REGEXPS=ON \
-D LIBXML2_WITH_SAX1=ON \
-D LIBXML2_WITH_SCHEMAS=ON \
-D LIBXML2_WITH_SCHEMATRON=ON \
-D LIBXML2_WITH_THREADS=ON \
-D LIBXML2_WITH_THREAD_ALLOC=OFF \
-D LIBXML2_WITH_TREE=ON \
-D LIBXML2_WITH_VALID=ON \
-D LIBXML2_WITH_WRITER=ON \
-D LIBXML2_WITH_XINCLUDE=ON \
-D LIBXML2_WITH_XPATH=ON \
-D LIBXML2_WITH_XPTR=ON \
-D CMAKE_CXX_COMPILER="${{ steps.setup-cpp.outputs.cxx || steps.parameters.outputs.clang-bin }}" \
-D CMAKE_C_COMPILER="${{ steps.setup-cpp.outputs.cc || steps.parameters.outputs.clang-bin }}"
N_CORES=$(nproc 2>/dev/null || echo 1)
cmake --build ./build --config ${{ matrix.build-type }} --parallel $N_CORES
cmake --install ./build --prefix ./install
cmake --build ./build --config Release --parallel $N_CORES
cmake --install ./build --prefix ./install --config Release
libxml2_root=$(pwd)/install
if [[ ${{ runner.os }} == 'Windows' ]]; then
Expand All @@ -180,9 +232,28 @@ jobs:
echo -E "llvm-hash=$llvm_hash" >> $GITHUB_OUTPUT
llvm_id=$(echo $llvm_hash | cut -c1-7)
echo -E "llvm-id=$llvm_id" >> $GITHUB_OUTPUT
llvm_build_preset=${{ runner.os == 'Windows' && 'release-win' || 'release-unix' }}
llvm_build_preset=${{ runner.os == 'Windows' && 'relwithdebinfo-win' || 'release-unix' }}
if [[ ${{ matrix.optimized-debug }} == 'true' ]]; then
llvm_build_preset=debwithopt-
else
if [[ ${{ runner.os }} == 'Windows' ]]; then
llvm_build_preset=relwithdebinfo-
else
llvm_build_preset=release-
fi
fi
if [[ ${{ runner.os }} == 'Windows' ]]; then
llvm_build_preset+=win
else
llvm_build_preset+=unix
fi
echo -E "llvm-build-preset=$llvm_build_preset" >> $GITHUB_OUTPUT
echo -E "llvm-cache-key=llvm-libcxx-${{ runner.os }}-${{ matrix.compiler }}-${{ matrix.version }}-$llvm_build_preset-$llvm_hash" >> $GITHUB_OUTPUT
compiler_and_version=${{ matrix.compiler }}-${{ matrix.version }}
workflow_factor=
if [[ ${{ matrix.build-type }} == 'Debug' ]]; then
workflow_factor=-debug
fi
echo -E "llvm-cache-key=llvm-libcxx-${{ runner.os }}-$compiler_and_version$workflow_factor-$llvm_build_preset-$llvm_hash" >> $GITHUB_OUTPUT
cd ..
llvm_root=$(pwd)/third-party/llvm-project/install
if [[ ${{ runner.os }} == 'Windows' ]]; then
Expand Down Expand Up @@ -232,8 +303,8 @@ jobs:
cmake --build ./build --target help
fi
N_CORES=$(nproc 2>/dev/null || echo 1)
cmake --build ./build --config Release --parallel $N_CORES
cmake --install ./build --prefix "$llvm_project_root"/install
cmake --build ./build --config ${{ matrix.build-type }} --parallel $N_CORES
cmake --install ./build --prefix "$llvm_project_root"/install --config ${{ matrix.build-type }}
- name: Install LibC++
id: libcxx-install
Expand All @@ -251,23 +322,23 @@ jobs:
cmake -G Ninja \
-S runtimes \
-B build-libcxx \
-DLLVM_ENABLE_RUNTIMES="libcxx;libcxxabi;libunwind" \
-DCMAKE_INSTALL_PREFIX="$llvm_project_root/install"
-D LLVM_ENABLE_RUNTIMES="libcxx;libcxxabi;libunwind" \
-D CMAKE_INSTALL_PREFIX="$llvm_project_root/install"
ninja -C build-libcxx cxx cxxabi unwind
ninja -C build-libcxx install-cxx install-cxxabi install-unwind
else
cmake -G Ninja \
-S runtimes \
-B build-libcxx \
-DLLVM_ENABLE_RUNTIMES="libcxx;libcxxabi" \
-DCMAKE_INSTALL_PREFIX="$llvm_project_root/install" \
-DLIBCXXABI_USE_LLVM_UNWINDER=OFF \
-DLIBCXXABI_ENABLE_SHARED=OFF \
-DLIBCXXABI_ENABLE_STATIC=ON \
-DLIBCXX_ENABLE_SHARED=OFF \
-DLIBCXX_NO_VCRUNTIME=ON \
-DCMAKE_CXX_FLAGS="-D__ORDER_LITTLE_ENDIAN__=1234 -D__ORDER_BIG_ENDIAN__=4321 -D__BYTE_ORDER__=__ORDER_LITTLE_ENDIAN__"
-D LLVM_ENABLE_RUNTIMES="libcxx;libcxxabi" \
-D CMAKE_INSTALL_PREFIX="$llvm_project_root/install" \
-D LIBCXXABI_USE_LLVM_UNWINDER=OFF \
-D LIBCXXABI_ENABLE_SHARED=OFF \
-D LIBCXXABI_ENABLE_STATIC=ON \
-D LIBCXX_ENABLE_SHARED=OFF \
-D LIBCXX_NO_VCRUNTIME=ON \
-D CMAKE_CXX_FLAGS="-D__ORDER_LITTLE_ENDIAN__=1234 -D__ORDER_BIG_ENDIAN__=4321 -D__BYTE_ORDER__=__ORDER_LITTLE_ENDIAN__"
ninja -C build-libcxx cxx
ninja -C build-libcxx install-cxx
fi
Expand All @@ -288,7 +359,7 @@ jobs:
cxxflags: ${{ matrix.cxxflags }}${{ ( matrix.compiler == 'gcc' && ' -static') || '' }}${{ ( matrix.asan && ' -static-libasan') || '' }}${{ ( matrix.tsan && ' -static-libtsan') || '' }}
generator: Ninja
toolchain: ${{ steps.package-install.outputs.vcpkg_toolchain || steps.package-install.outputs.vcpkg-toolchain }}
build-type: RelWithDebInfo
build-type: ${{ matrix.build-type }}
install-prefix: .local
extra-args: |
-D MRDOCS_BUILD_DOCS=OFF
Expand Down Expand Up @@ -336,7 +407,7 @@ jobs:
defaults:
run:
shell: bash
name: Releases
name: MrDocs Releases
timeout-minutes: 30
runs-on: ubuntu-latest
container: ubuntu:20.04
Expand Down Expand Up @@ -602,7 +673,7 @@ jobs:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

llvm-releases:
needs: [build, cpp-matrix]
needs: [ build, cpp-matrix ]

strategy:
fail-fast: false
Expand All @@ -613,7 +684,7 @@ jobs:
run:
shell: bash

name: ${{ matrix.name }}-LLVM-Release
name: ${{ matrix.name }} LLVM Release
runs-on: ${{ matrix.runs-on }}
container: ${{ matrix.container }}
env: ${{ matrix.env }}
Expand All @@ -634,9 +705,28 @@ jobs:
echo -E "llvm-hash=$llvm_hash" >> $GITHUB_OUTPUT
llvm_id=$(echo $llvm_hash | cut -c1-7)
echo -E "llvm-id=$llvm_id" >> $GITHUB_OUTPUT
llvm_build_preset=${{ runner.os == 'Windows' && 'release-win' || 'release-unix' }}
llvm_build_preset=${{ runner.os == 'Windows' && 'relwithdebinfo-win' || 'release-unix' }}
if [[ ${{ matrix.optimized-debug }} == 'true' ]]; then
llvm_build_preset=debwithopt-
else
if [[ ${{ runner.os }} == 'Windows' ]]; then
llvm_build_preset=relwithdebinfo-
else
llvm_build_preset=release-
fi
fi
if [[ ${{ runner.os }} == 'Windows' ]]; then
llvm_build_preset+=win
else
llvm_build_preset+=unix
fi
echo -E "llvm-build-preset=$llvm_build_preset" >> $GITHUB_OUTPUT
echo -E "llvm-cache-key=llvm-libcxx-${{ runner.os }}-${{ matrix.compiler }}-${{ matrix.version }}-$llvm_build_preset-$llvm_hash" >> $GITHUB_OUTPUT
compiler_and_version=${{ matrix.compiler }}-${{ matrix.version }}
workflow_factor=
if [[ ${{ matrix.build-type }} == 'Debug' ]]; then
workflow_factor=-debug
fi
echo -E "llvm-cache-key=llvm-libcxx-${{ runner.os }}-$compiler_and_version$workflow_factor-$llvm_build_preset-$llvm_hash" >> $GITHUB_OUTPUT
llvm_archive_basename=llvm-${{ runner.os }}-$llvm_id
echo -E "llvm-archive-basename=$llvm_archive_basename" >> $GITHUB_OUTPUT
if [[ ${{ runner.os }} == 'Windows' ]]; then
Expand Down Expand Up @@ -696,7 +786,7 @@ jobs:
tar -cjf ${{ steps.llvm-parameters.outputs.llvm-archive-filename }} -C install .
fi
- name: Publish website
- name: Publish LLVM on website
if: steps.llvm-cache.outputs.cache-hit == 'true' && github.event_name == 'push' && (contains(fromJSON('["master", "develop"]'), github.ref_name) || startsWith(github.ref, 'refs/tags/'))
working-directory: ../third-party/llvm-project
env:
Expand Down
2 changes: 1 addition & 1 deletion third-party/duktape/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ set_target_properties(duktape PROPERTIES VERSION ${duktape_VERSION})
set_target_properties(duktape PROPERTIES SOVERSION ${duktape_MAJOR_VERSION})

if (BUILD_SHARED_LIBS)
target_compile_definitions(duktape PRIVATE -DDUK_F_DLL_BUILD)
target_compile_definitions(duktape PRIVATE DUK_F_DLL_BUILD)
endif ()

install(TARGETS duktape
Expand Down

0 comments on commit d917f65

Please sign in to comment.