Skip to content

Commit 7fdaebd

Browse files
committed
ci: fix libclang setup in rust workflow
1 parent 5e41b23 commit 7fdaebd

1 file changed

Lines changed: 27 additions & 5 deletions

File tree

.github/workflows/rust.yml

Lines changed: 27 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -49,9 +49,16 @@ jobs:
4949
run: |
5050
choco install cmake llvm -y
5151
52+
- name: Configure LIBCLANG_PATH (Windows)
53+
if: matrix.os == 'windows-latest'
54+
shell: pwsh
55+
run: echo "LIBCLANG_PATH=C:\\Program Files\\LLVM\\bin" >> $env:GITHUB_ENV
56+
5257
- name: Install system dependencies (macOS)
5358
if: matrix.os == 'macos-latest'
54-
run: brew install cmake llvm
59+
run: |
60+
brew install cmake llvm
61+
echo "LIBCLANG_PATH=$(brew --prefix llvm)/lib" >> $GITHUB_ENV
5562
5663
- name: Install Rust toolchain
5764
uses: actions-rust-lang/setup-rust-toolchain@v1
@@ -94,14 +101,10 @@ jobs:
94101

95102
- name: Build Rust bindings
96103
working-directory: bindings/rust
97-
env:
98-
LIBCLANG_PATH: ${{ runner.os == 'Windows' && 'C:\\Program Files\\LLVM\\bin' || '' }}
99104
run: cargo build --verbose --features static-link
100105

101106
- name: Run tests
102107
working-directory: bindings/rust
103-
env:
104-
LIBCLANG_PATH: ${{ runner.os == 'Windows' && 'C:\\Program Files\\LLVM\\bin' || '' }}
105108
run: cargo test --verbose --features static-link
106109

107110
# Job 2: Source Build (Distribution Mode)
@@ -124,6 +127,25 @@ jobs:
124127
sudo apt-get update
125128
sudo apt-get install -y build-essential pkg-config
126129
130+
- name: Install system dependencies (macOS)
131+
if: matrix.os == 'macos-latest'
132+
run: brew install llvm
133+
134+
- name: Install system dependencies (Windows)
135+
if: matrix.os == 'windows-latest'
136+
run: |
137+
choco install llvm -y
138+
refreshenv
139+
140+
- name: Configure LIBCLANG_PATH (Windows)
141+
if: matrix.os == 'windows-latest'
142+
shell: pwsh
143+
run: echo "LIBCLANG_PATH=C:\\Program Files\\LLVM\\bin" >> $env:GITHUB_ENV
144+
145+
- name: Configure LIBCLANG_PATH (macOS)
146+
if: matrix.os == 'macos-latest'
147+
run: echo "LIBCLANG_PATH=$(brew --prefix llvm)/lib" >> $GITHUB_ENV
148+
127149
- name: Install Rust toolchain
128150
uses: actions-rust-lang/setup-rust-toolchain@v1
129151
with:

0 commit comments

Comments
 (0)