Skip to content

Commit b8230d4

Browse files
authored
fix(ci): Install libclang via apt from LLVM repos (#5105)
1 parent dd51d73 commit b8230d4

File tree

8 files changed

+36
-27
lines changed

8 files changed

+36
-27
lines changed

.github/actions/install-cargo-xwin/action.yml

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,5 @@
11
name: install-cargo-xwin
22

3-
inputs:
4-
token:
5-
description: 'GitHub token'
6-
required: true
7-
83
runs:
94
using: composite
105
steps:

.github/actions/setup-compilation-env/action.yml

Lines changed: 20 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,18 +4,13 @@ inputs:
44
target:
55
description: "Rust build target"
66
required: true
7-
token:
8-
description: "GitHub token"
9-
required: true
107

118
runs:
129
using: composite
1310
steps:
1411
- name: "Install: cargo-xwin"
1512
if: inputs.target == 'x86_64-pc-windows-msvc'
1613
uses: ./.github/actions/install-cargo-xwin
17-
with:
18-
token: ${{ inputs.token }}
1914

2015
- name: "Install: Rust target"
2116
run: |
@@ -44,11 +39,26 @@ runs:
4439
shell: bash
4540

4641
- name: "Install: LLVM on Linux"
47-
if: runner.os == 'Linux'
48-
uses: KyleMayes/install-llvm-action@v2.0.8
49-
with:
50-
version: "20.1.8"
51-
env: true
42+
if: ${{ runner.os == 'Linux' }}
43+
run: |
44+
wget https://apt.llvm.org/llvm.sh
45+
chmod +x llvm.sh
46+
sudo ./llvm.sh 20
47+
48+
sudo apt-fast update
49+
sudo apt-fast install -y libclang-20-dev clang-tools-20
50+
51+
sudo update-alternatives --install /usr/bin/clang-cl clang-cl /usr/bin/clang-cl-20 100
52+
sudo update-alternatives --install /usr/bin/clang clang /usr/bin/clang-20 100
53+
sudo update-alternatives --install /usr/bin/clang++ clang++ /usr/bin/clang++-20 100
54+
shell: bash
55+
56+
- name: "Install: Linux compilers"
57+
if: runner.arch == 'X64' && runner.os == 'Linux'
58+
run: |
59+
echo "CC_x86_64_unknown_linux_gnu=clang" >> $GITHUB_ENV
60+
echo "CXX_x86_64_unknown_linux_gnu=clang++" >> $GITHUB_ENV
61+
shell: bash
5262

5363
- name: "Install: Linux cross compilers and packages"
5464
if: runner.arch == 'ARM64' && runner.os == 'Linux' && inputs.target == 'x86_64-unknown-linux-gnu'

.github/workflows/build-unix.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,6 @@ jobs:
5252
uses: ./.github/actions/setup-compilation-env
5353
with:
5454
target: "${{ matrix.targets.target }}"
55-
token: ${{ secrets.GITHUB_TOKEN }}
5655

5756
- name: "ACTIONS: Setup caching"
5857
uses: ./.github/actions/rust-cache

.github/workflows/build-windows.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,6 @@ jobs:
4343
uses: ./.github/actions/setup-compilation-env
4444
with:
4545
target: x86_64-pc-windows-msvc
46-
token: ${{ secrets.GITHUB_TOKEN }}
4746

4847
- name: "ACTIONS: Setup caching"
4948
uses: ./.github/actions/rust-cache

.github/workflows/build.yml

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,6 @@ jobs:
145145
uses: ./.github/actions/setup-compilation-env
146146
with:
147147
target: ${{ matrix.targets.target }}
148-
token: ${{ secrets.GITHUB_TOKEN }}
149148

150149
- name: "ACTIONS: Setup caching"
151150
uses: ./.github/actions/rust-cache
@@ -192,7 +191,6 @@ jobs:
192191
uses: ./.github/actions/setup-compilation-env
193192
with:
194193
target: ${{ matrix.targets.target }}
195-
token: ${{ secrets.GITHUB_TOKEN }}
196194

197195
- name: "ACTIONS: Setup caching"
198196
uses: ./.github/actions/rust-cache
@@ -230,7 +228,6 @@ jobs:
230228
uses: ./.github/actions/setup-compilation-env
231229
with:
232230
target: x86_64-unknown-linux-gnu
233-
token: ${{ secrets.GITHUB_TOKEN }}
234231

235232
- name: Setup caching
236233
uses: ./.github/actions/rust-cache
@@ -271,6 +268,11 @@ jobs:
271268
- name: "Install: Rust toolchain"
272269
uses: ./.github/actions/install-rust
273270

271+
- name: "Install: Compilation environment"
272+
uses: ./.github/actions/setup-compilation-env
273+
with:
274+
target: x86_64-unknown-linux-gnu
275+
274276
- name: "ACTIONS: Setup caching"
275277
uses: ./.github/actions/rust-cache
276278
with:
@@ -424,7 +426,6 @@ jobs:
424426
uses: ./.github/actions/setup-compilation-env
425427
with:
426428
target: x86_64-unknown-linux-gnu
427-
token: ${{ secrets.GITHUB_TOKEN }}
428429

429430
- name: "ACTIONS: Setup caching"
430431
uses: ./.github/actions/rust-cache

.github/workflows/check.yml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,6 @@ jobs:
144144
uses: ./.github/actions/setup-compilation-env
145145
with:
146146
target: "${{ matrix.target }}"
147-
token: ${{ secrets.GITHUB_TOKEN }}
148147

149148
- name: "ACTIONS: Setup caching"
150149
uses: ./.github/actions/rust-cache
@@ -179,7 +178,6 @@ jobs:
179178
uses: ./.github/actions/setup-compilation-env
180179
with:
181180
target: x86_64-unknown-linux-gnu
182-
token: ${{ secrets.GITHUB_TOKEN }}
183181

184182
- name: "Check if workspace hack Cargo.toml is up-to-date"
185183
uses: ./.github/actions/cargo-hakari
@@ -264,7 +262,6 @@ jobs:
264262
uses: ./.github/actions/setup-compilation-env
265263
with:
266264
target: x86_64-unknown-linux-gnu
267-
token: ${{ secrets.GITHUB_TOKEN }}
268265

269266
- name: "ACTIONS: Setup caching"
270267
uses: ./.github/actions/rust-cache
@@ -346,7 +343,6 @@ jobs:
346343
uses: ./.github/actions/setup-compilation-env
347344
with:
348345
target: x86_64-unknown-linux-gnu
349-
token: ${{ secrets.GITHUB_TOKEN }}
350346

351347
- name: "ACTIONS: Setup caching"
352348
uses: ./.github/actions/rust-cache

lazy-pages/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ libc.workspace = true
3333
errno.workspace = true
3434

3535
[target.'cfg(windows)'.dependencies]
36-
winapi = { workspace = true, features = ["excpt", "memoryapi"] }
36+
winapi = { workspace = true, features = ["excpt", "memoryapi", "errhandlingapi"] }
3737

3838
[dev-dependencies]
3939
tracing-subscriber.workspace = true

utils/wasm-builder/src/wasm_project.rs

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,9 @@ use anyhow::{Context, Result, anyhow};
2121
use chrono::offset::Local as ChronoLocal;
2222
use gear_wasm_optimizer::{self as optimize, Optimizer};
2323
use std::{
24-
env, fs,
24+
env,
25+
ffi::OsString,
26+
fs,
2527
path::{Path, PathBuf},
2628
};
2729
use toml::value::Table;
@@ -83,6 +85,9 @@ impl WasmProject {
8385
.expect("`OUT_DIR` is always set in build scripts")
8486
.into();
8587

88+
let target: OsString =
89+
env::var_os("TARGET").expect("`TARGET` is always set in build scripts");
90+
8691
let profile = out_dir
8792
.components()
8893
.rev()
@@ -104,6 +109,10 @@ impl WasmProject {
104109
.map(|p| p.to_owned())
105110
.expect("Could not find target directory");
106111

112+
if target_dir.ends_with(target) {
113+
target_dir.pop();
114+
}
115+
107116
let mut wasm_target_dir = target_dir.clone();
108117
wasm_target_dir.push("wasm32-gear");
109118
wasm_target_dir.push(&profile);

0 commit comments

Comments
 (0)