Skip to content

Commit

Permalink
ci: install llvm first
Browse files Browse the repository at this point in the history
  • Loading branch information
sdkrystian committed Dec 2, 2024
1 parent 0ac8c92 commit bd7f91e
Showing 1 changed file with 73 additions and 73 deletions.
146 changes: 73 additions & 73 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,79 @@ jobs:
with:
apt-get: ${{ matrix.install }}

- name: Resolve LLVM Root
id: resolve-llvm-root
run: |
set -x
cd ..
llvm_root=$(pwd)/third-party/llvm-project/install
if [[ ${{ runner.os }} == 'Windows' ]]; then
llvm_root=$(echo "$llvm_root" | sed 's/\\/\//g')
llvm_root=$(echo $llvm_root | sed 's|^/d/|D:/|')
echo "$llvm_root"
fi
echo -E "llvm-root=$llvm_root" >> $GITHUB_OUTPUT
- name: Cached LLVM Binaries
id: llvm-cache
uses: actions/cache@v4
with:
path: ${{ steps.resolve-llvm-root.outputs.llvm-root }}
key: ${{ matrix.llvm-cache-key }}

- name: Download LLVM Binaries
id: llvm-download
if: steps.llvm-cache.outputs.cache-hit != 'true'
run: |
set -x
url=https://mrdocs.com/llvm+clang/${{ matrix.llvm-archive-filename }}
http_status=$(curl -s -o /dev/null -w "%{http_code}" -I "$url")
if [ "$http_status" -eq 200 ]; then
found="true"
echo "found=$found" >> $GITHUB_OUTPUT
curl -L -o ${{ matrix.llvm-archive-filename }} "$url"
install_prefix=$(pwd)/../third-party/llvm-project/install
mkdir -p $install_prefix
if [[ ${{ matrix.llvm-archive-extension }} == '7z' ]]; then
7z x ${{ matrix.llvm-archive-filename }} -o$install_prefix
else
tar -xjf ${{ matrix.llvm-archive-filename }} -C $install_prefix
fi
if [[ $(ls -1 $install_prefix | wc -l) -eq 1 ]]; then
single_dir=$(ls -1 $install_prefix)
if [[ -d $install_prefix/$single_dir ]]; then
mv $install_prefix/$single_dir/* $install_prefix/
rmdir $install_prefix/$single_dir
fi
fi
else
found="false"
echo "found=$found" >> $GITHUB_OUTPUT
fi
- name: Install LLVM
uses: alandefreitas/cpp-actions/[email protected]
if: steps.llvm-cache.outputs.cache-hit != 'true' && steps.llvm-download.outputs.found != 'true'
with:
cmake-version: '>=3.26'
source-dir: ../third-party/llvm-project/llvm
git-repository: https://github.com/llvm/llvm-project.git
git-tag: ${{ matrix.llvm-hash }}
download-dir: ../third-party/llvm-project
patches: |
./third-party/llvm/CMakePresets.json
./third-party/llvm/CMakeUserPresets.json
build-dir: ${sourceDir}/llvm/build
preset: ${{ matrix.llvm-build-preset }}
build-type: ${{ matrix.build-type }}
cc: ${{ steps.setup-cpp.outputs.cc }}
cxx: ${{ steps.setup-cpp.outputs.cxx }}
generator: Ninja
install: true
install-prefix: ${sourceDir}/../install
run-tests: false
trace-commands: true

- name: Install Duktape
uses: alandefreitas/cpp-actions/[email protected]
with:
Expand Down Expand Up @@ -266,79 +339,6 @@ jobs:
run-tests: false
trace-commands: true

- name: Resolve LLVM Root
id: resolve-llvm-root
run: |
set -x
cd ..
llvm_root=$(pwd)/third-party/llvm-project/install
if [[ ${{ runner.os }} == 'Windows' ]]; then
llvm_root=$(echo "$llvm_root" | sed 's/\\/\//g')
llvm_root=$(echo $llvm_root | sed 's|^/d/|D:/|')
echo "$llvm_root"
fi
echo -E "llvm-root=$llvm_root" >> $GITHUB_OUTPUT
- name: Cached LLVM Binaries
id: llvm-cache
uses: actions/cache@v4
with:
path: ${{ steps.resolve-llvm-root.outputs.llvm-root }}
key: ${{ matrix.llvm-cache-key }}

- name: Download LLVM Binaries
id: llvm-download
if: steps.llvm-cache.outputs.cache-hit != 'true'
run: |
set -x
url=https://mrdocs.com/llvm+clang/${{ matrix.llvm-archive-filename }}
http_status=$(curl -s -o /dev/null -w "%{http_code}" -I "$url")
if [ "$http_status" -eq 200 ]; then
found="true"
echo "found=$found" >> $GITHUB_OUTPUT
curl -L -o ${{ matrix.llvm-archive-filename }} "$url"
install_prefix=$(pwd)/../third-party/llvm-project/install
mkdir -p $install_prefix
if [[ ${{ matrix.llvm-archive-extension }} == '7z' ]]; then
7z x ${{ matrix.llvm-archive-filename }} -o$install_prefix
else
tar -xjf ${{ matrix.llvm-archive-filename }} -C $install_prefix
fi
if [[ $(ls -1 $install_prefix | wc -l) -eq 1 ]]; then
single_dir=$(ls -1 $install_prefix)
if [[ -d $install_prefix/$single_dir ]]; then
mv $install_prefix/$single_dir/* $install_prefix/
rmdir $install_prefix/$single_dir
fi
fi
else
found="false"
echo "found=$found" >> $GITHUB_OUTPUT
fi
- name: Install LLVM
uses: alandefreitas/cpp-actions/[email protected]
if: steps.llvm-cache.outputs.cache-hit != 'true' && steps.llvm-download.outputs.found != 'true'
with:
cmake-version: '>=3.26'
source-dir: ../third-party/llvm-project/llvm
git-repository: https://github.com/llvm/llvm-project.git
git-tag: ${{ matrix.llvm-hash }}
download-dir: ../third-party/llvm-project
patches: |
./third-party/llvm/CMakePresets.json
./third-party/llvm/CMakeUserPresets.json
build-dir: ${sourceDir}/llvm/build
preset: ${{ matrix.llvm-build-preset }}
build-type: ${{ matrix.build-type }}
cc: ${{ steps.setup-cpp.outputs.cc }}
cxx: ${{ steps.setup-cpp.outputs.cxx }}
generator: Ninja
install: true
install-prefix: ${sourceDir}/../install
run-tests: false
trace-commands: true

- name: Install Node.js
uses: actions/setup-node@v4
with:
Expand Down

0 comments on commit bd7f91e

Please sign in to comment.