mirror of
https://github.com/pezkuwichain/revive.git
synced 2026-04-22 14:57:56 +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:
@@ -0,0 +1,91 @@
|
||||
# example:
|
||||
#
|
||||
# - name: get llvm
|
||||
# uses: ./.github/actions/get-llvm
|
||||
# with:
|
||||
# releasePrefix: llvm-
|
||||
# artifactArch: macos-arm64
|
||||
# dir: target-llvm/macos
|
||||
|
||||
name: "get llvm"
|
||||
inputs:
|
||||
artifactArch:
|
||||
required: true
|
||||
releasePrefix:
|
||||
description: "LLVM release tag prefix to search"
|
||||
required: false
|
||||
default: "llvm-"
|
||||
dir:
|
||||
description: "Archive extract path (`tar -C`)"
|
||||
required: false
|
||||
default: "./"
|
||||
stripComponents:
|
||||
description: "Strip UMBER leading components from file names on extraction (`tar --strip-components`)"
|
||||
required: false
|
||||
default: 0
|
||||
|
||||
|
||||
runs:
|
||||
using: "composite"
|
||||
steps:
|
||||
- name: find asset
|
||||
id: find
|
||||
uses: actions/github-script@v7
|
||||
env:
|
||||
releasePrefix: ${{ inputs.releasePrefix }}
|
||||
artifactArch: ${{ inputs.artifactArch }}
|
||||
with:
|
||||
result-encoding: string
|
||||
script: |
|
||||
let page = 1;
|
||||
let releases = [];
|
||||
|
||||
let releasePrefix = process.env.releasePrefix
|
||||
let artifactArch = process.env.artifactArch
|
||||
|
||||
do {
|
||||
const res = await github.rest.repos.listReleases({
|
||||
owner: context.repo.owner,
|
||||
repo: context.repo.repo,
|
||||
per_page: 50,
|
||||
page,
|
||||
});
|
||||
|
||||
releases = res.data
|
||||
releases.sort((a, b) => {
|
||||
return (a.published_at < b.published_at) ? 1 : ((a.published_at > b.published_at) ? -1 : 0);
|
||||
});
|
||||
|
||||
let llvmLatestRelease = releases.find(release => {
|
||||
return release.tag_name.startsWith(releasePrefix);
|
||||
});
|
||||
if (llvmLatestRelease){
|
||||
let asset = llvmLatestRelease.assets.find(asset =>{
|
||||
return asset.name.includes(artifactArch);
|
||||
});
|
||||
if (!asset){
|
||||
core.setFailed(`Artifact for '${artifactArch}' not found in release ${llvmLatestRelease.tag_name} (${llvmLatestRelease.html_url})`);
|
||||
process.exit();
|
||||
}
|
||||
return asset.browser_download_url;
|
||||
}
|
||||
|
||||
page++;
|
||||
} while(releases.length > 0);
|
||||
|
||||
core.setFailed(`No LLVM releases with '${releasePrefix}' atifacts found! Please release LLVM before running this workflow.`);
|
||||
process.exit();
|
||||
|
||||
- name: download
|
||||
shell: bash
|
||||
run: |
|
||||
mkdir -p ${{ inputs.dir }}
|
||||
curl -sSLo llvm.tar.gz ${{ steps.find.outputs.result }}
|
||||
ls -al
|
||||
|
||||
- name: unpack
|
||||
shell: bash
|
||||
run: |
|
||||
tar -xf llvm.tar.gz -C ${{ inputs.dir }} --strip-components=${{ inputs.stripComponents }}
|
||||
rm llvm.tar.gz
|
||||
ls -al ${{ inputs.dir }}
|
||||
Reference in New Issue
Block a user