diff --git a/.github/workflows/build-revive-debian.yml b/.github/workflows/build-revive-debian.yml new file mode 100644 index 0000000..f51ee1a --- /dev/null +++ b/.github/workflows/build-revive-debian.yml @@ -0,0 +1,38 @@ +name: Build revive-debian +on: + workflow_dispatch: + +env: + REVIVE_DEBIAN_PACKAGE: revive-debian-x86 + DEBIAN_CONTAINER: revive-builder-debian-x86 + DEBIAN_CONTAINER_BUILDER: build-debian-builder.sh + DEBIAN_CONTAINER_RUNNER: run-debian-builder.sh + REVIVE_DEBIAN_INSTALL: ${{ github.workspace }}/target/release + REVIVE_DEBIAN_BINARY: resolc + RUST_VERSION: "1.80" + +jobs: + build-revive-debian-x86: + name: debian-container-x86 + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - name: build-container + run: | + (cd utils && ./${{ env.DEBIAN_CONTAINER_BUILDER}} --build-arg RUST_VERSION=${{ env.RUST_VERSION}} . ) + + - name: build-revive-debian + run: | + rustup show + cargo --version + rustup +nightly show + cargo +nightly --version + bash --version + utils/${{ env.DEBIAN_CONTAINER_RUNNER }} utils/build-revive.sh -o ${{ env.REVIVE_DEBIAN_INSTALL}} + + - uses: actions/upload-artifact@v4 + with: + name: ${{ env.REVIVE_DEBIAN_PACKAGE }} + path: ${{ env.REVIVE_DEBIAN_INSTALL }}/${{ env.REVIVE_DEBIAN_BINARY }} + retention-days: 1 diff --git a/Cargo.toml b/Cargo.toml index fd2b5e3..5442926 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -11,6 +11,7 @@ authors = [ license = "MIT/Apache-2.0" edition = "2021" repository = "https://github.com/paritytech/revive" +rust-version = "1.80.0" [workspace.dependencies] revive-benchmarks = { version = "0.1.0", path = "crates/benchmarks" } diff --git a/Makefile b/Makefile index 101e121..6a2492c 100644 --- a/Makefile +++ b/Makefile @@ -8,6 +8,13 @@ install-bin: install-npm: npm install && npm fund +# install-revive: Build and install to the directory specified in REVIVE_INSTALL_DIR +ifeq ($(origin REVIVE_INSTALL_DIR), undefined) +REVIVE_INSTALL_DIR=`pwd`/release/revive-debian +endif +install-revive: + cargo install --path crates/solidity --root $(REVIVE_INSTALL_DIR) + format: cargo fmt --all --check diff --git a/utils/build-debian-builder.sh b/utils/build-debian-builder.sh new file mode 100755 index 0000000..87c81e0 --- /dev/null +++ b/utils/build-debian-builder.sh @@ -0,0 +1,7 @@ +#! /usr/bin/env bash + +CONTAINER=revive-builder-debian-x86 +VERSION=latest +DOCKERFILE=revive-builder-debian.dockerfile + +docker build --rm -t ${CONTAINER}:${VERSION} -f ${DOCKERFILE} $@ diff --git a/utils/build-revive.sh b/utils/build-revive.sh new file mode 100755 index 0000000..a1b1dde --- /dev/null +++ b/utils/build-revive.sh @@ -0,0 +1,20 @@ +#! /usr/bin/env bash + +set -euo pipefail + +REVIVE_INSTALL_DIR=$(pwd)/target/release +while getopts "o:" option ; do + case $option in + o) # Output directory + REVIVE_INSTALL_DIR=$OPTARG + ;; + \?) echo "Error: Invalid option" + exit 1;; + esac +done +echo "Installing to ${REVIVE_INSTALL_DIR}" + +$(pwd)/build-llvm.sh +export PATH=$(pwd)/llvm18.0/bin:$PATH + +make install-revive REVIVE_INSTALL_DIR=${REVIVE_INSTALL_DIR} diff --git a/utils/revive-builder-debian.dockerfile b/utils/revive-builder-debian.dockerfile new file mode 100644 index 0000000..2631aed --- /dev/null +++ b/utils/revive-builder-debian.dockerfile @@ -0,0 +1,14 @@ +# syntax=docker/dockerfile:1 +# Dockerfile for building revive in a Debian container. +FROM debian:12 +RUN <