mirror of
https://github.com/pezkuwichain/revive.git
synced 2026-06-12 16:21:05 +00:00
Build LLVM for Windows (#248)
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
This commit is contained in:
committed by
GitHub
parent
93788e72e9
commit
2fb8beee62
@@ -1,4 +1,4 @@
|
|||||||
name: "get emsdk"
|
name: "Get Emscripten SDK"
|
||||||
inputs:
|
inputs:
|
||||||
version:
|
version:
|
||||||
description: ""
|
description: ""
|
||||||
@@ -9,7 +9,6 @@ inputs:
|
|||||||
runs:
|
runs:
|
||||||
using: "composite"
|
using: "composite"
|
||||||
steps:
|
steps:
|
||||||
|
|
||||||
- name: install emsdk
|
- name: install emsdk
|
||||||
shell: bash
|
shell: bash
|
||||||
run: |
|
run: |
|
||||||
|
|||||||
@@ -1,29 +1,12 @@
|
|||||||
# example:
|
# example:
|
||||||
#
|
# - uses: ./.github/actions/get-llvm
|
||||||
# - name: get llvm
|
|
||||||
# uses: ./.github/actions/get-llvm
|
|
||||||
# with:
|
# with:
|
||||||
# releasePrefix: llvm-
|
# target: x86_64-unknown-linux-gnu
|
||||||
# artifactArch: macos-arm64
|
|
||||||
# dir: target-llvm/macos
|
|
||||||
|
|
||||||
name: "get llvm"
|
name: "Download LLVM"
|
||||||
inputs:
|
inputs:
|
||||||
artifactArch:
|
target:
|
||||||
required: true
|
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:
|
runs:
|
||||||
using: "composite"
|
using: "composite"
|
||||||
@@ -32,16 +15,15 @@ runs:
|
|||||||
id: find
|
id: find
|
||||||
uses: actions/github-script@v7
|
uses: actions/github-script@v7
|
||||||
env:
|
env:
|
||||||
releasePrefix: ${{ inputs.releasePrefix }}
|
target: ${{ inputs.target }}
|
||||||
artifactArch: ${{ inputs.artifactArch }}
|
|
||||||
with:
|
with:
|
||||||
result-encoding: string
|
result-encoding: string
|
||||||
script: |
|
script: |
|
||||||
let page = 1;
|
let page = 1;
|
||||||
let releases = [];
|
let releases = [];
|
||||||
|
|
||||||
let releasePrefix = process.env.releasePrefix
|
let releasePrefix = "llvm-"
|
||||||
let artifactArch = process.env.artifactArch
|
let target = process.env.target
|
||||||
|
|
||||||
do {
|
do {
|
||||||
const res = await github.rest.repos.listReleases({
|
const res = await github.rest.repos.listReleases({
|
||||||
@@ -61,10 +43,10 @@ runs:
|
|||||||
});
|
});
|
||||||
if (llvmLatestRelease){
|
if (llvmLatestRelease){
|
||||||
let asset = llvmLatestRelease.assets.find(asset =>{
|
let asset = llvmLatestRelease.assets.find(asset =>{
|
||||||
return asset.name.includes(artifactArch);
|
return asset.name.includes(target);
|
||||||
});
|
});
|
||||||
if (!asset){
|
if (!asset){
|
||||||
core.setFailed(`Artifact for '${artifactArch}' not found in release ${llvmLatestRelease.tag_name} (${llvmLatestRelease.html_url})`);
|
core.setFailed(`Artifact for '${target}' not found in release ${llvmLatestRelease.tag_name} (${llvmLatestRelease.html_url})`);
|
||||||
process.exit();
|
process.exit();
|
||||||
}
|
}
|
||||||
return asset.browser_download_url;
|
return asset.browser_download_url;
|
||||||
@@ -79,13 +61,10 @@ runs:
|
|||||||
- name: download
|
- name: download
|
||||||
shell: bash
|
shell: bash
|
||||||
run: |
|
run: |
|
||||||
mkdir -p ${{ inputs.dir }}
|
|
||||||
curl -sSLo llvm.tar.gz ${{ steps.find.outputs.result }}
|
curl -sSLo llvm.tar.gz ${{ steps.find.outputs.result }}
|
||||||
ls -al
|
|
||||||
|
|
||||||
- name: unpack
|
- name: unpack
|
||||||
shell: bash
|
shell: bash
|
||||||
run: |
|
run: |
|
||||||
tar -xf llvm.tar.gz -C ${{ inputs.dir }} --strip-components=${{ inputs.stripComponents }}
|
tar -xf llvm.tar.gz
|
||||||
rm llvm.tar.gz
|
rm llvm.tar.gz
|
||||||
ls -al ${{ inputs.dir }}
|
|
||||||
@@ -0,0 +1,31 @@
|
|||||||
|
name: "Install Solidity Compiler"
|
||||||
|
|
||||||
|
runs:
|
||||||
|
using: "composite"
|
||||||
|
steps:
|
||||||
|
- name: Put Solc Direcotry into PATH
|
||||||
|
shell: bash
|
||||||
|
run: |
|
||||||
|
mkdir -p solc
|
||||||
|
echo "$(pwd)/solc/" >> $GITHUB_PATH
|
||||||
|
|
||||||
|
- name: Figure out Solc Download URL
|
||||||
|
shell: bash
|
||||||
|
run: |
|
||||||
|
if [[ "${{ runner.os }}" == "Linux" ]]; then
|
||||||
|
echo "SOLC_NAME=solc-static-linux" >> $GITHUB_ENV
|
||||||
|
elif [[ "${{ runner.os }}" == "Windows" ]]; then
|
||||||
|
echo "SOLC_NAME=solc-windows.exe" >> $GITHUB_ENV
|
||||||
|
else
|
||||||
|
echo "SOLC_NAME=solc-macos" >> $GITHUB_ENV
|
||||||
|
fi
|
||||||
|
|
||||||
|
- name: Download Solc
|
||||||
|
shell: bash
|
||||||
|
run: |
|
||||||
|
curl -sSL --output solc/solc https://github.com/ethereum/solidity/releases/download/v0.8.28/${SOLC_NAME}
|
||||||
|
|
||||||
|
- name: Make Solc Executable
|
||||||
|
shell: bash
|
||||||
|
run: |
|
||||||
|
chmod +x solc/solc
|
||||||
@@ -1,5 +1,4 @@
|
|||||||
name: Release LLVM
|
name: Release LLVM
|
||||||
|
|
||||||
on:
|
on:
|
||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
inputs:
|
inputs:
|
||||||
@@ -9,15 +8,15 @@ on:
|
|||||||
description: llvm version in "x.x.x" format, e.g. "18.1.8"
|
description: llvm version in "x.x.x" format, e.g. "18.1.8"
|
||||||
|
|
||||||
concurrency:
|
concurrency:
|
||||||
group: ${{ github.workflow }}-${{ github.ref }}
|
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
|
||||||
cancel-in-progress: true
|
cancel-in-progress: true
|
||||||
|
|
||||||
env:
|
env:
|
||||||
CARGO_TERM_COLOR: always
|
CARGO_TERM_COLOR: always
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
create-release:
|
create-release-draft:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-24.04
|
||||||
permissions:
|
permissions:
|
||||||
contents: write
|
contents: write
|
||||||
outputs:
|
outputs:
|
||||||
@@ -27,145 +26,107 @@ jobs:
|
|||||||
run: |
|
run: |
|
||||||
echo "version=llvm-${{ inputs.llvm_version }}-revive.${GITHUB_SHA:0:7}" >> $GITHUB_OUTPUT
|
echo "version=llvm-${{ inputs.llvm_version }}-revive.${GITHUB_SHA:0:7}" >> $GITHUB_OUTPUT
|
||||||
|
|
||||||
- name: create release
|
- name: Create Release
|
||||||
uses: softprops/action-gh-release@v2
|
uses: softprops/action-gh-release@v2
|
||||||
with:
|
with:
|
||||||
name: "LLVM binaries release: ${{ steps.resolve-version.outputs.version }}"
|
name: ${{ steps.resolve-version.outputs.version }}
|
||||||
body: "This release includes binaries of LLVM, used to compile revive itself"
|
body: "LLVM is a dependency of revive. The LLVM releases are used by our CI to build revive."
|
||||||
make_latest: "false"
|
draft: true
|
||||||
tag_name: ${{ steps.resolve-version.outputs.version }}
|
tag_name: ${{ steps.resolve-version.outputs.version }}
|
||||||
|
|
||||||
build-macos:
|
build:
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
os: [macos-14, macos-13]
|
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:
|
include:
|
||||||
- os: macos-13
|
- target: x86_64-unknown-linux-gnu
|
||||||
arch: x64
|
builder-arg: gnu
|
||||||
- os: macos-14
|
host: linux
|
||||||
arch: arm64
|
runner: parity-large
|
||||||
needs: create-release
|
- target: x86_64-unknown-linux-musl
|
||||||
runs-on: ${{ matrix.os }}
|
builder-arg: musl
|
||||||
name: "build-macos-${{ matrix.arch }}"
|
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:
|
env:
|
||||||
RUST_LOG: trace
|
RUST_LOG: trace
|
||||||
permissions:
|
permissions:
|
||||||
contents: write # for uploading assets to release
|
contents: write # for uploading assets to release
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
|
- uses: actions-rust-lang/setup-rust-toolchain@v1
|
||||||
- name: install macos deps
|
|
||||||
run: |
|
|
||||||
brew install ninja
|
|
||||||
|
|
||||||
- name: versions
|
|
||||||
run: |
|
|
||||||
rustup show
|
|
||||||
cargo --version
|
|
||||||
cmake --version
|
|
||||||
echo "bash:" && bash --version
|
|
||||||
echo "ninja:" && ninja --version
|
|
||||||
echo "clang:" && clang --version
|
|
||||||
|
|
||||||
- name: Build LLVM
|
|
||||||
run: |
|
|
||||||
make install-llvm
|
|
||||||
|
|
||||||
- name: clean
|
|
||||||
# check removed files
|
|
||||||
run: |
|
|
||||||
cd target-llvm/gnu/target-final/bin/
|
|
||||||
rm 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
|
|
||||||
|
|
||||||
- name: package artifacts
|
|
||||||
run: |
|
|
||||||
tar -czf "${{ needs.create-release.outputs.version }}-macos-${{ matrix.arch }}.tar.gz" target-llvm/gnu/target-final
|
|
||||||
|
|
||||||
- name: upload archive to release
|
|
||||||
uses: softprops/action-gh-release@v2
|
|
||||||
with:
|
with:
|
||||||
make_latest: "false"
|
# without this it will override our rust flags
|
||||||
tag_name: ${{ needs.create-release.outputs.version }}
|
rustflags: ""
|
||||||
files: |
|
cache-key: ${{ matrix.target }}
|
||||||
${{ needs.create-release.outputs.version }}-macos-${{ matrix.arch }}.tar.gz
|
|
||||||
|
|
||||||
|
- name: Install Dependencies
|
||||||
build-linux-all:
|
if: ${{ matrix.host == 'linux' }}
|
||||||
needs: create-release
|
|
||||||
runs-on: parity-large
|
|
||||||
env:
|
|
||||||
RUST_LOG: trace
|
|
||||||
permissions:
|
|
||||||
contents: write # for uploading assets to release
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v4
|
|
||||||
|
|
||||||
- name: install linux deps
|
|
||||||
run: |
|
run: |
|
||||||
sudo apt-get update && sudo apt-get install -y cmake ninja-build curl git libssl-dev pkg-config clang lld musl
|
sudo apt-get update && sudo apt-get install -y cmake ninja-build curl git libssl-dev pkg-config clang lld musl
|
||||||
|
|
||||||
- uses: actions-rust-lang/setup-rust-toolchain@v1
|
- name: Install Dependencies
|
||||||
with:
|
if: ${{ matrix.host == 'macos' }}
|
||||||
toolchain: stable
|
|
||||||
components: rust-src
|
|
||||||
target: wasm32-unknown-emscripten
|
|
||||||
rustflags: ""
|
|
||||||
|
|
||||||
- name: versions
|
|
||||||
run: |
|
run: |
|
||||||
rustup show
|
brew install ninja
|
||||||
cargo --version
|
|
||||||
cmake --version
|
|
||||||
echo "bash:" && bash --version
|
|
||||||
echo "ninja:" && ninja --version
|
|
||||||
echo "clang:" && clang --version
|
|
||||||
|
|
||||||
- name: Build host LLVM
|
- name: Install LLVM Builder
|
||||||
run: |
|
run: |
|
||||||
make install-llvm
|
cargo install --path crates/llvm-builder
|
||||||
|
|
||||||
- name: Build gnu LLVM
|
- name: Clone LLVM
|
||||||
run: |
|
run: |
|
||||||
revive-llvm clone
|
revive-llvm --target-env ${{ matrix.builder-arg }} clone
|
||||||
revive-llvm build --llvm-projects lld --llvm-projects clang
|
|
||||||
|
|
||||||
- name: Build musl LLVM
|
- name: Build LLVM
|
||||||
|
if: ${{ matrix.target != 'wasm32-unknown-emscripten' }}
|
||||||
run: |
|
run: |
|
||||||
revive-llvm --target-env musl build --llvm-projects lld --llvm-projects clang
|
revive-llvm --target-env ${{ matrix.builder-arg }} build --llvm-projects lld --llvm-projects clang
|
||||||
|
|
||||||
- name: Build emscripten LLVM
|
- name: Build LLVM
|
||||||
|
if: ${{ matrix.target == 'wasm32-unknown-emscripten' }}
|
||||||
run: |
|
run: |
|
||||||
revive-llvm --target-env emscripten clone
|
|
||||||
source emsdk/emsdk_env.sh
|
source emsdk/emsdk_env.sh
|
||||||
revive-llvm --target-env emscripten build --llvm-projects lld
|
revive-llvm --target-env ${{ matrix.builder-arg }} build --llvm-projects lld
|
||||||
|
|
||||||
- name: clean
|
- name: Remove Unnecessary Binaries
|
||||||
# check removed files
|
shell: bash
|
||||||
run: |
|
run: |
|
||||||
for target in gnu emscripten musl; do
|
cd target-llvm/${{ matrix.builder-arg }}/target-final/bin/
|
||||||
cd target-llvm/${target}/target-final/bin/
|
rm -f diagtool* llvm-libtool-darwin* llvm-lipo* llvm-pdbutil* llvm-dwarfdump* llvm-nm* llvm-readobj* llvm-cfi-verify* \
|
||||||
rm -rf 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* \
|
||||||
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* \
|
||||||
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* \
|
||||||
llvm-reduce llvm-lto clang-linker-wrapper llc llvm-lto2 llvm-otool llvm-readelf
|
clang-repl* clang-check* clang-scan-deps*
|
||||||
cd -
|
cd -
|
||||||
done
|
|
||||||
|
|
||||||
- name: package artifacts
|
- name: Package Artifact
|
||||||
|
shell: bash
|
||||||
run: |
|
run: |
|
||||||
tar -czf "${{ needs.create-release.outputs.version }}-x86_64-linux-gnu-linux.tar.gz" target-llvm/gnu/target-final
|
mv target-llvm/${{ matrix.builder-arg }}/target-final/ llvm-${{ matrix.target }}
|
||||||
tar -czf "${{ needs.create-release.outputs.version }}-x86_64-linux-musl.tar.gz" target-llvm/musl/target-final
|
tar -czf "${{ needs.create-release-draft.outputs.version }}-${{ matrix.target }}.tar.gz" llvm-${{ matrix.target }}
|
||||||
tar -czf "${{ needs.create-release.outputs.version }}-wasm32-unknown-emscripten.tar.gz" target-llvm/emscripten/target-final
|
|
||||||
|
|
||||||
- name: upload archive to release
|
- name: Add Artifact to Release
|
||||||
uses: softprops/action-gh-release@v2
|
uses: softprops/action-gh-release@v2
|
||||||
with:
|
with:
|
||||||
make_latest: "false"
|
tag_name: ${{ needs.create-release-draft.outputs.version }}
|
||||||
tag_name: ${{ needs.create-release.outputs.version }}
|
draft: true
|
||||||
files: |
|
files: |
|
||||||
${{ needs.create-release.outputs.version }}-x86_64-linux-gnu-linux.tar.gz
|
${{ needs.create-release-draft.outputs.version }}-${{ matrix.target }}.tar.gz
|
||||||
${{ needs.create-release.outputs.version }}-x86_64-linux-musl.tar.gz
|
|
||||||
${{ needs.create-release.outputs.version }}-wasm32-unknown-emscripten.tar.gz
|
|
||||||
|
|||||||
+104
-189
@@ -1,23 +1,22 @@
|
|||||||
name: Release
|
name: Release
|
||||||
run-name: Release ${{ github.ref_name }}
|
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
branches:
|
branches: ["main"]
|
||||||
- "main"
|
|
||||||
pull_request:
|
pull_request:
|
||||||
types: [opened, synchronize, reopened, ready_for_review, labeled]
|
branches: ["main"]
|
||||||
|
types: [opened, synchronize, labled, unlabled]
|
||||||
|
workflow_dispatch:
|
||||||
|
|
||||||
concurrency:
|
concurrency:
|
||||||
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
|
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
|
||||||
cancel-in-progress: true
|
cancel-in-progress: true
|
||||||
|
|
||||||
env:
|
env:
|
||||||
#rust-musl-cross:x86_64-musl
|
CARGO_TERM_COLOR: always
|
||||||
RUST_MUSL_CROSS_IMAGE: messense/rust-musl-cross@sha256:68b86bc7cb2867259e6b233415a665ff4469c28b57763e78c3bfea1c68091561
|
RUST_MUSL_CROSS_IMAGE: messense/rust-musl-cross@sha256:68b86bc7cb2867259e6b233415a665ff4469c28b57763e78c3bfea1c68091561
|
||||||
RUST_LOG: trace
|
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
tag:
|
check-version-changed:
|
||||||
if: github.event_name != 'pull_request' || contains(github.event.pull_request.labels.*.name, 'release-test')
|
if: github.event_name != 'pull_request' || contains(github.event.pull_request.labels.*.name, 'release-test')
|
||||||
runs-on: ubuntu-24.04
|
runs-on: ubuntu-24.04
|
||||||
permissions:
|
permissions:
|
||||||
@@ -27,13 +26,11 @@ jobs:
|
|||||||
PKG_VER: ${{ steps.versions.outputs.PKG_VER }}
|
PKG_VER: ${{ steps.versions.outputs.PKG_VER }}
|
||||||
RELEASE_NOTES: ${{ steps.versions.outputs.RELEASE_NOTES }}
|
RELEASE_NOTES: ${{ steps.versions.outputs.RELEASE_NOTES }}
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- uses: actions/checkout@v4
|
||||||
uses: actions/checkout@v4
|
|
||||||
with:
|
with:
|
||||||
fetch-tags: "true"
|
fetch-tags: true
|
||||||
fetch-depth: 0
|
|
||||||
|
|
||||||
- name: Versions
|
- name: Check Versions
|
||||||
id: versions
|
id: versions
|
||||||
run: |
|
run: |
|
||||||
export CURRENT_TAG=$(git describe --tags --abbrev=0 --exclude "llvm-*")
|
export CURRENT_TAG=$(git describe --tags --abbrev=0 --exclude "llvm-*")
|
||||||
@@ -62,190 +59,112 @@ jobs:
|
|||||||
echo "$RELEASE_NOTES" >> $GITHUB_OUTPUT
|
echo "$RELEASE_NOTES" >> $GITHUB_OUTPUT
|
||||||
echo 'EOF' >> $GITHUB_OUTPUT
|
echo 'EOF' >> $GITHUB_OUTPUT
|
||||||
|
|
||||||
build-macos:
|
build:
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
os: [macos-14, macos-13]
|
target: [x86_64-unknown-linux-musl, aarch64-apple-darwin, x86_64-apple-darwin]
|
||||||
include:
|
include:
|
||||||
- os: macos-13
|
- target: x86_64-unknown-linux-musl
|
||||||
arch: x64
|
type: musl
|
||||||
- os: macos-14
|
runner: ubuntu-24.04
|
||||||
arch: arm64
|
- target: aarch64-apple-darwin
|
||||||
if: ${{ needs.tag.outputs.TAG == 'new' }}
|
type: native
|
||||||
runs-on: ${{ matrix.os }}
|
runner: macos-14
|
||||||
name: build-macos
|
- target: x86_64-apple-darwin
|
||||||
needs: [tag]
|
type: native
|
||||||
|
runner: macos-13
|
||||||
|
if: ${{ needs.check-version-changed.outputs.TAG == 'new' }}
|
||||||
|
runs-on: ${{ matrix.runner }}
|
||||||
|
needs: [check-version-changed]
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
- name: get llvm
|
|
||||||
uses: ./.github/actions/get-llvm
|
|
||||||
with:
|
|
||||||
releasePrefix: llvm-
|
|
||||||
artifactArch: macos-${{ matrix.arch }}
|
|
||||||
dir: ./
|
|
||||||
|
|
||||||
- uses: actions-rust-lang/setup-rust-toolchain@v1
|
- uses: actions-rust-lang/setup-rust-toolchain@v1
|
||||||
with:
|
with:
|
||||||
toolchain: stable
|
# without this it will override our rust flags
|
||||||
components: rust-src
|
|
||||||
target: wasm32-unknown-emscripten
|
|
||||||
rustflags: ""
|
rustflags: ""
|
||||||
|
cache-key: ${{ matrix.target }}
|
||||||
|
|
||||||
- name: install macos deps
|
- name: Download LLVM
|
||||||
run: |
|
uses: ./.github/actions/get-llvm
|
||||||
brew install ninja
|
with:
|
||||||
|
target: ${{ matrix.target }}
|
||||||
|
|
||||||
- name: versions
|
- name: Build
|
||||||
|
if: ${{ matrix.type == 'native' }}
|
||||||
run: |
|
run: |
|
||||||
rustup show
|
export LLVM_SYS_181_PREFIX=$PWD/llvm-${{ matrix.target }}
|
||||||
cargo --version
|
|
||||||
cmake --version
|
|
||||||
echo "bash:" && bash --version
|
|
||||||
echo "ninja:" && ninja --version
|
|
||||||
echo "clang:" && clang --version
|
|
||||||
|
|
||||||
- name: build revive
|
|
||||||
run: |
|
|
||||||
export LLVM_SYS_181_PREFIX=$PWD/target-llvm/gnu/target-final
|
|
||||||
make install-bin
|
make install-bin
|
||||||
cp ./target/release/resolc ./target/release/resolc-${{ matrix.arch }}
|
mv target/release/resolc resolc-${{ matrix.target }}
|
||||||
|
|
||||||
- name: check revive
|
- name: Build
|
||||||
|
if: ${{ matrix.type == 'musl' }}
|
||||||
run: |
|
run: |
|
||||||
mkdir solc
|
|
||||||
curl -sSLo solc/solc https://github.com/ethereum/solidity/releases/download/v0.8.28/solc-macos
|
|
||||||
chmod +x solc/solc
|
|
||||||
PATH=$PWD/solc:$PATH
|
|
||||||
result=$(./target/release/resolc-${{ matrix.arch }} --bin crates/integration/contracts/flipper.sol)
|
|
||||||
echo $result
|
|
||||||
if [[ $result == *'0x50564d'* ]]; then exit 0; else exit 1; fi
|
|
||||||
|
|
||||||
- uses: actions/upload-artifact@v4
|
|
||||||
with:
|
|
||||||
name: "revive-macos-${{ matrix.arch }}"
|
|
||||||
path: |
|
|
||||||
./target/release/resolc-${{ matrix.arch }}
|
|
||||||
retention-days: 1
|
|
||||||
|
|
||||||
macos-universal-binary:
|
|
||||||
runs-on: macos-14
|
|
||||||
needs: [build-macos]
|
|
||||||
steps:
|
|
||||||
- uses: actions/download-artifact@v4
|
|
||||||
with:
|
|
||||||
pattern: revive-macos-*
|
|
||||||
path: revive-macos
|
|
||||||
|
|
||||||
- name: run lipo
|
|
||||||
run: |
|
|
||||||
lipo revive-macos/revive-macos-arm64/resolc-arm64 revive-macos/revive-macos-x64/resolc-x64 -create -output resolc-macos
|
|
||||||
chmod +x resolc-macos
|
|
||||||
|
|
||||||
- name: compress macos artifact
|
|
||||||
run: |
|
|
||||||
tar -czf resolc-macos.tar.gz ./resolc-macos
|
|
||||||
|
|
||||||
- uses: actions/upload-artifact@v4
|
|
||||||
with:
|
|
||||||
name: resolc-macos.tar.gz
|
|
||||||
path: |
|
|
||||||
resolc-macos.tar.gz
|
|
||||||
retention-days: 1
|
|
||||||
|
|
||||||
build-linux-all:
|
|
||||||
if: ${{ needs.tag.outputs.TAG == 'new' }}
|
|
||||||
runs-on: parity-large
|
|
||||||
needs: [tag]
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v4
|
|
||||||
|
|
||||||
- name: install linux deps
|
|
||||||
run: |
|
|
||||||
sudo apt-get update && sudo apt-get install -y cmake ninja-build \
|
|
||||||
curl git libssl-dev pkg-config clang lld musl
|
|
||||||
|
|
||||||
- uses: actions-rust-lang/setup-rust-toolchain@v1
|
|
||||||
with:
|
|
||||||
toolchain: stable
|
|
||||||
components: rust-src
|
|
||||||
target: wasm32-unknown-emscripten
|
|
||||||
rustflags: ""
|
|
||||||
|
|
||||||
- name: versions
|
|
||||||
run: |
|
|
||||||
rustup show
|
|
||||||
cargo --version
|
|
||||||
cmake --version
|
|
||||||
echo "bash:" && bash --version
|
|
||||||
echo "ninja:" && ninja --version
|
|
||||||
echo "clang:" && clang --version
|
|
||||||
|
|
||||||
- name: get llvm musl
|
|
||||||
uses: ./.github/actions/get-llvm
|
|
||||||
with:
|
|
||||||
releasePrefix: llvm-
|
|
||||||
artifactArch: x86_64-linux-musl
|
|
||||||
dir: ./
|
|
||||||
|
|
||||||
# Build revive
|
|
||||||
|
|
||||||
- name: build musl
|
|
||||||
run: |
|
|
||||||
mkdir resolc-out
|
|
||||||
docker run -v $PWD:/opt/revive $RUST_MUSL_CROSS_IMAGE /bin/bash -c "
|
docker run -v $PWD:/opt/revive $RUST_MUSL_CROSS_IMAGE /bin/bash -c "
|
||||||
cd /opt/revive
|
cd /opt/revive
|
||||||
|
chown -R root:root .
|
||||||
apt update && apt upgrade -y && apt install -y pkg-config
|
apt update && apt upgrade -y && apt install -y pkg-config
|
||||||
export LLVM_SYS_181_PREFIX=/opt/revive/target-llvm/musl/target-final
|
export LLVM_SYS_181_PREFIX=/opt/revive/llvm-${{ matrix.target }}
|
||||||
make install-bin
|
make install-bin
|
||||||
cp /root/.cargo/bin/resolc /opt/revive/resolc-out/resolc-static-linux
|
mv target/${{ matrix.target }}/release/resolc resolc-${{ matrix.target }}
|
||||||
"
|
"
|
||||||
|
sudo chown -R $(id -u):$(id -g) .
|
||||||
|
|
||||||
- name: check musl
|
- name: Install Solc
|
||||||
|
uses: ./.github/actions/get-solc
|
||||||
|
|
||||||
|
- name: Basic Sanity Check
|
||||||
run: |
|
run: |
|
||||||
mkdir solc
|
result=$(./resolc-${{ matrix.target }} --bin crates/integration/contracts/flipper.sol)
|
||||||
curl -sSLo solc/solc https://github.com/ethereum/solidity/releases/download/v0.8.28/solc-static-linux
|
|
||||||
chmod +x solc/solc
|
|
||||||
PATH=$PWD/solc:$PATH
|
|
||||||
result=$(./resolc-out/resolc-static-linux --bin crates/integration/contracts/flipper.sol)
|
|
||||||
echo $result
|
echo $result
|
||||||
if [[ $result == *'0x50564d'* ]]; then exit 0; else exit 1; fi
|
if [[ $result == *'0x50564d'* ]]; then exit 0; else exit 1; fi
|
||||||
|
|
||||||
- name: compress musl artifact
|
|
||||||
run: |
|
|
||||||
tar -czf $(pwd)/resolc-static-linux.tar.gz -C ./resolc-out resolc-static-linux
|
|
||||||
|
|
||||||
- uses: actions/upload-artifact@v4
|
- uses: actions/upload-artifact@v4
|
||||||
with:
|
with:
|
||||||
name: resolc-static-linux.tar.gz
|
name: resolc-${{ matrix.target }}
|
||||||
path: |
|
path: resolc-${{ matrix.target }}
|
||||||
resolc-static-linux.tar.gz
|
|
||||||
retention-days: 1
|
retention-days: 1
|
||||||
|
|
||||||
|
build-wasm:
|
||||||
|
if: ${{ needs.check-version-changed.outputs.TAG == 'new' }}
|
||||||
|
runs-on: ubuntu-24.04
|
||||||
|
needs: [check-version-changed]
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
- uses: actions-rust-lang/setup-rust-toolchain@v1
|
||||||
|
with:
|
||||||
|
target: wasm32-unknown-emscripten
|
||||||
|
# without this it will override our rust flags
|
||||||
|
rustflags: ""
|
||||||
|
|
||||||
|
- name: Download Host LLVM
|
||||||
|
uses: ./.github/actions/get-llvm
|
||||||
|
with:
|
||||||
|
target: x86_64-unknown-linux-gnu
|
||||||
|
|
||||||
|
- name: Download Wasm LLVM
|
||||||
|
uses: ./.github/actions/get-llvm
|
||||||
|
with:
|
||||||
|
target: wasm32-unknown-emscripten
|
||||||
|
|
||||||
|
- name: Download EMSDK
|
||||||
|
uses: ./.github/actions/get-emsdk
|
||||||
|
|
||||||
|
- name: Build
|
||||||
|
run: |
|
||||||
|
export LLVM_SYS_181_PREFIX=$PWD/llvm-x86_64-unknown-linux-gnu
|
||||||
|
export REVIVE_LLVM_TARGET_PREFIX=$PWD/llvm-wasm32-unknown-emscripten
|
||||||
|
source emsdk/emsdk_env.sh
|
||||||
|
make install-wasm
|
||||||
|
chmod -x ./target/wasm32-unknown-emscripten/release/resolc.wasm
|
||||||
|
|
||||||
- name: Set Up Node.js
|
- name: Set Up Node.js
|
||||||
uses: actions/setup-node@v3
|
uses: actions/setup-node@v3
|
||||||
with:
|
with:
|
||||||
node-version: "20"
|
node-version: "20"
|
||||||
|
|
||||||
- name: get llvm emscripten
|
- name: Basic Sanity Check
|
||||||
uses: ./.github/actions/get-llvm
|
|
||||||
with:
|
|
||||||
artifactArch: emscripten
|
|
||||||
|
|
||||||
- name: install emsdk
|
|
||||||
uses: ./.github/actions/get-emsdk
|
|
||||||
|
|
||||||
- name: build wasm
|
|
||||||
run: |
|
|
||||||
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
|
|
||||||
rustup target add wasm32-unknown-emscripten
|
|
||||||
make install-wasm
|
|
||||||
chmod -x ./target/wasm32-unknown-emscripten/release/resolc.wasm
|
|
||||||
|
|
||||||
- name: check wasm
|
|
||||||
run: |
|
run: |
|
||||||
|
mkdir -p solc
|
||||||
curl -sSLo solc/soljson.js https://github.com/ethereum/solidity/releases/download/v0.8.28/soljson.js
|
curl -sSLo solc/soljson.js https://github.com/ethereum/solidity/releases/download/v0.8.28/soljson.js
|
||||||
node -e "
|
node -e "
|
||||||
const soljson = require('solc/soljson');
|
const soljson = require('solc/soljson');
|
||||||
@@ -281,44 +200,41 @@ jobs:
|
|||||||
if(!bytecode.startsWith('50564d')) { process.exit(1); }
|
if(!bytecode.startsWith('50564d')) { process.exit(1); }
|
||||||
"
|
"
|
||||||
|
|
||||||
- name: compress wasm artifact
|
- name: Compress Artifact
|
||||||
run: |
|
run: |
|
||||||
tar -czf $(pwd)/resolc-wasm.tar.gz -C ./target/wasm32-unknown-emscripten/release/ \
|
tar -czf $(pwd)/resolc-wasm32-unknown-emscripten.tar.gz -C ./target/wasm32-unknown-emscripten/release/ \
|
||||||
resolc.js \
|
resolc.js \
|
||||||
resolc.wasm \
|
resolc.wasm \
|
||||||
resolc_web.js
|
resolc_web.js
|
||||||
|
|
||||||
- uses: actions/upload-artifact@v4
|
- uses: actions/upload-artifact@v4
|
||||||
with:
|
with:
|
||||||
name: resolc-wasm.tar.gz
|
name: resolc-wasm32-unknown-emscripten.tar.gz
|
||||||
path: |
|
path: resolc-wasm32-unknown-emscripten.tar.gz
|
||||||
resolc-wasm.tar.gz
|
|
||||||
retention-days: 1
|
retention-days: 1
|
||||||
|
|
||||||
create-release:
|
create-release:
|
||||||
if: github.event_name != 'pull_request'
|
if: github.event_name != 'pull_request'
|
||||||
needs: [tag, build-linux-all, macos-universal-binary]
|
needs: [check-version-changed, build-wasm]
|
||||||
runs-on: ubuntu-24.04
|
runs-on: macos-14
|
||||||
permissions:
|
permissions:
|
||||||
contents: write
|
contents: write
|
||||||
steps:
|
steps:
|
||||||
- name: Download revive-wasm
|
- name: Download Artifacts
|
||||||
uses: actions/download-artifact@v4
|
uses: actions/download-artifact@v4
|
||||||
with:
|
with:
|
||||||
name: resolc-wasm.tar.gz
|
merge-multiple: true
|
||||||
path: resolc-wasm/
|
|
||||||
|
|
||||||
- name: Download revive-linux
|
- name: Create macOS Fat Binary
|
||||||
uses: actions/download-artifact@v4
|
run: |
|
||||||
with:
|
lipo resolc-aarch64-apple-darwin resolc-x86_64-apple-darwin -create -output resolc-universal-apple-darwin
|
||||||
name: resolc-static-linux.tar.gz
|
|
||||||
path: resolc-linux/
|
|
||||||
|
|
||||||
- name: Download revive-macos
|
- name: Compress Artifacts
|
||||||
uses: actions/download-artifact@v4
|
run: |
|
||||||
with:
|
chmod +x resolc-x86_64-unknown-linux-musl
|
||||||
name: resolc-macos.tar.gz
|
chmod +x resolc-universal-apple-darwin
|
||||||
path: resolc-macos/
|
tar -czf resolc-x86_64-unknown-linux-musl.tar.gz resolc-x86_64-unknown-linux-musl
|
||||||
|
tar -czf resolc-universal-apple-darwin.tar.gz resolc-universal-apple-darwin
|
||||||
|
|
||||||
- name: create-release
|
- name: create-release
|
||||||
uses: softprops/action-gh-release@v2
|
uses: softprops/action-gh-release@v2
|
||||||
@@ -328,12 +244,11 @@ jobs:
|
|||||||
|
|
||||||
# Note for macOS Users
|
# Note for macOS Users
|
||||||
The macOS binary is unsigned and it needs to be made runnable using `xattr -c resolc-macos`.
|
The macOS binary is unsigned and it needs to be made runnable using `xattr -c resolc-macos`.
|
||||||
tag_name: ${{ needs.tag.outputs.PKG_VER }}
|
tag_name: ${{ needs.check-version-changed.outputs.PKG_VER }}
|
||||||
name: ${{ needs.tag.outputs.PKG_VER }}
|
name: ${{ needs.check-version-changed.outputs.PKG_VER }}
|
||||||
draft: true
|
draft: true
|
||||||
target_commitish: ${{ github.sha }}
|
target_commitish: ${{ github.sha }}
|
||||||
files: |
|
files: |
|
||||||
./resolc-linux/resolc-static-linux.tar.gz
|
resolc-x86_64-unknown-linux-musl.tar.gz
|
||||||
./resolc-macos/resolc-macos.tar.gz
|
resolc-universal-apple-darwin.tar.gz
|
||||||
./resolc-wasm/resolc-wasm.tar.gz
|
resolc-wasm32-unknown-emscripten.tar.gz
|
||||||
|
|
||||||
|
|||||||
@@ -1,43 +1,45 @@
|
|||||||
|
name: Test LLVM Builder
|
||||||
on:
|
on:
|
||||||
pull_request:
|
pull_request:
|
||||||
types: [assigned, opened, synchronize, reopened]
|
branches: ["main"]
|
||||||
|
types: [opened, synchronize]
|
||||||
paths:
|
paths:
|
||||||
- 'LLVM.lock'
|
- 'LLVM.lock'
|
||||||
- 'crates/llvm-builder/**'
|
- 'crates/llvm-builder/**'
|
||||||
- '.github/workflows/revive-llvm-test.yml'
|
- '.github/workflows/test-llvm-builder.yml'
|
||||||
|
|
||||||
|
concurrency:
|
||||||
|
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
|
||||||
|
cancel-in-progress: true
|
||||||
|
|
||||||
|
env:
|
||||||
|
CARGO_TERM_COLOR: always
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
test:
|
test:
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
runner: [parity-large, macos-14, macos-13]
|
runner: [parity-large, macos-14, windows-2022]
|
||||||
runs-on: ${{ matrix.runner }}
|
runs-on: ${{ matrix.runner }}
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- 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.runner }}
|
||||||
|
|
||||||
- name: Install apt dependencies
|
- name: Install Dependencies
|
||||||
if: matrix.runner == 'parity-large'
|
if: matrix.runner == 'parity-large'
|
||||||
run: |
|
run: |
|
||||||
sudo apt update && sudo apt-get install -y cmake ninja-build curl git libssl-dev pkg-config clang lld musl
|
sudo apt update && sudo apt-get install -y cmake ninja-build curl git libssl-dev pkg-config clang lld musl
|
||||||
|
|
||||||
- name: Install macos dependencies
|
- name: Install Dependencies
|
||||||
if: matrix.runner == 'macos-14' || matrix.runner == 'macos-13'
|
if: matrix.runner == 'macos-14'
|
||||||
run: |
|
run: |
|
||||||
brew install ninja
|
brew install ninja
|
||||||
|
|
||||||
- uses: actions-rust-lang/setup-rust-toolchain@v1
|
- name: Test
|
||||||
with:
|
|
||||||
toolchain: stable
|
|
||||||
components: rust-src
|
|
||||||
rustflags: ""
|
|
||||||
|
|
||||||
- run: |
|
|
||||||
rustup show
|
|
||||||
cargo --version
|
|
||||||
cmake --version
|
|
||||||
bash --version
|
|
||||||
|
|
||||||
- name: Test llvm-builder
|
|
||||||
run: make test-llvm-builder
|
run: make test-llvm-builder
|
||||||
env:
|
env:
|
||||||
RUST_LOG: trace
|
RUST_LOG: trace
|
||||||
@@ -1,10 +1,10 @@
|
|||||||
name: Build revive-wasm
|
name: Test Wasm Version
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
branches: ["main"]
|
branches: ["main"]
|
||||||
pull_request:
|
pull_request:
|
||||||
branches: ["main"]
|
branches: ["main"]
|
||||||
workflow_dispatch:
|
types: [opened, synchronize]
|
||||||
|
|
||||||
concurrency:
|
concurrency:
|
||||||
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
|
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
|
||||||
@@ -15,48 +15,38 @@ env:
|
|||||||
REVIVE_WASM_INSTALL_DIR: ${{ github.workspace }}/target/wasm32-unknown-emscripten/release
|
REVIVE_WASM_INSTALL_DIR: ${{ github.workspace }}/target/wasm32-unknown-emscripten/release
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build-revive-wasm:
|
build:
|
||||||
runs-on: ubuntu-24.04
|
runs-on: ubuntu-24.04
|
||||||
defaults:
|
defaults:
|
||||||
run:
|
run:
|
||||||
shell: bash
|
shell: bash
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
|
- uses: actions-rust-lang/setup-rust-toolchain@v1
|
||||||
- name: Install Rust stable toolchain
|
|
||||||
uses: actions-rust-lang/setup-rust-toolchain@v1
|
|
||||||
with:
|
with:
|
||||||
toolchain: stable
|
|
||||||
components: rust-src
|
|
||||||
target: wasm32-unknown-emscripten
|
target: wasm32-unknown-emscripten
|
||||||
|
# without this it will override our rust flags
|
||||||
rustflags: ""
|
rustflags: ""
|
||||||
|
|
||||||
- name: get llvm gnu
|
- name: Download Host LLVM
|
||||||
uses: ./.github/actions/get-llvm
|
uses: ./.github/actions/get-llvm
|
||||||
with:
|
with:
|
||||||
artifactArch: x86_64-linux-gnu
|
target: x86_64-unknown-linux-gnu
|
||||||
- name: get llvm emscripten
|
|
||||||
uses: ./.github/actions/get-llvm
|
|
||||||
with:
|
|
||||||
artifactArch: emscripten
|
|
||||||
|
|
||||||
- name: install emsdk
|
- name: Download Wasm LLVM
|
||||||
|
uses: ./.github/actions/get-llvm
|
||||||
|
with:
|
||||||
|
target: wasm32-unknown-emscripten
|
||||||
|
|
||||||
|
- name: Install emsdk
|
||||||
uses: ./.github/actions/get-emsdk
|
uses: ./.github/actions/get-emsdk
|
||||||
|
|
||||||
- name: Setup revive environment variables
|
- name: Set LLVM Environment Variables
|
||||||
run: |
|
run: |
|
||||||
echo "LLVM_SYS_181_PREFIX=$(pwd)/target-llvm/gnu/target-final" >> $GITHUB_ENV
|
echo "LLVM_SYS_181_PREFIX=$(pwd)/llvm-x86_64-unknown-linux-gnu" >> $GITHUB_ENV
|
||||||
echo "REVIVE_LLVM_TARGET_PREFIX=$(pwd)/target-llvm/emscripten/target-final" >> $GITHUB_ENV
|
echo "REVIVE_LLVM_TARGET_PREFIX=$(pwd)/llvm-wasm32-unknown-emscripten" >> $GITHUB_ENV
|
||||||
|
|
||||||
- run: |
|
- name: Build Revive
|
||||||
rustup show
|
|
||||||
cargo --version
|
|
||||||
rustup +nightly show
|
|
||||||
cargo +nightly --version
|
|
||||||
cmake --version
|
|
||||||
bash --version
|
|
||||||
|
|
||||||
- name: Build revive
|
|
||||||
run: |
|
run: |
|
||||||
source emsdk/emsdk_env.sh
|
source emsdk/emsdk_env.sh
|
||||||
make install-wasm
|
make install-wasm
|
||||||
@@ -70,8 +60,8 @@ jobs:
|
|||||||
${{ env.REVIVE_WASM_INSTALL_DIR }}/resolc_web.js
|
${{ env.REVIVE_WASM_INSTALL_DIR }}/resolc_web.js
|
||||||
retention-days: 1
|
retention-days: 1
|
||||||
|
|
||||||
test-revive-wasm:
|
test:
|
||||||
needs: build-revive-wasm
|
needs: build
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
os: ["ubuntu-24.04", "macos-14", "windows-2022"]
|
os: ["ubuntu-24.04", "macos-14", "windows-2022"]
|
||||||
@@ -93,7 +83,7 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
node-version: "20"
|
node-version: "20"
|
||||||
|
|
||||||
- name: Install packages
|
- name: Install Node Packages
|
||||||
run: npm install
|
run: npm install
|
||||||
|
|
||||||
- name: Run Playwright tests
|
- name: Run Playwright tests
|
||||||
@@ -1,10 +1,10 @@
|
|||||||
name: Build
|
name: Test
|
||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
branches: ["main"]
|
branches: ["main"]
|
||||||
pull_request:
|
pull_request:
|
||||||
branches: ["main"]
|
branches: ["main"]
|
||||||
|
types: [opened, synchronize]
|
||||||
|
|
||||||
concurrency:
|
concurrency:
|
||||||
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
|
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
|
||||||
@@ -14,27 +14,28 @@ env:
|
|||||||
CARGO_TERM_COLOR: always
|
CARGO_TERM_COLOR: always
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build-ubuntu-x86:
|
test:
|
||||||
runs-on: ubuntu-24.04
|
runs-on: ubuntu-24.04
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
|
- uses: actions-rust-lang/setup-rust-toolchain@v1
|
||||||
|
with:
|
||||||
|
# without this it will override our rust flags
|
||||||
|
rustflags: ""
|
||||||
|
|
||||||
- name: Install solc
|
- name: Install Solc
|
||||||
|
uses: ./.github/actions/get-solc
|
||||||
|
|
||||||
|
- name: Download LLVM
|
||||||
|
uses: ./.github/actions/get-llvm
|
||||||
|
with:
|
||||||
|
target: x86_64-unknown-linux-gnu
|
||||||
|
|
||||||
|
- name: Set LLVM Environment Variables
|
||||||
run: |
|
run: |
|
||||||
mkdir -p solc
|
echo "LLVM_SYS_181_PREFIX=$(pwd)/llvm-x86_64-unknown-linux-gnu" >> $GITHUB_ENV
|
||||||
curl -sSL --output solc/solc https://github.com/ethereum/solidity/releases/download/v0.8.28/solc-static-linux
|
|
||||||
chmod +x solc/solc
|
|
||||||
echo "$(pwd)/solc/" >> $GITHUB_PATH
|
|
||||||
|
|
||||||
- name: Install LLVM
|
- name: Install Geth
|
||||||
run: |
|
|
||||||
curl -sSL --output llvm.tar.xz https://github.com/paritytech/revive/releases/download/v0.1.0-dev.7/clang+llvm-18.1.8-x86_64-linux-gnu-ubuntu-24.04.tar.xz
|
|
||||||
mkdir llvm18
|
|
||||||
tar Jxf llvm.tar.xz -C llvm18/
|
|
||||||
echo "LLVM_SYS_181_PREFIX=$(pwd)/llvm18" >> $GITHUB_ENV
|
|
||||||
|
|
||||||
- name: Install geth
|
|
||||||
run: |
|
run: |
|
||||||
sudo add-apt-repository -y ppa:ethereum/ethereum
|
sudo add-apt-repository -y ppa:ethereum/ethereum
|
||||||
sudo apt update
|
sudo apt update
|
||||||
@@ -56,9 +57,3 @@ jobs:
|
|||||||
|
|
||||||
- name: Test CLI
|
- name: Test CLI
|
||||||
run: make test-cli
|
run: make test-cli
|
||||||
|
|
||||||
- uses: actions/upload-artifact@v4
|
|
||||||
with:
|
|
||||||
name: ${{ github.job }}-resolc
|
|
||||||
path: ./target/release/resolc
|
|
||||||
retention-days: 1
|
|
||||||
Generated
+1
@@ -8357,6 +8357,7 @@ dependencies = [
|
|||||||
"serde",
|
"serde",
|
||||||
"tar",
|
"tar",
|
||||||
"toml 0.8.20",
|
"toml 0.8.20",
|
||||||
|
"which",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
|
|||||||
@@ -32,6 +32,7 @@ tar = { workspace = true }
|
|||||||
flate2 = { workspace = true }
|
flate2 = { workspace = true }
|
||||||
env_logger = { workspace = true }
|
env_logger = { workspace = true }
|
||||||
log = { workspace = true }
|
log = { workspace = true }
|
||||||
|
which = { workspace = true }
|
||||||
|
|
||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
assert_cmd = { workspace = true }
|
assert_cmd = { workspace = true }
|
||||||
|
|||||||
@@ -1,5 +1,8 @@
|
|||||||
//! Utilities for compiling the LLVM compiler-rt builtins.
|
//! Utilities for compiling the LLVM compiler-rt builtins.
|
||||||
|
|
||||||
|
use crate::utils::path_windows_to_unix as to_unix;
|
||||||
|
use std::{env::consts::EXE_EXTENSION, process::Command};
|
||||||
|
|
||||||
/// Static CFLAGS variable passed to the compiler building the compiler-rt builtins.
|
/// Static CFLAGS variable passed to the compiler building the compiler-rt builtins.
|
||||||
const C_FLAGS: [&str; 6] = [
|
const C_FLAGS: [&str; 6] = [
|
||||||
"--target=riscv64",
|
"--target=riscv64",
|
||||||
@@ -44,24 +47,31 @@ fn cmake_dynamic_args(
|
|||||||
|
|
||||||
let mut clang_path = llvm_target_host.to_path_buf();
|
let mut clang_path = llvm_target_host.to_path_buf();
|
||||||
clang_path.push("bin/clang");
|
clang_path.push("bin/clang");
|
||||||
|
clang_path.set_extension(EXE_EXTENSION);
|
||||||
|
|
||||||
let mut clangxx_path = llvm_target_host.to_path_buf();
|
let mut clangxx_path = llvm_target_host.to_path_buf();
|
||||||
clangxx_path.push("bin/clang++");
|
clangxx_path.push("bin/clang++");
|
||||||
|
clangxx_path.set_extension(EXE_EXTENSION);
|
||||||
|
|
||||||
let mut llvm_config_path = llvm_target_host.to_path_buf();
|
let mut llvm_config_path = llvm_target_host.to_path_buf();
|
||||||
llvm_config_path.push("bin/llvm-config");
|
llvm_config_path.push("bin/llvm-config");
|
||||||
|
llvm_config_path.set_extension(EXE_EXTENSION);
|
||||||
|
|
||||||
let mut ar_path = llvm_target_host.to_path_buf();
|
let mut ar_path = llvm_target_host.to_path_buf();
|
||||||
ar_path.push("bin/llvm-ar");
|
ar_path.push("bin/llvm-ar");
|
||||||
|
ar_path.set_extension(EXE_EXTENSION);
|
||||||
|
|
||||||
let mut nm_path = llvm_target_host.to_path_buf();
|
let mut nm_path = llvm_target_host.to_path_buf();
|
||||||
nm_path.push("bin/llvm-nm");
|
nm_path.push("bin/llvm-nm");
|
||||||
|
nm_path.set_extension(EXE_EXTENSION);
|
||||||
|
|
||||||
let mut ranlib_path = llvm_target_host.to_path_buf();
|
let mut ranlib_path = llvm_target_host.to_path_buf();
|
||||||
ranlib_path.push("bin/llvm-ranlib");
|
ranlib_path.push("bin/llvm-ranlib");
|
||||||
|
ranlib_path.set_extension(EXE_EXTENSION);
|
||||||
|
|
||||||
let mut linker_path = llvm_target_host.to_path_buf();
|
let mut linker_path = llvm_target_host.to_path_buf();
|
||||||
linker_path.push("bin/ld.lld");
|
linker_path.push("bin/ld.lld");
|
||||||
|
linker_path.set_extension(EXE_EXTENSION);
|
||||||
|
|
||||||
Ok([
|
Ok([
|
||||||
format!(
|
format!(
|
||||||
@@ -76,12 +86,18 @@ fn cmake_dynamic_args(
|
|||||||
format!("-DCMAKE_C_FLAGS='{}'", C_FLAGS.join(" ")),
|
format!("-DCMAKE_C_FLAGS='{}'", C_FLAGS.join(" ")),
|
||||||
format!("-DCMAKE_ASM_FLAGS='{}'", C_FLAGS.join(" ")),
|
format!("-DCMAKE_ASM_FLAGS='{}'", C_FLAGS.join(" ")),
|
||||||
format!("-DCMAKE_CXX_FLAGS='{}'", C_FLAGS.join(" ")),
|
format!("-DCMAKE_CXX_FLAGS='{}'", C_FLAGS.join(" ")),
|
||||||
format!("-DCMAKE_C_COMPILER='{}'", clang_path.to_string_lossy()),
|
format!(
|
||||||
format!("-DCMAKE_ASM_COMPILER='{}'", clang_path.to_string_lossy()),
|
"-DCMAKE_C_COMPILER='{}'",
|
||||||
format!("-DCMAKE_CXX_COMPILER='{}'", clangxx_path.to_string_lossy()),
|
to_unix(clang_path.clone())?.display()
|
||||||
format!("-DCMAKE_AR='{}'", ar_path.to_string_lossy()),
|
),
|
||||||
format!("-DCMAKE_NM='{}'", nm_path.to_string_lossy()),
|
format!("-DCMAKE_ASM_COMPILER='{}'", to_unix(clang_path)?.display()),
|
||||||
format!("-DCMAKE_RANLIB='{}'", ranlib_path.to_string_lossy()),
|
format!(
|
||||||
|
"-DCMAKE_CXX_COMPILER='{}'",
|
||||||
|
to_unix(clangxx_path)?.display()
|
||||||
|
),
|
||||||
|
format!("-DCMAKE_AR='{}'", to_unix(ar_path)?.display()),
|
||||||
|
format!("-DCMAKE_NM='{}'", to_unix(nm_path)?.display()),
|
||||||
|
format!("-DCMAKE_RANLIB='{}'", to_unix(ranlib_path)?.display()),
|
||||||
format!(
|
format!(
|
||||||
"-DLLVM_CONFIG_PATH='{}'",
|
"-DLLVM_CONFIG_PATH='{}'",
|
||||||
llvm_config_path.to_string_lossy()
|
llvm_config_path.to_string_lossy()
|
||||||
@@ -101,7 +117,13 @@ pub fn build(
|
|||||||
log::info!("building compiler-rt for rv64emac");
|
log::info!("building compiler-rt for rv64emac");
|
||||||
|
|
||||||
crate::utils::check_presence("cmake")?;
|
crate::utils::check_presence("cmake")?;
|
||||||
crate::utils::check_presence("ninja")?;
|
|
||||||
|
let generator = if cfg!(target_os = "windows") {
|
||||||
|
"Visual Studio 17 2022"
|
||||||
|
} else {
|
||||||
|
crate::utils::check_presence("ninja")?;
|
||||||
|
"Ninja"
|
||||||
|
};
|
||||||
|
|
||||||
let llvm_module_compiler_rt = crate::LLVMPath::llvm_module_compiler_rt()?;
|
let llvm_module_compiler_rt = crate::LLVMPath::llvm_module_compiler_rt()?;
|
||||||
let llvm_compiler_rt_build = crate::LLVMPath::llvm_build_compiler_rt()?;
|
let llvm_compiler_rt_build = crate::LLVMPath::llvm_build_compiler_rt()?;
|
||||||
@@ -114,7 +136,7 @@ pub fn build(
|
|||||||
"-B",
|
"-B",
|
||||||
llvm_compiler_rt_build.to_string_lossy().as_ref(),
|
llvm_compiler_rt_build.to_string_lossy().as_ref(),
|
||||||
"-G",
|
"-G",
|
||||||
"Ninja",
|
generator,
|
||||||
])
|
])
|
||||||
.args(CMAKE_STATIC_ARGS)
|
.args(CMAKE_STATIC_ARGS)
|
||||||
.args(cmake_dynamic_args(build_type, target_env)?)
|
.args(cmake_dynamic_args(build_type, target_env)?)
|
||||||
@@ -131,7 +153,17 @@ pub fn build(
|
|||||||
"LLVM compiler-rt building cmake",
|
"LLVM compiler-rt building cmake",
|
||||||
)?;
|
)?;
|
||||||
|
|
||||||
crate::utils::ninja(&llvm_compiler_rt_build)?;
|
crate::utils::command(
|
||||||
|
Command::new("cmake").args([
|
||||||
|
"--build",
|
||||||
|
llvm_compiler_rt_build.to_string_lossy().as_ref(),
|
||||||
|
"--target",
|
||||||
|
"install",
|
||||||
|
"--config",
|
||||||
|
build_type.to_string().as_str(),
|
||||||
|
]),
|
||||||
|
"Building",
|
||||||
|
)?;
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -214,7 +214,7 @@ pub fn build(
|
|||||||
sanitizer,
|
sanitizer,
|
||||||
)?;
|
)?;
|
||||||
} else if cfg!(target_os = "windows") {
|
} else if cfg!(target_os = "windows") {
|
||||||
platforms::x86_64_windows_gnu::build(
|
platforms::x86_64_windows_msvc::build(
|
||||||
build_type,
|
build_type,
|
||||||
targets,
|
targets,
|
||||||
llvm_projects,
|
llvm_projects,
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ pub mod wasm32_emscripten;
|
|||||||
pub mod x86_64_linux_gnu;
|
pub mod x86_64_linux_gnu;
|
||||||
pub mod x86_64_linux_musl;
|
pub mod x86_64_linux_musl;
|
||||||
pub mod x86_64_macos;
|
pub mod x86_64_macos;
|
||||||
pub mod x86_64_windows_gnu;
|
pub mod x86_64_windows_msvc;
|
||||||
|
|
||||||
use std::str::FromStr;
|
use std::str::FromStr;
|
||||||
|
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ use std::path::Path;
|
|||||||
use std::process::Command;
|
use std::process::Command;
|
||||||
|
|
||||||
/// The build options shared by all platforms.
|
/// The build options shared by all platforms.
|
||||||
pub const SHARED_BUILD_OPTS: [&str; 19] = [
|
pub const SHARED_BUILD_OPTS: [&str; 21] = [
|
||||||
"-DPACKAGE_VENDOR='Parity Technologies'",
|
"-DPACKAGE_VENDOR='Parity Technologies'",
|
||||||
"-DCMAKE_BUILD_WITH_INSTALL_RPATH=1",
|
"-DCMAKE_BUILD_WITH_INSTALL_RPATH=1",
|
||||||
"-DLLVM_BUILD_DOCS='Off'",
|
"-DLLVM_BUILD_DOCS='Off'",
|
||||||
@@ -28,6 +28,8 @@ pub const SHARED_BUILD_OPTS: [&str; 19] = [
|
|||||||
"-DCMAKE_EXPORT_COMPILE_COMMANDS='On'",
|
"-DCMAKE_EXPORT_COMPILE_COMMANDS='On'",
|
||||||
"-DPython3_FIND_REGISTRY='LAST'", // Use Python version from $PATH, not from registry
|
"-DPython3_FIND_REGISTRY='LAST'", // Use Python version from $PATH, not from registry
|
||||||
"-DBUG_REPORT_URL='https://github.com/paritytech/contract-issues/issues/'",
|
"-DBUG_REPORT_URL='https://github.com/paritytech/contract-issues/issues/'",
|
||||||
|
"-DCLANG_ENABLE_ARCMT='Off'",
|
||||||
|
"-DCLANG_ENABLE_STATIC_ANALYZER='Off'",
|
||||||
];
|
];
|
||||||
|
|
||||||
/// The build options shared by all platforms except MUSL.
|
/// The build options shared by all platforms except MUSL.
|
||||||
|
|||||||
+12
-24
@@ -1,7 +1,6 @@
|
|||||||
//! The revive LLVM amd64 `windows-gnu` builder.
|
//! The revive LLVM amd64 `windows-gnu` builder.
|
||||||
|
|
||||||
use std::collections::HashSet;
|
use std::collections::HashSet;
|
||||||
use std::path::PathBuf;
|
|
||||||
use std::process::Command;
|
use std::process::Command;
|
||||||
|
|
||||||
use crate::build_type::BuildType;
|
use crate::build_type::BuildType;
|
||||||
@@ -28,10 +27,6 @@ pub fn build(
|
|||||||
sanitizer: Option<Sanitizer>,
|
sanitizer: Option<Sanitizer>,
|
||||||
) -> anyhow::Result<()> {
|
) -> anyhow::Result<()> {
|
||||||
crate::utils::check_presence("cmake")?;
|
crate::utils::check_presence("cmake")?;
|
||||||
crate::utils::check_presence("clang")?;
|
|
||||||
crate::utils::check_presence("clang++")?;
|
|
||||||
crate::utils::check_presence("lld")?;
|
|
||||||
crate::utils::check_presence("ninja")?;
|
|
||||||
|
|
||||||
let llvm_module_llvm =
|
let llvm_module_llvm =
|
||||||
LLVMPath::llvm_module_llvm().and_then(crate::utils::path_windows_to_unix)?;
|
LLVMPath::llvm_module_llvm().and_then(crate::utils::path_windows_to_unix)?;
|
||||||
@@ -48,15 +43,12 @@ pub fn build(
|
|||||||
"-B",
|
"-B",
|
||||||
llvm_build_final.to_string_lossy().as_ref(),
|
llvm_build_final.to_string_lossy().as_ref(),
|
||||||
"-G",
|
"-G",
|
||||||
"Ninja",
|
"Visual Studio 17 2022",
|
||||||
format!(
|
format!(
|
||||||
"-DCMAKE_INSTALL_PREFIX='{}'",
|
"-DCMAKE_INSTALL_PREFIX='{}'",
|
||||||
llvm_target_final.to_string_lossy().as_ref(),
|
llvm_target_final.to_string_lossy().as_ref(),
|
||||||
)
|
)
|
||||||
.as_str(),
|
.as_str(),
|
||||||
format!("-DCMAKE_BUILD_TYPE='{build_type}'").as_str(),
|
|
||||||
"-DCMAKE_C_COMPILER='clang'",
|
|
||||||
"-DCMAKE_CXX_COMPILER='clang++'",
|
|
||||||
format!(
|
format!(
|
||||||
"-DLLVM_TARGETS_TO_BUILD='{}'",
|
"-DLLVM_TARGETS_TO_BUILD='{}'",
|
||||||
targets
|
targets
|
||||||
@@ -75,7 +67,7 @@ pub fn build(
|
|||||||
.join(";")
|
.join(";")
|
||||||
)
|
)
|
||||||
.as_str(),
|
.as_str(),
|
||||||
"-DLLVM_USE_LINKER='lld'",
|
"-DLLVM_BUILD_LLVM_C_DYLIB=Off",
|
||||||
])
|
])
|
||||||
.args(crate::platforms::shared::shared_build_opts_default_target(
|
.args(crate::platforms::shared::shared_build_opts_default_target(
|
||||||
default_target,
|
default_target,
|
||||||
@@ -107,20 +99,16 @@ pub fn build(
|
|||||||
"LLVM building cmake",
|
"LLVM building cmake",
|
||||||
)?;
|
)?;
|
||||||
|
|
||||||
crate::utils::ninja(llvm_build_final.as_ref())?;
|
crate::utils::command(
|
||||||
|
Command::new("cmake").args([
|
||||||
let libstdcpp_source_path = match std::env::var("LIBSTDCPP_SOURCE_PATH") {
|
"--build",
|
||||||
Ok(libstdcpp_source_path) => PathBuf::from(libstdcpp_source_path),
|
llvm_build_final.to_string_lossy().as_ref(),
|
||||||
Err(error) => anyhow::bail!(
|
"--target",
|
||||||
"The `LIBSTDCPP_SOURCE_PATH` must be set to the path to the libstdc++.a static library: {}", error
|
"install",
|
||||||
),
|
"--config",
|
||||||
};
|
build_type.to_string().as_str(),
|
||||||
let mut libstdcpp_destination_path = llvm_target_final;
|
]),
|
||||||
libstdcpp_destination_path.push("./lib/libstdc++.a");
|
"Building with msbuild",
|
||||||
fs_extra::file::copy(
|
|
||||||
crate::utils::path_windows_to_unix(libstdcpp_source_path)?,
|
|
||||||
crate::utils::path_windows_to_unix(libstdcpp_destination_path)?,
|
|
||||||
&fs_extra::file::CopyOptions::default(),
|
|
||||||
)?;
|
)?;
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
@@ -7,6 +7,7 @@ use std::process::Command;
|
|||||||
use std::process::Stdio;
|
use std::process::Stdio;
|
||||||
use std::time::Duration;
|
use std::time::Duration;
|
||||||
|
|
||||||
|
use anyhow::Context;
|
||||||
use path_slash::PathBufExt;
|
use path_slash::PathBufExt;
|
||||||
|
|
||||||
/// The LLVM host repository URL.
|
/// The LLVM host repository URL.
|
||||||
@@ -131,11 +132,8 @@ pub fn path_windows_to_unix<P: AsRef<Path> + PathBufExt>(path: P) -> anyhow::Res
|
|||||||
|
|
||||||
/// Checks if the tool exists in the system.
|
/// Checks if the tool exists in the system.
|
||||||
pub fn check_presence(name: &str) -> anyhow::Result<()> {
|
pub fn check_presence(name: &str) -> anyhow::Result<()> {
|
||||||
let description = &format!("checking the `{name}` executable");
|
which::which(name).with_context(|| format!("Tool `{name}` is missing. Please install"))?;
|
||||||
log::info!("{description}");
|
Ok(())
|
||||||
|
|
||||||
command(Command::new("which").arg(name), description)
|
|
||||||
.map_err(|_| anyhow::anyhow!("Tool `{}` is missing. Please install", name))
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Identify XCode version using `pkgutil`.
|
/// Identify XCode version using `pkgutil`.
|
||||||
|
|||||||
Reference in New Issue
Block a user