Skip to content

Commit

Permalink
ci: install llvm if necessary by pwsh commands, instead of actions/cache
Browse files Browse the repository at this point in the history
  • Loading branch information
fxliang committed Aug 27, 2024
1 parent 28ace8e commit 2aebe91
Showing 1 changed file with 23 additions and 10 deletions.
33 changes: 23 additions & 10 deletions .github/workflows/commit-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,16 +25,29 @@ jobs:
with:
submodules: recursive

- name: Cache llvm
id: cache-llvm
uses: actions/cache@v4
with:
path: C:\\Program Files\\LLVM
key: ${{ runner.os }}-llvm-18.1.6

- name: Install llvm
if: steps.cache-llvm.outputs.cache-hit != 'true'
run: choco install llvm --version=18.1.6
- name: Install llvm if necessary
shell: pwsh
run: |
$version = ""
if (Get-Command "clang-format" -ErrorAction SilentlyContinue){
$version = clang-format --version
$pat = ".*\s+(\d+\.\d+\.\d+)"
if ($version -match $pat) {
$version = $matches[1]
}
}
if ($version -ne "") {
Write-Host "clang-format version:$version"
if ([version]$version -ge [version]"18.1.6") {
Write-Host "clang-format OK"
} else {
Write-Host "clang-format vesion does not meet"
choco install llvm --version=18.1.6
}
} else {
Write-Host "clang-format not installed"
choco install llvm --version=18.1.6
}
- name: Code style lint
shell: bash
Expand Down

0 comments on commit 2aebe91

Please sign in to comment.