llvm #186
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: llvm | |
on: | |
schedule: | |
- cron: '0 12 * * 1' | |
push: | |
tags: v[0-9]+.[0-9]+.[0-9]+ | |
workflow_dispatch: | |
inputs: | |
llvm_ver: | |
description: "llvm version(e.g. latest 12.0.1 13.0.0)" | |
required: true | |
default: "latest" | |
jobs: | |
windows: | |
runs-on: windows-latest | |
defaults: | |
run: | |
shell: cmd | |
working-directory: C:\ | |
outputs: | |
version: ${{ steps.version.outputs.version }} | |
steps: | |
- uses: ilammy/msvc-dev-cmd@v1 | |
with: | |
arch: amd64 | |
toolset: 14.29 | |
- uses: olegtarasov/[email protected] | |
id: tagName | |
with: | |
tagRegex: "v(.*)" | |
- name: Check version | |
run: | | |
echo "llvm_ver:" ${{ github.event.inputs.llvm_ver }} | |
echo "event_name:" ${{ github.event_name }} | |
- if: github.event.inputs.llvm_ver == 'latest' || github.event_name == 'schedule' | |
run: | | |
echo ver=latest>> %GITHUB_ENV% | |
echo branch=main>> %GITHUB_ENV% | |
- if: github.event.inputs.llvm_ver != '' && github.event.inputs.llvm_ver != 'latest' | |
run: | | |
echo ver=v${{ github.event.inputs.llvm_ver }}>> %GITHUB_ENV% | |
echo branch=llvmorg-${{ github.event.inputs.llvm_ver }}>> %GITHUB_ENV% | |
- if: github.event_name == 'push' | |
run: | | |
echo ver=v${{ steps.tagName.outputs.tag }}>> %GITHUB_ENV% | |
echo branch=llvmorg-${{ steps.tagName.outputs.tag }}>> %GITHUB_ENV% | |
- id: version | |
run: | | |
echo version=${{ env.ver }} >> %GITHUB_OUTPUT% | |
- name: Build llvm | |
run: | | |
git clone --depth=1 https://github.com/llvm/llvm-project.git -b ${{ env.branch }} llvm | |
cd llvm | |
rmdir /s /q .git | |
cmake -Hllvm -BRelease -G Ninja -DCMAKE_BUILD_TYPE=Release -DCMAKE_C_COMPILER=cl -DCMAKE_CXX_COMPILER=cl -DLLVM_TARGETS_TO_BUILD=X86 -DLLVM_ENABLE_PROJECTS=clang -DLLVM_ENABLE_DIA_SDK=OFF | |
ninja -C Release clangFormat clangFrontendTool clangIndex clangTooling clang | |
- name: Compress llvm | |
run: | | |
7z a llvm_msvc.7z -mx9 llvm | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: llvm | |
path: c:\llvm_msvc.7z | |
retention-days: 1 | |
publish: | |
needs: [windows] | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/download-artifact@v4 | |
- name: Download data | |
run: ls -la | |
- name: Publish | |
env: | |
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: | | |
{ | |
echo "llvm version: ${{ needs.windows.outputs.version }}" | |
echo "VC++ compiler toolset version: 14.29" | |
} | tee /tmp/note.md | |
temp_name=llvm_temp | |
tag_name=llvm-${{ needs.windows.outputs.version }} | |
gh release delete $temp_name -y || true | |
git push origin :$tag_name || true | |
gh release delete $tag_name -y || true | |
git push origin :$temp_name || true | |
gh release create $temp_name -t $tag_name -F "/tmp/note.md" -d --target $GITHUB_SHA | |
gh release upload $temp_name --clobber ./llvm/* | |
sleep 5 | |
gh release edit $temp_name --tag $tag_name --draft=false |