Skip to content

Commit

Permalink
ci: use official dependency releases
Browse files Browse the repository at this point in the history
  • Loading branch information
alandefreitas committed Mar 29, 2024
1 parent 0fa17a9 commit 0771bdc
Showing 1 changed file with 85 additions and 36 deletions.
121 changes: 85 additions & 36 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,23 +56,13 @@ jobs:
contents: write

steps:
- name: Install Essential Packages
if: ${{ matrix.container }}
env:
DEBIAN_FRONTEND: 'noninteractive'
TZ: 'Etc/UTC'
uses: alandefreitas/cpp-actions/[email protected]
with:
apt-get: git build-essential python3

- name: Clone MrDocs
uses: actions/checkout@v3

- name: Setup CMake
uses: alandefreitas/cpp-actions/[email protected]
id: setup-cmake
with:
# Clang requires clang-scan-deps to work on the latest CMake versions
version: ${{ matrix.compiler == 'clang' && '3.26' || '>=3.26' }}
check-latest: 'true'
update-environment: 'true'
Expand All @@ -81,6 +71,82 @@ jobs:
uses: seanmiddleditch/gha-setup-ninja@v4
if: ${{ runner.os == 'Windows' }}

- name: Setup C++
uses: alandefreitas/cpp-actions/[email protected]
id: setup-cpp
with:
compiler: ${{ matrix.compiler }}
version: ${{ matrix.version }}
check-latest: ${{ matrix.compiler == 'clang' }}

- name: Install System Packages
uses: alandefreitas/cpp-actions/[email protected]
id: package-install
env:
DEBIAN_FRONTEND: 'noninteractive'
TZ: 'Etc/UTC'
with:
apt-get: ${{ matrix.install }} git build-essential python3 curl openjdk-11-jdk ninja-build pkg-config libncurses-dev
vcpkg: libxml2[tools]
cc: ${{ steps.setup-cpp.outputs.cc || matrix.cc }}
ccflags: ${{ matrix.ccflags }}
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
run: |
set -x
cd ..
mkdir -p third-party
cd third-party
curl -LJO https://github.com/svaarala/duktape/releases/download/v2.7.0/duktape-2.7.0.tar.xz
tar -xf duktape-2.7.0.tar.xz
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 }}
N_CORES=$(nproc 2>/dev/null || echo 1)
cmake --build ./build --config ${{ matrix.build-type }} --parallel $N_CORES
cmake --install ./build --prefix ./install
duktape_root=$(pwd)/install
if [[ ${{ runner.os }} == 'Windows' ]]; then
duktape_root=$(echo "$duktape_root" | sed 's/\\/\//g')
duktape_root=$(echo $duktape_root | sed 's|^/d/|D:/|')
echo "$duktape_root"
fi
echo -E "duktape-root=$duktape_root" >> $GITHUB_OUTPUT
- name: LLVM Parameters
id: llvm-parameters
run: |
Expand All @@ -100,7 +166,7 @@ jobs:
uses: actions/cache@v4
with:
path: ${{ steps.llvm-parameters.outputs.llvm-root }}
key: llvm-${{ runner.os }}-${{ steps.llvm-parameters.outputs.llvm-build-preset }}-${{ steps.llvm-parameters.outputs.llvm-hash }}
key: llvm-${{ runner.os }}-${{ matrix.compiler }}-${{ matrix.version }}-${{ steps.llvm-parameters.outputs.llvm-build-preset }}-${{ steps.llvm-parameters.outputs.llvm-hash }}

- name: Install LLVM
id: llvm-install
Expand Down Expand Up @@ -130,34 +196,13 @@ jobs:
cd llvm
llvm_root=$(pwd)
cmake --version
cmake -S . -B ./build --preset=${{ steps.llvm-parameters.outputs.llvm-build-preset }}
cmake -S . -B ./build --preset=${{ steps.llvm-parameters.outputs.llvm-build-preset }} -DCMAKE_CXX_COMPILER=${{ steps.setup-cpp.outputs.cxx }} -DCMAKE_C_COMPILER=${{ steps.setup-cpp.outputs.cc }}
if [[ ${{ runner.os }} == 'Linux' ]]; then
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
# Setup C++ after installing LLVM to use the default compiler
# for LLVM and the specified compiler for MrDocs
- name: Setup C++
uses: alandefreitas/cpp-actions/[email protected]
id: setup-cpp
with:
compiler: ${{ matrix.compiler }}
version: ${{ matrix.version }}
check-latest: ${{ matrix.compiler == 'clang' }}

- name: Install packages
uses: alandefreitas/cpp-actions/[email protected]
id: package-install
with:
apt-get: ${{ matrix.install }} openjdk-11-jdk ninja-build pkg-config libncurses-dev
vcpkg: fmt duktape libxml2[tools]
cc: ${{ steps.setup-cpp.outputs.cc || matrix.cc }}
ccflags: ${{ matrix.ccflags }}
cxx: ${{ steps.setup-cpp.outputs.cxx || matrix.cxx }}
cxxflags: ${{ matrix.cxxflags }}
- name: Install Node.js
uses: actions/setup-node@v3
Expand All @@ -167,7 +212,7 @@ jobs:
- name: CMake Workflow
uses: alandefreitas/cpp-actions/[email protected]
with:
cmake-version: '>=3.20'
cmake-version: ${{ matrix.compiler == 'clang' && '3.26' || '>=3.26' }}
cxxstd: ${{ matrix.cxxstd }}
cc: ${{ steps.setup-cpp.outputs.cc || matrix.cc }}
ccflags: ${{ matrix.ccflags }}${{ ( matrix.compiler == 'gcc' && ' -static-libstdc++') || '' }}${{ ( matrix.asan && ' -static-libasan') || '' }}${{ ( matrix.tsan && ' -static-libtsan') || '' }}
Expand All @@ -178,8 +223,12 @@ jobs:
build-type: ${{ matrix.build-type }}
install-prefix: .local
extra-args: |
-D LLVM_ROOT="${{ steps.llvm-parameters.outputs.llvm-root || '../third-party/llvm-project/install' }}"
-D Clang_ROOT="${{ steps.llvm-parameters.outputs.llvm-root || '../third-party/llvm-project/install' }}"
-D MRDOCS_BUILD_DOCS=OFF
-D LLVM_ROOT=${{ steps.llvm-parameters.outputs.llvm-root }}
-D Clang_ROOT=${{ steps.llvm-parameters.outputs.llvm-root }}
-D duktape_ROOT=${{ steps.duktape-install.outputs.duktape-root }}
-D Duktape_ROOT=${{ steps.duktape-install.outputs.duktape-root }}
-D fmt_ROOT=${{ steps.fmt-install.outputs.fmt-root }}
export-compile-commands: true
run-tests: true
install: true
Expand Down

0 comments on commit 0771bdc

Please sign in to comment.