diff --git a/.github/Dockerfile b/.github/Dockerfile new file mode 100644 index 00000000..4301044b --- /dev/null +++ b/.github/Dockerfile @@ -0,0 +1,6 @@ +FROM revive-llvm + +WORKDIR /app + +COPY . . +RUN RUSTFLAGS='-L /app/llvm18.0/lib/unknown -L /usr/lib -L /app/llvm18.0/lib' REVIVE_INSTALL_DIR='/app/release/revive/' make install-revive \ No newline at end of file diff --git a/.github/Dockerfile-llvm b/.github/Dockerfile-llvm new file mode 100644 index 00000000..32d4b837 --- /dev/null +++ b/.github/Dockerfile-llvm @@ -0,0 +1,16 @@ +FROM alpine:3.20.3 + +ARG RUST_VERSION=stable + +RUN apk add bash git cmake make ninja python3 ncurses-static curl +RUN ninja --version + +COPY build-llvm.sh . + +RUN bash -c ./build-llvm.sh + +RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --default-toolchain ${RUST_VERSION} +ENV PATH=/root/.cargo/bin:/llvm18.0/bin:${PATH} + +WORKDIR /app +RUN REVIVE_INSTALL_DIR=$(pwd)/target/release diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 00000000..d6f599d3 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,40 @@ +name: Release +run-name: Release ${{ github.ref_name }} +on: + push: + tags: + - "[0-9]+.[0-9]+.[0-9]+" + - "[0-9]+.[0-9]+.[0-9]+-[a-zA-Z0-9]+" +jobs: + + CreateRelease: + permissions: + contents: write + runs-on: ubuntu-20.04 + steps: + - name: Release + uses: softprops/action-gh-release@v2 + with: + draft: true + make_latest: true + + Release: + needs: [CreateRelease] + permissions: + contents: write + runs-on: ubuntu-20.04 + env: + GH_TOKEN: ${{ github.token }} + steps: + - name: build llvm + run: docker build -t revive-llvm:latest --progress=plain -f --build-arg RUST_VERSION=1.80 .github/Dockerfile-llvm + + - name: build revive + run: docker build -t revive:latest --progress=plain -f .github/Dockerfile + + - name: get binary + run: docker run --rm revive:latest -v output:/app/output cp /app/release/revive/resolc /app/output + + # docker push revive:latest + + - run: gh release upload ${{ github.ref_name }} output/resolc --clobber diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index 31006ca2..e8c78602 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -3,8 +3,6 @@ name: Build on: push: branches: ["main"] - pull_request: - branches: ["main"] env: CARGO_TERM_COLOR: always diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 00000000..2f39588d --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,30 @@ +name: Test +run-name: Test ${{ github.ref_name }} +on: + pull_request: + types: [opened, synchronize, reopened, ready_for_review] + +concurrency: + group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} + cancel-in-progress: true + +jobs: + Release: + # runs-on: ubuntu-20.04 + runs-on: parity-large + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: build llvm + run: docker build -t revive-llvm:latest --progress=plain --build-arg RUST_VERSION=1.80 -f .github/Dockerfile-llvm . + + - name: build revive + run: docker build -t revive:latest --progress=plain -f .github/Dockerfile + + - name: get binary + run: docker run --rm revive:latest -v output:/app/output cp /app/release/revive/resolc /app/output . + + # docker push revive:latest + + - run: gh release upload ${{ github.ref_name }} output/resolc