From d5b9c489ea9706bd23d83119dfae01b37cb3335c Mon Sep 17 00:00:00 2001 From: Evgeny Snitko Date: Fri, 25 Oct 2024 06:46:25 +0400 Subject: [PATCH] gha test --- .github/Dockerfile | 6 ++++++ .github/Dockerfile-llvm | 14 ++++++++++++ .github/workflows/release.yml | 40 +++++++++++++++++++++++++++++++++++ .github/workflows/test.yml | 23 ++++++++++++++++++++ 4 files changed, 83 insertions(+) create mode 100644 .github/Dockerfile create mode 100644 .github/Dockerfile-llvm create mode 100644 .github/workflows/release.yml create mode 100644 .github/workflows/test.yml diff --git a/.github/Dockerfile b/.github/Dockerfile new file mode 100644 index 0000000..4301044 --- /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 0000000..2d06813 --- /dev/null +++ b/.github/Dockerfile-llvm @@ -0,0 +1,14 @@ +FROM alpine:3.20.3 + +ARG RUST_VERSION=stable + +RUN apk add bash git cmake make g++ ninja python3 ncurses-static curl lld-dev lld lld-libs libc++-static +RUN ninja --version + +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 0000000..d6f599d --- /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/test.yml b/.github/workflows/test.yml new file mode 100644 index 0000000..f99cda0 --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,23 @@ +name: Release +run-name: Release ${{ github.ref_name }} +on: + pull_request: + types: [opened, synchronize, reopened, ready_for_review] + +jobs: + + Release: + runs-on: ubuntu-20.04 + 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