mirror of
https://github.com/pezkuwichain/revive.git
synced 2026-06-14 22:41:07 +00:00
Compare commits
8 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 66f9a4d64f | |||
| 76f4cf71d6 | |||
| 77e0344d80 | |||
| 2fb8beee62 | |||
| 93788e72e9 | |||
| 296a226d0b | |||
| 84deb3a29d | |||
| ee064671e0 |
@@ -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: |
|
||||||
@@ -17,4 +16,4 @@ runs:
|
|||||||
cd emsdk
|
cd emsdk
|
||||||
git checkout tags/${{ inputs.version }}
|
git checkout tags/${{ inputs.version }}
|
||||||
./emsdk install ${{ inputs.version }}
|
./emsdk install ${{ inputs.version }}
|
||||||
./emsdk activate ${{ inputs.version }}
|
./emsdk activate ${{ inputs.version }}
|
||||||
|
|||||||
@@ -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,35 @@
|
|||||||
|
name: "Install Solidity Compiler"
|
||||||
|
|
||||||
|
runs:
|
||||||
|
using: "composite"
|
||||||
|
steps:
|
||||||
|
- 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: |
|
||||||
|
mkdir -p solc
|
||||||
|
curl -sSL --output solc/solc https://github.com/ethereum/solidity/releases/download/v0.8.28/${SOLC_NAME}
|
||||||
|
|
||||||
|
- name: Make Solc Executable
|
||||||
|
if: ${{ runner.os == 'Windows' }}
|
||||||
|
shell: bash
|
||||||
|
run: |
|
||||||
|
echo "$(pwd -W)\\solc" >> $GITHUB_PATH
|
||||||
|
mv solc/solc solc/solc.exe
|
||||||
|
|
||||||
|
- name: Make Solc Executable
|
||||||
|
if: ${{ runner.os != 'Windows' }}
|
||||||
|
shell: bash
|
||||||
|
run: |
|
||||||
|
echo "$(pwd)/solc" >> $GITHUB_PATH
|
||||||
|
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
|
|
||||||
|
|||||||
+120
-191
@@ -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,188 +59,117 @@ 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, x86_64-pc-windows-msvc]
|
||||||
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
|
||||||
|
- target: x86_64-pc-windows-msvc
|
||||||
|
type: native
|
||||||
|
runner: windows-2022
|
||||||
|
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' }}
|
||||||
|
shell: bash
|
||||||
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 }} || mv target/release/resolc.exe resolc-${{ matrix.target }}.exe
|
||||||
|
|
||||||
- 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
|
|
||||||
|
|
||||||
- name: compress macos artifact
|
|
||||||
run: |
|
|
||||||
tar -czf resolc-macos.tar.gz ./resolc-macos
|
|
||||||
|
|
||||||
- uses: actions/upload-artifact@v4
|
|
||||||
with:
|
|
||||||
name: revive-macos
|
|
||||||
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
|
||||||
|
shell: bash
|
||||||
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 --strip-components 1 -czf resolc-static-linux.tar.gz ./resolc-out/resolc-static-linux
|
|
||||||
|
|
||||||
- uses: actions/upload-artifact@v4
|
- uses: actions/upload-artifact@v4
|
||||||
with:
|
with:
|
||||||
name: revive-linux
|
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
|
|
||||||
|
|
||||||
- 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');
|
||||||
@@ -279,55 +205,58 @@ 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 --strip-components 3 -czf resolc-wasm.tar.gz \
|
tar -czf $(pwd)/resolc-wasm32-unknown-emscripten.tar.gz -C ./target/wasm32-unknown-emscripten/release/ \
|
||||||
./target/wasm32-unknown-emscripten/release/resolc.js \
|
resolc.js \
|
||||||
./target/wasm32-unknown-emscripten/release/resolc.wasm \
|
resolc.wasm \
|
||||||
./target/wasm32-unknown-emscripten/release/resolc_web.js
|
resolc_web.js
|
||||||
|
|
||||||
- uses: actions/upload-artifact@v4
|
- uses: actions/upload-artifact@v4
|
||||||
with:
|
with:
|
||||||
name: revive-wasm
|
name: resolc-wasm32-unknown-emscripten
|
||||||
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: revive-wasm
|
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: revive-linux
|
|
||||||
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: revive-macos
|
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
|
||||||
|
zip -j resolc-x86_64-pc-windows-msvc.zip resolc-x86_64-pc-windows-msvc.exe
|
||||||
|
|
||||||
- name: create-release
|
- name: create-release
|
||||||
uses: softprops/action-gh-release@v2
|
uses: softprops/action-gh-release@v2
|
||||||
with:
|
with:
|
||||||
body: ${{ needs.tag.outputs.RELEASE_NOTES }}
|
body: |
|
||||||
tag_name: ${{ needs.tag.outputs.PKG_VER }}
|
## Changelog
|
||||||
name: ${{ needs.tag.outputs.PKG_VER }}
|
${{ needs.check-version-changed.outputs.RELEASE_NOTES }}
|
||||||
|
|
||||||
|
## Note for macOS Users
|
||||||
|
The macOS binary is unsigned and it needs to be made runnable using `xattr -c resolc-universal-apple-darwin`.
|
||||||
|
tag_name: ${{ needs.check-version-changed.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
|
||||||
|
resolc-x86_64-pc-windows-msvc.zip
|
||||||
|
|||||||
@@ -1,64 +0,0 @@
|
|||||||
name: Build
|
|
||||||
|
|
||||||
on:
|
|
||||||
push:
|
|
||||||
branches: ["main"]
|
|
||||||
pull_request:
|
|
||||||
branches: ["main"]
|
|
||||||
|
|
||||||
concurrency:
|
|
||||||
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
|
|
||||||
cancel-in-progress: true
|
|
||||||
|
|
||||||
env:
|
|
||||||
CARGO_TERM_COLOR: always
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
build-ubuntu-x86:
|
|
||||||
runs-on: ubuntu-24.04
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v4
|
|
||||||
|
|
||||||
- name: Install solc
|
|
||||||
run: |
|
|
||||||
mkdir -p solc
|
|
||||||
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
|
|
||||||
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: |
|
|
||||||
sudo add-apt-repository -y ppa:ethereum/ethereum
|
|
||||||
sudo apt update
|
|
||||||
sudo apt install -y ethereum
|
|
||||||
|
|
||||||
# Disabled for now (always install the latest version despite setting it):
|
|
||||||
# https://github.com/bnjbvr/cargo-machete/issues/156
|
|
||||||
#- name: Machete
|
|
||||||
# uses: bnjbvr/cargo-machete@v0.7.0
|
|
||||||
|
|
||||||
- name: Format
|
|
||||||
run: make format
|
|
||||||
|
|
||||||
- name: Clippy
|
|
||||||
run: make clippy
|
|
||||||
|
|
||||||
- name: Test cargo workspace
|
|
||||||
run: make test-workspace
|
|
||||||
|
|
||||||
- name: Test CLI
|
|
||||||
run: make test-cli
|
|
||||||
|
|
||||||
- uses: actions/upload-artifact@v4
|
|
||||||
with:
|
|
||||||
name: ${{ github.job }}-resolc
|
|
||||||
path: ./target/release/resolc
|
|
||||||
retention-days: 1
|
|
||||||
@@ -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
|
||||||
@@ -0,0 +1,57 @@
|
|||||||
|
name: Test
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches: ["main"]
|
||||||
|
pull_request:
|
||||||
|
branches: ["main"]
|
||||||
|
types: [opened, synchronize]
|
||||||
|
|
||||||
|
concurrency:
|
||||||
|
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
|
||||||
|
cancel-in-progress: true
|
||||||
|
|
||||||
|
env:
|
||||||
|
CARGO_TERM_COLOR: always
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
test:
|
||||||
|
runs-on: ubuntu-24.04
|
||||||
|
steps:
|
||||||
|
- 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
|
||||||
|
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: |
|
||||||
|
echo "LLVM_SYS_181_PREFIX=$(pwd)/llvm-x86_64-unknown-linux-gnu" >> $GITHUB_ENV
|
||||||
|
|
||||||
|
- name: Install Geth
|
||||||
|
run: |
|
||||||
|
sudo add-apt-repository -y ppa:ethereum/ethereum
|
||||||
|
sudo apt update
|
||||||
|
sudo apt install -y ethereum
|
||||||
|
|
||||||
|
- name: Machete
|
||||||
|
uses: bnjbvr/cargo-machete@v0.7.1
|
||||||
|
|
||||||
|
- name: Format
|
||||||
|
run: make format
|
||||||
|
|
||||||
|
- name: Clippy
|
||||||
|
run: make clippy
|
||||||
|
|
||||||
|
- name: Test cargo workspace
|
||||||
|
run: make test-workspace
|
||||||
|
|
||||||
|
- name: Test CLI
|
||||||
|
run: make test-cli
|
||||||
@@ -2,6 +2,10 @@
|
|||||||
|
|
||||||
## Unreleased
|
## Unreleased
|
||||||
|
|
||||||
|
This is a development pre-release.
|
||||||
|
|
||||||
|
Supported `polkadot-sdk` rev:`c29e72a8628835e34deb6aa7db9a78a2e4eabcee`
|
||||||
|
|
||||||
## v0.1.0-dev.12
|
## v0.1.0-dev.12
|
||||||
|
|
||||||
This is a development pre-release.
|
This is a development pre-release.
|
||||||
|
|||||||
Generated
+372
-370
File diff suppressed because it is too large
Load Diff
+1
-1
@@ -72,7 +72,7 @@ assert_fs = "1.1"
|
|||||||
# polkadot-sdk and friends
|
# polkadot-sdk and friends
|
||||||
codec = { version = "3.6.12", default-features = false, package = "parity-scale-codec" }
|
codec = { version = "3.6.12", default-features = false, package = "parity-scale-codec" }
|
||||||
scale-info = { version = "2.11.6", default-features = false }
|
scale-info = { version = "2.11.6", default-features = false }
|
||||||
polkadot-sdk = { git = "https://github.com/paritytech/polkadot-sdk", rev = "21f6f0705e53c15aa2b8a5706b208200447774a9" }
|
polkadot-sdk = { git = "https://github.com/paritytech/polkadot-sdk", rev = "c29e72a8628835e34deb6aa7db9a78a2e4eabcee" }
|
||||||
|
|
||||||
# llvm
|
# llvm
|
||||||
[workspace.dependencies.inkwell]
|
[workspace.dependencies.inkwell]
|
||||||
|
|||||||
@@ -0,0 +1,38 @@
|
|||||||
|
// SPDX-License-Identifier: MIT
|
||||||
|
|
||||||
|
pragma solidity ^0.8.28;
|
||||||
|
|
||||||
|
/* runner.json
|
||||||
|
{
|
||||||
|
"differential": true,
|
||||||
|
"actions": [
|
||||||
|
{
|
||||||
|
"Instantiate": {
|
||||||
|
"code": {
|
||||||
|
"Solidity": {
|
||||||
|
"contract": "DelegateCaller"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"Call": {
|
||||||
|
"dest": {
|
||||||
|
"Instantiated": 0
|
||||||
|
},
|
||||||
|
"data": "e466c6c9"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
|
contract DelegateCaller {
|
||||||
|
function delegateNoContract() external returns (bool) {
|
||||||
|
address testAddress = 0x0000000000000000000000000000000000000000;
|
||||||
|
(bool success, ) = testAddress.delegatecall(
|
||||||
|
abi.encodeWithSignature("test()")
|
||||||
|
);
|
||||||
|
return success;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,36 @@
|
|||||||
|
// SPDX-License-Identifier: MIT
|
||||||
|
|
||||||
|
pragma solidity ^0.8.28;
|
||||||
|
|
||||||
|
/* runner.json
|
||||||
|
{
|
||||||
|
"differential": true,
|
||||||
|
"actions": [
|
||||||
|
{
|
||||||
|
"Instantiate": {
|
||||||
|
"code": {
|
||||||
|
"Solidity": {
|
||||||
|
"contract": "FunctionType"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"Call": {
|
||||||
|
"dest": {
|
||||||
|
"Instantiated": 0
|
||||||
|
},
|
||||||
|
"data": "b8c9d365"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
|
contract FunctionType {
|
||||||
|
uint public immutable x = 42;
|
||||||
|
|
||||||
|
function h() public view returns (function() external view returns (uint)) {
|
||||||
|
return this.x;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,51 @@
|
|||||||
|
// SPDX-License-Identifier: MIT
|
||||||
|
|
||||||
|
pragma solidity ^0.8;
|
||||||
|
|
||||||
|
/* runner.json
|
||||||
|
{
|
||||||
|
"differential": true,
|
||||||
|
"actions": [
|
||||||
|
{
|
||||||
|
"Instantiate": {
|
||||||
|
"code": {
|
||||||
|
"Solidity": {
|
||||||
|
"contract": "MCopyOverlap"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"Call": {
|
||||||
|
"dest": {
|
||||||
|
"Instantiated": 0
|
||||||
|
},
|
||||||
|
"data": "afdce848"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
|
function copy(
|
||||||
|
uint dstOffset,
|
||||||
|
uint srcOffset,
|
||||||
|
uint length
|
||||||
|
) pure returns (bytes memory out) {
|
||||||
|
out = hex"2222222222222222333333333333333344444444444444445555555555555555"
|
||||||
|
hex"6666666666666666777777777777777788888888888888889999999999999999"
|
||||||
|
hex"aaaaaaaaaaaaaaaabbbbbbbbbbbbbbbbccccccccccccccccdddddddddddddddd";
|
||||||
|
assembly {
|
||||||
|
mcopy(
|
||||||
|
add(add(out, 0x20), dstOffset),
|
||||||
|
add(add(out, 0x20), srcOffset),
|
||||||
|
length
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
contract MCopyOverlap {
|
||||||
|
function mcopy_to_right_overlap() public pure returns (bytes memory) {
|
||||||
|
return copy(0x20, 0x10, 0x30);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -33,6 +33,7 @@ test_spec!(msize, "MSize", "MSize.sol");
|
|||||||
test_spec!(sha1, "SHA1", "SHA1.sol");
|
test_spec!(sha1, "SHA1", "SHA1.sol");
|
||||||
test_spec!(block, "Block", "Block.sol");
|
test_spec!(block, "Block", "Block.sol");
|
||||||
test_spec!(mcopy, "MCopy", "MCopy.sol");
|
test_spec!(mcopy, "MCopy", "MCopy.sol");
|
||||||
|
test_spec!(mcopy_overlap, "MCopyOverlap", "MCopyOverlap.sol");
|
||||||
test_spec!(events, "Events", "Events.sol");
|
test_spec!(events, "Events", "Events.sol");
|
||||||
test_spec!(storage, "Storage", "Storage.sol");
|
test_spec!(storage, "Storage", "Storage.sol");
|
||||||
test_spec!(mstore8, "MStore8", "MStore8.sol");
|
test_spec!(mstore8, "MStore8", "MStore8.sol");
|
||||||
@@ -56,6 +57,8 @@ test_spec!(transfer, "Transfer", "Transfer.sol");
|
|||||||
test_spec!(send, "Send", "Send.sol");
|
test_spec!(send, "Send", "Send.sol");
|
||||||
test_spec!(function_pointer, "FunctionPointer", "FunctionPointer.sol");
|
test_spec!(function_pointer, "FunctionPointer", "FunctionPointer.sol");
|
||||||
test_spec!(mload, "MLoad", "MLoad.sol");
|
test_spec!(mload, "MLoad", "MLoad.sol");
|
||||||
|
test_spec!(delegate_no_contract, "DelegateCaller", "DelegateCaller.sol");
|
||||||
|
test_spec!(function_type, "FunctionType", "FunctionType.sol");
|
||||||
|
|
||||||
fn instantiate(path: &str, contract: &str) -> Vec<SpecsAction> {
|
fn instantiate(path: &str, contract: &str) -> Vec<SpecsAction> {
|
||||||
vec![Instantiate {
|
vec![Instantiate {
|
||||||
|
|||||||
@@ -96,7 +96,7 @@ fn main() {
|
|||||||
revive_build_utils::llvm_cxx_flags()
|
revive_build_utils::llvm_cxx_flags()
|
||||||
.split_whitespace()
|
.split_whitespace()
|
||||||
.fold(&mut cc::Build::new(), |builder, flag| builder.flag(flag))
|
.fold(&mut cc::Build::new(), |builder, flag| builder.flag(flag))
|
||||||
.flag("-Wno-unused-parameter")
|
.warnings(false)
|
||||||
.cpp(true)
|
.cpp(true)
|
||||||
.file("src/linker.cpp")
|
.file("src/linker.cpp")
|
||||||
.compile("liblinker.a");
|
.compile("liblinker.a");
|
||||||
|
|||||||
@@ -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`.
|
||||||
|
|||||||
@@ -8,10 +8,6 @@ pub enum AddressSpace {
|
|||||||
Stack,
|
Stack,
|
||||||
/// The heap memory.
|
/// The heap memory.
|
||||||
Heap,
|
Heap,
|
||||||
/// The generic memory page.
|
|
||||||
Storage,
|
|
||||||
/// The transient storage.
|
|
||||||
TransientStorage,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
impl From<AddressSpace> for inkwell::AddressSpace {
|
impl From<AddressSpace> for inkwell::AddressSpace {
|
||||||
@@ -19,8 +15,6 @@ impl From<AddressSpace> for inkwell::AddressSpace {
|
|||||||
match value {
|
match value {
|
||||||
AddressSpace::Stack => Self::from(0),
|
AddressSpace::Stack => Self::from(0),
|
||||||
AddressSpace::Heap => Self::from(1),
|
AddressSpace::Heap => Self::from(1),
|
||||||
AddressSpace::Storage => Self::from(5),
|
|
||||||
AddressSpace::TransientStorage => Self::from(6),
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,9 +1,6 @@
|
|||||||
//! The LLVM runtime functions.
|
//! The LLVM runtime functions.
|
||||||
|
|
||||||
use inkwell::types::BasicType;
|
|
||||||
|
|
||||||
use crate::optimizer::Optimizer;
|
use crate::optimizer::Optimizer;
|
||||||
use crate::polkavm::context::address_space::AddressSpace;
|
|
||||||
use crate::polkavm::context::function::declaration::Declaration as FunctionDeclaration;
|
use crate::polkavm::context::function::declaration::Declaration as FunctionDeclaration;
|
||||||
use crate::polkavm::context::function::Function;
|
use crate::polkavm::context::function::Function;
|
||||||
|
|
||||||
@@ -19,9 +16,6 @@ pub struct LLVMRuntime<'ctx> {
|
|||||||
pub exp: FunctionDeclaration<'ctx>,
|
pub exp: FunctionDeclaration<'ctx>,
|
||||||
/// The corresponding LLVM runtime function.
|
/// The corresponding LLVM runtime function.
|
||||||
pub sign_extend: FunctionDeclaration<'ctx>,
|
pub sign_extend: FunctionDeclaration<'ctx>,
|
||||||
|
|
||||||
/// The corresponding LLVM runtime function.
|
|
||||||
pub sha3: FunctionDeclaration<'ctx>,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'ctx> LLVMRuntime<'ctx> {
|
impl<'ctx> LLVMRuntime<'ctx> {
|
||||||
@@ -37,9 +31,6 @@ impl<'ctx> LLVMRuntime<'ctx> {
|
|||||||
/// The corresponding runtime function name.
|
/// The corresponding runtime function name.
|
||||||
pub const FUNCTION_SIGNEXTEND: &'static str = "__signextend";
|
pub const FUNCTION_SIGNEXTEND: &'static str = "__signextend";
|
||||||
|
|
||||||
/// The corresponding runtime function name.
|
|
||||||
pub const FUNCTION_SHA3: &'static str = "__sha3";
|
|
||||||
|
|
||||||
/// A shortcut constructor.
|
/// A shortcut constructor.
|
||||||
pub fn new(
|
pub fn new(
|
||||||
llvm: &'ctx inkwell::context::Context,
|
llvm: &'ctx inkwell::context::Context,
|
||||||
@@ -65,43 +56,11 @@ impl<'ctx> LLVMRuntime<'ctx> {
|
|||||||
Function::set_default_attributes(llvm, sign_extend, optimizer);
|
Function::set_default_attributes(llvm, sign_extend, optimizer);
|
||||||
Function::set_pure_function_attributes(llvm, sign_extend);
|
Function::set_pure_function_attributes(llvm, sign_extend);
|
||||||
|
|
||||||
let sha3 = Self::declare(
|
|
||||||
module,
|
|
||||||
Self::FUNCTION_SHA3,
|
|
||||||
llvm.custom_width_int_type(revive_common::BIT_LENGTH_WORD as u32)
|
|
||||||
.fn_type(
|
|
||||||
vec![
|
|
||||||
llvm.ptr_type(AddressSpace::Heap.into())
|
|
||||||
.as_basic_type_enum()
|
|
||||||
.into(),
|
|
||||||
llvm.custom_width_int_type(revive_common::BIT_LENGTH_WORD as u32)
|
|
||||||
.as_basic_type_enum()
|
|
||||||
.into(),
|
|
||||||
llvm.custom_width_int_type(revive_common::BIT_LENGTH_BOOLEAN as u32)
|
|
||||||
.as_basic_type_enum()
|
|
||||||
.into(),
|
|
||||||
]
|
|
||||||
.as_slice(),
|
|
||||||
false,
|
|
||||||
),
|
|
||||||
Some(inkwell::module::Linkage::External),
|
|
||||||
);
|
|
||||||
Function::set_default_attributes(llvm, sha3, optimizer);
|
|
||||||
Function::set_attributes(
|
|
||||||
llvm,
|
|
||||||
sha3,
|
|
||||||
//vec![Attribute::ArgMemOnly, Attribute::ReadOnly],
|
|
||||||
&[],
|
|
||||||
false,
|
|
||||||
);
|
|
||||||
|
|
||||||
Self {
|
Self {
|
||||||
add_mod,
|
add_mod,
|
||||||
mul_mod,
|
mul_mod,
|
||||||
exp,
|
exp,
|
||||||
sign_extend,
|
sign_extend,
|
||||||
|
|
||||||
sha3,
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -788,9 +788,6 @@ where
|
|||||||
panic!("revive runtime function {name} should return a value")
|
panic!("revive runtime function {name} should return a value")
|
||||||
}))
|
}))
|
||||||
}
|
}
|
||||||
AddressSpace::Storage | AddressSpace::TransientStorage => {
|
|
||||||
unreachable!("should use the runtime function")
|
|
||||||
}
|
|
||||||
AddressSpace::Stack => {
|
AddressSpace::Stack => {
|
||||||
let value = self
|
let value = self
|
||||||
.builder()
|
.builder()
|
||||||
@@ -823,9 +820,6 @@ where
|
|||||||
];
|
];
|
||||||
self.build_call(declaration, &arguments, "heap_store");
|
self.build_call(declaration, &arguments, "heap_store");
|
||||||
}
|
}
|
||||||
AddressSpace::Storage | AddressSpace::TransientStorage => {
|
|
||||||
unreachable!("should use the runtime function")
|
|
||||||
}
|
|
||||||
AddressSpace::Stack => {
|
AddressSpace::Stack => {
|
||||||
let instruction = self.builder.build_store(pointer.value, value).unwrap();
|
let instruction = self.builder.build_store(pointer.value, value).unwrap();
|
||||||
instruction
|
instruction
|
||||||
@@ -870,9 +864,6 @@ where
|
|||||||
where
|
where
|
||||||
T: BasicType<'ctx>,
|
T: BasicType<'ctx>,
|
||||||
{
|
{
|
||||||
assert_ne!(pointer.address_space, AddressSpace::Storage);
|
|
||||||
assert_ne!(pointer.address_space, AddressSpace::TransientStorage);
|
|
||||||
|
|
||||||
let value = unsafe {
|
let value = unsafe {
|
||||||
self.builder
|
self.builder
|
||||||
.build_gep(pointer.r#type, pointer.value, indexes, name)
|
.build_gep(pointer.r#type, pointer.value, indexes, name)
|
||||||
@@ -1298,13 +1289,6 @@ where
|
|||||||
inkwell::attributes::AttributeLoc::Param(index as u32),
|
inkwell::attributes::AttributeLoc::Param(index as u32),
|
||||||
self.llvm.create_enum_attribute(Attribute::NoFree as u32, 0),
|
self.llvm.create_enum_attribute(Attribute::NoFree as u32, 0),
|
||||||
);
|
);
|
||||||
if function == self.llvm_runtime().sha3 {
|
|
||||||
call_site_value.add_attribute(
|
|
||||||
inkwell::attributes::AttributeLoc::Param(index as u32),
|
|
||||||
self.llvm
|
|
||||||
.create_enum_attribute(Attribute::ReadOnly as u32, 0),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
if Some(argument.get_type()) == function.r#type.get_return_type() {
|
if Some(argument.get_type()) == function.r#type.get_return_type() {
|
||||||
if function
|
if function
|
||||||
.r#type
|
.r#type
|
||||||
|
|||||||
Reference in New Issue
Block a user