mirror of
https://github.com/pezkuwichain/revive.git
synced 2026-04-22 09:08:00 +00:00
CI improvements (#230)
- llvm artifacts search, download and extract now in `get-llvm` action - `get-emsdk` action - clone, install, activate emsdk, so we don't need to build `revive-builder` for this - switch workflows to new actions - `concurrency` for remaining workflows (cancel run if new run is triggered) - `target_commitish` for main release, fixes release commit - Run release workflow in PR without creating a release if PR is labeled with `release-test` --------- Co-authored-by: cornholio <0@mcornholio.ru> Co-authored-by: Alexander Theißen <alex.theissen@me.com> Co-authored-by: xermicus <cyrill@parity.io> Co-authored-by: xermicus <bigcyrill@hotmail.com>
This commit is contained in:
@@ -6,62 +6,48 @@ on:
|
||||
branches: ["main"]
|
||||
workflow_dispatch:
|
||||
|
||||
concurrency:
|
||||
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
|
||||
cancel-in-progress: true
|
||||
|
||||
env:
|
||||
CARGO_TERM_COLOR: always
|
||||
REVIVE_WASM_INSTALL_DIR: ${{ github.workspace }}/target/wasm32-unknown-emscripten/release
|
||||
|
||||
jobs:
|
||||
build-revive-wasm:
|
||||
runs-on: parity-large
|
||||
runs-on: ubuntu-24.04
|
||||
defaults:
|
||||
run:
|
||||
shell: bash
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: Cache LLVM build
|
||||
id: cache-llvm
|
||||
uses: actions/cache@v3
|
||||
with:
|
||||
path: |
|
||||
target-llvm/emscripten/target-final
|
||||
target-llvm/gnu/target-final
|
||||
# Use a unique key based on LLVM version or configuration files to avoid cache invalidation
|
||||
key: llvm-build-${{ runner.os }}-${{ hashFiles('LLVM.lock', 'Cargo.toml', 'Cargo.lock', 'crates/llvm-builder/**', '.github/workflows/build-revive-wasm.yml') }}
|
||||
|
||||
- name: Install system dependencies
|
||||
run: |
|
||||
sudo apt-get update && sudo apt-get install -y cmake ninja-build curl git libssl-dev pkg-config clang lld
|
||||
|
||||
- name: Install Rust stable toolchain
|
||||
uses: actions-rs/toolchain@v1
|
||||
uses: actions-rust-lang/setup-rust-toolchain@v1
|
||||
with:
|
||||
profile: minimal
|
||||
toolchain: stable
|
||||
components: rust-src
|
||||
target: wasm32-unknown-emscripten
|
||||
rustflags: ""
|
||||
|
||||
- name: Install LLVM build dependencies
|
||||
run: |
|
||||
make install-llvm-builder
|
||||
revive-llvm --target-env emscripten clone
|
||||
- name: get llvm gnu
|
||||
uses: ./.github/actions/get-llvm
|
||||
with:
|
||||
artifactArch: x86_64-linux-gnu
|
||||
- name: get llvm emscripten
|
||||
uses: ./.github/actions/get-llvm
|
||||
with:
|
||||
artifactArch: emscripten
|
||||
|
||||
- name: install emsdk
|
||||
uses: ./.github/actions/get-emsdk
|
||||
|
||||
- name: Setup revive environment variables
|
||||
run: |
|
||||
echo "LLVM_SYS_181_PREFIX=$(pwd)/target-llvm/gnu/target-final" >> $GITHUB_ENV
|
||||
echo "REVIVE_LLVM_TARGET_PREFIX=$(pwd)/target-llvm/emscripten/target-final" >> $GITHUB_ENV
|
||||
|
||||
- name: Build host LLVM
|
||||
if: steps.cache-llvm.outputs.cache-hit != 'true'
|
||||
run: |
|
||||
revive-llvm build --llvm-projects lld --llvm-projects clang
|
||||
|
||||
- name: Build target LLVM
|
||||
if: steps.cache-llvm.outputs.cache-hit != 'true'
|
||||
run: |
|
||||
source emsdk/emsdk_env.sh
|
||||
revive-llvm --target-env emscripten build --llvm-projects lld
|
||||
|
||||
- run: |
|
||||
rustup show
|
||||
cargo --version
|
||||
@@ -70,11 +56,6 @@ jobs:
|
||||
cmake --version
|
||||
bash --version
|
||||
|
||||
- name: Use Cached LLVM
|
||||
if: steps.cache-llvm.outputs.cache-hit == 'true'
|
||||
run: |
|
||||
echo "Using cached LLVM"
|
||||
|
||||
- name: Build revive
|
||||
run: |
|
||||
source emsdk/emsdk_env.sh
|
||||
|
||||
@@ -1,36 +0,0 @@
|
||||
module.exports = async ({
|
||||
octokit,
|
||||
context,
|
||||
releasePrefix,
|
||||
artifactSuffix,
|
||||
}) => {
|
||||
let page = 1;
|
||||
|
||||
while (true) {
|
||||
const res = await octokit.rest.repos.listReleases({
|
||||
owner: context.repo.owner,
|
||||
repo: context.repo.repo,
|
||||
per_page: 100,
|
||||
page,
|
||||
});
|
||||
if (res.data.length === 0) {
|
||||
throw new Error(
|
||||
`No LLVM releases with '${artifactSuffix}' atifacts found! Please release LLVM before running this workflow.`,
|
||||
);
|
||||
}
|
||||
|
||||
for (let release of res.data) {
|
||||
if (release.tag_name.startsWith(releasePrefix)) {
|
||||
for (let asset of release.assets) {
|
||||
if (asset.name.includes(artifactSuffix)) {
|
||||
return asset.browser_download_url;
|
||||
}
|
||||
}
|
||||
console.warn(
|
||||
`LLVM release ${release.tag_name} doesn't have a '${artifactSuffix}' artifact; searching for older releases...`,
|
||||
);
|
||||
}
|
||||
}
|
||||
page++;
|
||||
}
|
||||
};
|
||||
@@ -8,6 +8,10 @@ on:
|
||||
required: true
|
||||
description: llvm version in "x.x.x" format, e.g. "18.1.8"
|
||||
|
||||
concurrency:
|
||||
group: ${{ github.workflow }}-${{ github.ref }}
|
||||
cancel-in-progress: true
|
||||
|
||||
env:
|
||||
CARGO_TERM_COLOR: always
|
||||
|
||||
|
||||
@@ -4,9 +4,11 @@ on:
|
||||
push:
|
||||
branches:
|
||||
- "main"
|
||||
pull_request:
|
||||
types: [opened, synchronize, reopened, ready_for_review, labeled]
|
||||
|
||||
concurrency:
|
||||
group: ${{ github.ref }}-${{ github.workflow }}
|
||||
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
|
||||
cancel-in-progress: true
|
||||
|
||||
env:
|
||||
@@ -16,6 +18,7 @@ env:
|
||||
|
||||
jobs:
|
||||
tag:
|
||||
if: github.event_name != 'pull_request' || contains(github.event.pull_request.labels.*.name, 'release-test')
|
||||
runs-on: ubuntu-24.04
|
||||
permissions:
|
||||
contents: write
|
||||
@@ -48,13 +51,13 @@ jobs:
|
||||
export TAG=new;
|
||||
fi
|
||||
echo "TAG=$TAG" >> $GITHUB_OUTPUT
|
||||
|
||||
|
||||
# Generating release notes early, in order to avoid checkout at the last step
|
||||
export RELEASE_NOTES="$(sed '/^## '${PKG_VER}'/,/^## v/!d' CHANGELOG.md | sed -e '1d' -e '$d')"
|
||||
|
||||
|
||||
echo "Release notes:"
|
||||
echo "$RELEASE_NOTES"
|
||||
|
||||
|
||||
echo 'RELEASE_NOTES<<EOF' >> $GITHUB_OUTPUT
|
||||
echo "$RELEASE_NOTES" >> $GITHUB_OUTPUT
|
||||
echo 'EOF' >> $GITHUB_OUTPUT
|
||||
@@ -70,24 +73,17 @@ jobs:
|
||||
arch: arm64
|
||||
if: ${{ needs.tag.outputs.TAG == 'new' }}
|
||||
runs-on: ${{ matrix.os }}
|
||||
name: "build-macos-${{ matrix.arch }}"
|
||||
name: build-macos
|
||||
needs: [tag]
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: Get latest macos ${{ matrix.arch }} LLVM release artifact
|
||||
id: get-llvm-artifact
|
||||
uses: actions/github-script@v7
|
||||
- name: get llvm
|
||||
uses: ./.github/actions/get-llvm
|
||||
with:
|
||||
result-encoding: string
|
||||
script: |
|
||||
const getReleaseArtifact = require("./.github/workflows/get-release-artifact.js");
|
||||
return await getReleaseArtifact({
|
||||
octokit: github,
|
||||
context,
|
||||
releasePrefix: "llvm-",
|
||||
artifactSuffix: "-macos-${{ matrix.arch }}"
|
||||
});
|
||||
releasePrefix: llvm-
|
||||
artifactArch: macos-${{ matrix.arch }}
|
||||
dir: ./
|
||||
|
||||
- uses: actions-rust-lang/setup-rust-toolchain@v1
|
||||
with:
|
||||
@@ -109,11 +105,6 @@ jobs:
|
||||
echo "ninja:" && ninja --version
|
||||
echo "clang:" && clang --version
|
||||
|
||||
- name: download llvm
|
||||
run: |
|
||||
curl -L -o llvm.tar.gz "${{ steps.get-llvm-artifact.outputs.result }}"
|
||||
tar -xvf llvm.tar.gz
|
||||
|
||||
- name: build revive
|
||||
run: |
|
||||
export LLVM_SYS_181_PREFIX=$PWD/target-llvm/gnu/target-final
|
||||
@@ -168,20 +159,6 @@ jobs:
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: Get latest linux LLVM release artifact
|
||||
id: get-llvm-musl-artifact
|
||||
uses: actions/github-script@v7
|
||||
with:
|
||||
result-encoding: string
|
||||
script: |
|
||||
const getReleaseArtifact = require("./.github/workflows/get-release-artifact.js")
|
||||
return await getReleaseArtifact({
|
||||
octokit: github,
|
||||
context,
|
||||
releasePrefix: "llvm-",
|
||||
artifactSuffix: "-x86_64-linux-musl"
|
||||
})
|
||||
|
||||
- name: install linux deps
|
||||
run: |
|
||||
sudo apt-get update && sudo apt-get install -y cmake ninja-build \
|
||||
@@ -203,10 +180,12 @@ jobs:
|
||||
echo "ninja:" && ninja --version
|
||||
echo "clang:" && clang --version
|
||||
|
||||
- name: download llvm
|
||||
run: |
|
||||
curl -L -o llvm.tar.gz "${{ steps.get-llvm-musl-artifact.outputs.result }}"
|
||||
tar -xvf llvm.tar.gz
|
||||
- name: get llvm musl
|
||||
uses: ./.github/actions/get-llvm
|
||||
with:
|
||||
releasePrefix: llvm-
|
||||
artifactArch: x86_64-linux-musl
|
||||
dir: ./
|
||||
|
||||
# Build revive
|
||||
|
||||
@@ -247,29 +226,16 @@ jobs:
|
||||
with:
|
||||
node-version: "20"
|
||||
|
||||
- name: Get latest emscripten LLVM release artifact
|
||||
id: get-llvm-emscripten-artifact
|
||||
uses: actions/github-script@v7
|
||||
- name: get llvm emscripten
|
||||
uses: ./.github/actions/get-llvm
|
||||
with:
|
||||
result-encoding: string
|
||||
script: |
|
||||
const getReleaseArtifact = require("./.github/workflows/get-release-artifact.js")
|
||||
return await getReleaseArtifact({
|
||||
octokit: github,
|
||||
context,
|
||||
releasePrefix: "llvm-",
|
||||
artifactSuffix: "-wasm32-unknown-emscripten"
|
||||
})
|
||||
artifactArch: emscripten
|
||||
|
||||
- name: download llvm
|
||||
run: |
|
||||
curl -L -o llvm.tar.gz "${{ steps.get-llvm-emscripten-artifact.outputs.result }}"
|
||||
tar -xvf llvm.tar.gz
|
||||
- name: install emsdk
|
||||
uses: ./.github/actions/get-emsdk
|
||||
|
||||
- name: build wasm
|
||||
run: |
|
||||
make install-llvm-builder
|
||||
revive-llvm --target-env emscripten clone
|
||||
export LLVM_SYS_181_PREFIX=$PWD/target-llvm/musl/target-final
|
||||
export REVIVE_LLVM_TARGET_PREFIX=$PWD/target-llvm/emscripten/target-final
|
||||
source emsdk/emsdk_env.sh
|
||||
@@ -328,12 +294,11 @@ jobs:
|
||||
retention-days: 1
|
||||
|
||||
create-release:
|
||||
if: github.event_name != 'pull_request'
|
||||
needs: [tag, build-linux-all, macos-universal-binary]
|
||||
runs-on: ubuntu-24.04
|
||||
permissions:
|
||||
contents: write
|
||||
outputs:
|
||||
upload_url: ${{ steps.create_release.outputs.result }}
|
||||
steps:
|
||||
- name: Download revive-wasm
|
||||
uses: actions/download-artifact@v4
|
||||
@@ -360,7 +325,9 @@ jobs:
|
||||
tag_name: ${{ needs.tag.outputs.PKG_VER }}
|
||||
name: ${{ needs.tag.outputs.PKG_VER }}
|
||||
draft: true
|
||||
target_commitish: ${{ github.sha }}
|
||||
files: |
|
||||
./resolc-linux/resolc-static-linux.tar.gz
|
||||
./resolc-macos/resolc-macos.tar.gz
|
||||
./resolc-wasm/resolc-wasm.tar.gz
|
||||
|
||||
|
||||
@@ -6,6 +6,10 @@ on:
|
||||
pull_request:
|
||||
branches: ["main"]
|
||||
|
||||
concurrency:
|
||||
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
|
||||
cancel-in-progress: true
|
||||
|
||||
env:
|
||||
CARGO_TERM_COLOR: always
|
||||
|
||||
|
||||
Reference in New Issue
Block a user