Skip to content

Commit 0771bdc

Browse files
committed
ci: use official dependency releases
1 parent 0fa17a9 commit 0771bdc

File tree

1 file changed

+85
-36
lines changed

1 file changed

+85
-36
lines changed

.github/workflows/ci.yml

Lines changed: 85 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -56,23 +56,13 @@ jobs:
5656
contents: write
5757

5858
steps:
59-
- name: Install Essential Packages
60-
if: ${{ matrix.container }}
61-
env:
62-
DEBIAN_FRONTEND: 'noninteractive'
63-
TZ: 'Etc/UTC'
64-
uses: alandefreitas/cpp-actions/[email protected]
65-
with:
66-
apt-get: git build-essential python3
67-
6859
- name: Clone MrDocs
6960
uses: actions/checkout@v3
7061

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

74+
- name: Setup C++
75+
uses: alandefreitas/cpp-actions/[email protected]
76+
id: setup-cpp
77+
with:
78+
compiler: ${{ matrix.compiler }}
79+
version: ${{ matrix.version }}
80+
check-latest: ${{ matrix.compiler == 'clang' }}
81+
82+
- name: Install System Packages
83+
uses: alandefreitas/cpp-actions/[email protected]
84+
id: package-install
85+
env:
86+
DEBIAN_FRONTEND: 'noninteractive'
87+
TZ: 'Etc/UTC'
88+
with:
89+
apt-get: ${{ matrix.install }} git build-essential python3 curl openjdk-11-jdk ninja-build pkg-config libncurses-dev
90+
vcpkg: libxml2[tools]
91+
cc: ${{ steps.setup-cpp.outputs.cc || matrix.cc }}
92+
ccflags: ${{ matrix.ccflags }}
93+
cxx: ${{ steps.setup-cpp.outputs.cxx || matrix.cxx }}
94+
cxxflags: ${{ matrix.cxxflags }}
95+
96+
- name: Install Fmt
97+
id: fmt-install
98+
shell: bash
99+
run: |
100+
set -x
101+
cd ..
102+
mkdir -p third-party
103+
cd third-party
104+
git clone https://github.com/fmtlib/fmt --branch 10.2.1 --depth 1
105+
cd fmt
106+
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 }}
107+
N_CORES=$(nproc 2>/dev/null || echo 1)
108+
cmake --build ./build --config ${{ matrix.build-type }} --parallel $N_CORES
109+
cmake --install ./build --prefix ./install
110+
111+
fmt_root=$(pwd)/install
112+
if [[ ${{ runner.os }} == 'Windows' ]]; then
113+
fmt_root=$(echo "$fmt_root" | sed 's/\\/\//g')
114+
fmt_root=$(echo $fmt_root | sed 's|^/d/|D:/|')
115+
echo "$fmt_root"
116+
fi
117+
echo -E "fmt-root=$fmt_root" >> $GITHUB_OUTPUT
118+
119+
- name: Install Duktape
120+
id: duktape-install
121+
shell: bash
122+
run: |
123+
set -x
124+
cd ..
125+
mkdir -p third-party
126+
cd third-party
127+
curl -LJO https://github.com/svaarala/duktape/releases/download/v2.7.0/duktape-2.7.0.tar.xz
128+
tar -xf duktape-2.7.0.tar.xz
129+
cp ../mrdocs/third-party/duktape/CMakeLists.txt ./duktape-2.7.0/CMakeLists.txt
130+
cp ../mrdocs/third-party/duktape/duktapeConfig.cmake.in ./duktape-2.7.0/duktapeConfig.cmake.in
131+
cd duktape-2.7.0
132+
if [[ "${{ matrix.shared && 'true' || 'false' }}" == 'true' ]]; then
133+
sed -i 's/#undef DUK_F_DLL_BUILD/#define DUK_F_DLL_BUILD/g' "src/duk_config.h"
134+
else
135+
sed -i 's/#define DUK_F_DLL_BUILD/#undef DUK_F_DLL_BUILD/g' "src/duk_config.h"
136+
fi
137+
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 }}
138+
N_CORES=$(nproc 2>/dev/null || echo 1)
139+
cmake --build ./build --config ${{ matrix.build-type }} --parallel $N_CORES
140+
cmake --install ./build --prefix ./install
141+
142+
duktape_root=$(pwd)/install
143+
if [[ ${{ runner.os }} == 'Windows' ]]; then
144+
duktape_root=$(echo "$duktape_root" | sed 's/\\/\//g')
145+
duktape_root=$(echo $duktape_root | sed 's|^/d/|D:/|')
146+
echo "$duktape_root"
147+
fi
148+
echo -E "duktape-root=$duktape_root" >> $GITHUB_OUTPUT
149+
84150
- name: LLVM Parameters
85151
id: llvm-parameters
86152
run: |
@@ -100,7 +166,7 @@ jobs:
100166
uses: actions/cache@v4
101167
with:
102168
path: ${{ steps.llvm-parameters.outputs.llvm-root }}
103-
key: llvm-${{ runner.os }}-${{ steps.llvm-parameters.outputs.llvm-build-preset }}-${{ steps.llvm-parameters.outputs.llvm-hash }}
169+
key: llvm-${{ runner.os }}-${{ matrix.compiler }}-${{ matrix.version }}-${{ steps.llvm-parameters.outputs.llvm-build-preset }}-${{ steps.llvm-parameters.outputs.llvm-hash }}
104170

105171
- name: Install LLVM
106172
id: llvm-install
@@ -130,34 +196,13 @@ jobs:
130196
cd llvm
131197
llvm_root=$(pwd)
132198
cmake --version
133-
cmake -S . -B ./build --preset=${{ steps.llvm-parameters.outputs.llvm-build-preset }}
199+
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 }}
134200
if [[ ${{ runner.os }} == 'Linux' ]]; then
135201
cmake --build ./build --target help
136202
fi
137203
N_CORES=$(nproc 2>/dev/null || echo 1)
138204
cmake --build ./build --config Release --parallel $N_CORES
139205
cmake --install ./build --prefix "$llvm_project_root"/install
140-
141-
# Setup C++ after installing LLVM to use the default compiler
142-
# for LLVM and the specified compiler for MrDocs
143-
- name: Setup C++
144-
uses: alandefreitas/cpp-actions/[email protected]
145-
id: setup-cpp
146-
with:
147-
compiler: ${{ matrix.compiler }}
148-
version: ${{ matrix.version }}
149-
check-latest: ${{ matrix.compiler == 'clang' }}
150-
151-
- name: Install packages
152-
uses: alandefreitas/cpp-actions/[email protected]
153-
id: package-install
154-
with:
155-
apt-get: ${{ matrix.install }} openjdk-11-jdk ninja-build pkg-config libncurses-dev
156-
vcpkg: fmt duktape libxml2[tools]
157-
cc: ${{ steps.setup-cpp.outputs.cc || matrix.cc }}
158-
ccflags: ${{ matrix.ccflags }}
159-
cxx: ${{ steps.setup-cpp.outputs.cxx || matrix.cxx }}
160-
cxxflags: ${{ matrix.cxxflags }}
161206
162207
- name: Install Node.js
163208
uses: actions/setup-node@v3
@@ -167,7 +212,7 @@ jobs:
167212
- name: CMake Workflow
168213
uses: alandefreitas/cpp-actions/[email protected]
169214
with:
170-
cmake-version: '>=3.20'
215+
cmake-version: ${{ matrix.compiler == 'clang' && '3.26' || '>=3.26' }}
171216
cxxstd: ${{ matrix.cxxstd }}
172217
cc: ${{ steps.setup-cpp.outputs.cc || matrix.cc }}
173218
ccflags: ${{ matrix.ccflags }}${{ ( matrix.compiler == 'gcc' && ' -static-libstdc++') || '' }}${{ ( matrix.asan && ' -static-libasan') || '' }}${{ ( matrix.tsan && ' -static-libtsan') || '' }}
@@ -178,8 +223,12 @@ jobs:
178223
build-type: ${{ matrix.build-type }}
179224
install-prefix: .local
180225
extra-args: |
181-
-D LLVM_ROOT="${{ steps.llvm-parameters.outputs.llvm-root || '../third-party/llvm-project/install' }}"
182-
-D Clang_ROOT="${{ steps.llvm-parameters.outputs.llvm-root || '../third-party/llvm-project/install' }}"
226+
-D MRDOCS_BUILD_DOCS=OFF
227+
-D LLVM_ROOT=${{ steps.llvm-parameters.outputs.llvm-root }}
228+
-D Clang_ROOT=${{ steps.llvm-parameters.outputs.llvm-root }}
229+
-D duktape_ROOT=${{ steps.duktape-install.outputs.duktape-root }}
230+
-D Duktape_ROOT=${{ steps.duktape-install.outputs.duktape-root }}
231+
-D fmt_ROOT=${{ steps.fmt-install.outputs.fmt-root }}
183232
export-compile-commands: true
184233
run-tests: true
185234
install: true

0 commit comments

Comments
 (0)