mirror of
https://github.com/pezkuwichain/revive.git
synced 2026-04-22 21:58:01 +00:00
2fb8beee62
This PR changes the CI build scripts to also build LLVM for windows. **It doesn't build `revive` itself for windows**. This will come in a follow up. But once we have a LLVM binary release the turn around time will be much quicker for experimenting with the revive windows build. I manually uploaded the release those changes produce [here](https://github.com/paritytech/revive-alex-workflowtest/releases/tag/llvm-18.1.8-revive.22f3ceb). This enables this PR's CI to find the proper release. This is necessary because I am also making changes to the folder structure and artifact naming that the other CI jobs are depending on. Releases generated from this branch can be inspected here: https://github.com/paritytech/revive-alex-workflowtest/releases/tag/v0.1.0-dev.12 Summary of changes: - Change `llvm-builder` to use MSVC toolchain on windows - Fix `llvm-builder` to work with `.exe` files - Unify the llvm release jobs into a single one. This removed a lot of copy pasted code and also speeds up the build by giving each their own runner. - Use the LLVM target triple to name the binary releases instead of an ad-hoc naming convention - Remove the nested folder hierarchy inside the llvm release. Its just now a single folder `llvm-<target>` that contains the toolchain. - Give jobs and workflows consistent names - Replace all runners bei their `*-latest` counterpart - Only use `parity-large` to build llvm now. All other jobs use github runners
133 lines
4.6 KiB
YAML
133 lines
4.6 KiB
YAML
name: Release LLVM
|
|
on:
|
|
workflow_dispatch:
|
|
inputs:
|
|
llvm_version:
|
|
type: string
|
|
required: true
|
|
description: llvm version in "x.x.x" format, e.g. "18.1.8"
|
|
|
|
concurrency:
|
|
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
|
|
cancel-in-progress: true
|
|
|
|
env:
|
|
CARGO_TERM_COLOR: always
|
|
|
|
jobs:
|
|
create-release-draft:
|
|
runs-on: ubuntu-24.04
|
|
permissions:
|
|
contents: write
|
|
outputs:
|
|
version: ${{ steps.resolve-version.outputs.version }}
|
|
steps:
|
|
- id: resolve-version
|
|
run: |
|
|
echo "version=llvm-${{ inputs.llvm_version }}-revive.${GITHUB_SHA:0:7}" >> $GITHUB_OUTPUT
|
|
|
|
- name: Create Release
|
|
uses: softprops/action-gh-release@v2
|
|
with:
|
|
name: ${{ steps.resolve-version.outputs.version }}
|
|
body: "LLVM is a dependency of revive. The LLVM releases are used by our CI to build revive."
|
|
draft: true
|
|
tag_name: ${{ steps.resolve-version.outputs.version }}
|
|
|
|
build:
|
|
strategy:
|
|
matrix:
|
|
target: [x86_64-unknown-linux-gnu, x86_64-unknown-linux-musl, wasm32-unknown-emscripten, aarch64-apple-darwin, x86_64-apple-darwin, x86_64-pc-windows-msvc]
|
|
include:
|
|
- target: x86_64-unknown-linux-gnu
|
|
builder-arg: gnu
|
|
host: linux
|
|
runner: parity-large
|
|
- target: x86_64-unknown-linux-musl
|
|
builder-arg: musl
|
|
host: linux
|
|
runner: parity-large
|
|
- target: wasm32-unknown-emscripten
|
|
builder-arg: emscripten
|
|
host: linux
|
|
runner: parity-large
|
|
- target: aarch64-apple-darwin
|
|
builder-arg: gnu
|
|
host: macos
|
|
runner: macos-14
|
|
- target: x86_64-apple-darwin
|
|
builder-arg: gnu
|
|
host: macos
|
|
runner: macos-13
|
|
- target: x86_64-pc-windows-msvc
|
|
builder-arg: gnu
|
|
host: windows
|
|
runner: windows-2022
|
|
needs: create-release-draft
|
|
runs-on: ${{ matrix.runner }}
|
|
env:
|
|
RUST_LOG: trace
|
|
permissions:
|
|
contents: write # for uploading assets to release
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- uses: actions-rust-lang/setup-rust-toolchain@v1
|
|
with:
|
|
# without this it will override our rust flags
|
|
rustflags: ""
|
|
cache-key: ${{ matrix.target }}
|
|
|
|
- name: Install Dependencies
|
|
if: ${{ matrix.host == 'linux' }}
|
|
run: |
|
|
sudo apt-get update && sudo apt-get install -y cmake ninja-build curl git libssl-dev pkg-config clang lld musl
|
|
|
|
- name: Install Dependencies
|
|
if: ${{ matrix.host == 'macos' }}
|
|
run: |
|
|
brew install ninja
|
|
|
|
- name: Install LLVM Builder
|
|
run: |
|
|
cargo install --path crates/llvm-builder
|
|
|
|
- name: Clone LLVM
|
|
run: |
|
|
revive-llvm --target-env ${{ matrix.builder-arg }} clone
|
|
|
|
- name: Build LLVM
|
|
if: ${{ matrix.target != 'wasm32-unknown-emscripten' }}
|
|
run: |
|
|
revive-llvm --target-env ${{ matrix.builder-arg }} build --llvm-projects lld --llvm-projects clang
|
|
|
|
- name: Build LLVM
|
|
if: ${{ matrix.target == 'wasm32-unknown-emscripten' }}
|
|
run: |
|
|
source emsdk/emsdk_env.sh
|
|
revive-llvm --target-env ${{ matrix.builder-arg }} build --llvm-projects lld
|
|
|
|
- name: Remove Unnecessary Binaries
|
|
shell: bash
|
|
run: |
|
|
cd target-llvm/${{ matrix.builder-arg }}/target-final/bin/
|
|
rm -f diagtool* llvm-libtool-darwin* llvm-lipo* llvm-pdbutil* llvm-dwarfdump* llvm-nm* llvm-readobj* llvm-cfi-verify* \
|
|
sancov* llvm-debuginfo-analyzer* llvm-objdump* llvm-profgen* llvm-extract* llvm-jitlink* llvm-c-test* llvm-gsymutil* llvm-dwp* \
|
|
dsymutil* llvm-dwarfutil* llvm-exegesis* lli clang-rename* bugpoint* clang-extdef-mapping* clang-refactor* c-index-test* \
|
|
llvm-reduce* llvm-lto* clang-linker-wrapper* llc* llvm-lto2* llvm-otool* llvm-readelf* \
|
|
clang-repl* clang-check* clang-scan-deps*
|
|
cd -
|
|
|
|
- name: Package Artifact
|
|
shell: bash
|
|
run: |
|
|
mv target-llvm/${{ matrix.builder-arg }}/target-final/ llvm-${{ matrix.target }}
|
|
tar -czf "${{ needs.create-release-draft.outputs.version }}-${{ matrix.target }}.tar.gz" llvm-${{ matrix.target }}
|
|
|
|
- name: Add Artifact to Release
|
|
uses: softprops/action-gh-release@v2
|
|
with:
|
|
tag_name: ${{ needs.create-release-draft.outputs.version }}
|
|
draft: true
|
|
files: |
|
|
${{ needs.create-release-draft.outputs.version }}-${{ matrix.target }}.tar.gz
|