From 3ef8b5e7b9af24c3d2b90cf3fa8432792d07f592 Mon Sep 17 00:00:00 2001 From: Junfan Zhang Date: Wed, 4 Dec 2024 20:42:20 +0800 Subject: [PATCH] feat(build): Add basic release workflow --- .github/workflows/release.yaml | 36 ++++++++++++++++++++++++++++++++ dev/centos7/Dockerfile | 38 ++++++++++++++++++++++++++++++++++ dev/docker-compose.yml | 15 ++++++++++++++ release.sh | 3 +++ 4 files changed, 92 insertions(+) create mode 100644 .github/workflows/release.yaml create mode 100644 dev/centos7/Dockerfile create mode 100644 dev/docker-compose.yml create mode 100755 release.sh diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml new file mode 100644 index 0000000..c1cfef8 --- /dev/null +++ b/.github/workflows/release.yaml @@ -0,0 +1,36 @@ +name: ReleaseBot + +on: + push: + tags: + - "v*.*.*" + +jobs: + build-snapshot: + name: Build Snapshot + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + + - uses: prompt/actions-commit-hash@v3 + id: commit + + - uses: ScribeMD/rootless-docker@0.2.2 + if: steps.cache.outputs.cache-hit != 'true' + + - uses: ScribeMD/docker-cache@0.5.0 + if: steps.cache.outputs.cache-hit != 'true' + with: + key: docker-centos7-${{ hashFiles('dev/centos7/Dockerfile') }} + + - name: Build + run: | + sed -i 's/docker-compose -f/docker compose -f/g' ./release.sh + ./release.sh + + - name: Upload + uses: actions/upload-artifact@v3 + with: + name: uniffle-worker + path: target-docker/release/uniffle-worker diff --git a/dev/centos7/Dockerfile b/dev/centos7/Dockerfile new file mode 100644 index 0000000..d4b054e --- /dev/null +++ b/dev/centos7/Dockerfile @@ -0,0 +1,38 @@ +FROM centos:7 + +# install common tools +RUN echo "sslverify=false" >> /etc/yum.conf +RUN sed -i "s/mirror.centos.org/vault.centos.org/g" /etc/yum.repos.d/*.repo +RUN sed -i "s/^#.*baseurl=http/baseurl=https/g" /etc/yum.repos.d/*.repo +RUN sed -i "s/^mirrorlist/#mirrorlist/g" /etc/yum.repos.d/*.repo +RUN yum update -y +RUN yum install -y centos-release-scl epel-release +RUN sed -i "s/mirror.centos.org/vault.centos.org/g" /etc/yum.repos.d/*.repo +RUN sed -i "s/^#.*baseurl=http/baseurl=https/g" /etc/yum.repos.d/*.repo +RUN sed -i "s/^mirrorlist/#mirrorlist/g" /etc/yum.repos.d/*.repo +RUN yum install -y libzip unzip wget cmake3 openssl-devel llvm clang-devel clang jemalloc + +# install gcc-8 +RUN yum install -y devtoolset-8-gcc devtoolset-8-gcc-c++ +RUN echo '. /opt/rh/devtoolset-8/enable' >> ~/.bashrc + +# install rust nightly toolchain +RUN curl https://sh.rustup.rs > /rustup-init +RUN chmod +x /rustup-init +RUN /rustup-init -y --default-toolchain nightly-2024-10-01-x86_64-unknown-linux-gnu + +# install java +RUN yum install -y java-1.8.0-openjdk java-1.8.0-openjdk-devel +RUN echo 'export JAVA_HOME="/usr/lib/jvm/java-1.8.0-openjdk"' >> ~/.bashrc + +# install maven +# RUN yum install -y rh-maven35 +# RUN echo 'source /opt/rh/rh-maven35/enable' >> ~/.bashrc + +# install protoc +RUN wget -O /protobuf-21.7-linux-x86_64.zip https://github.com/protocolbuffers/protobuf/releases/download/v21.7/protoc-21.7-linux-x86_64.zip +RUN mkdir /protobuf-bin && (cd /protobuf-bin && unzip /protobuf-21.7-linux-x86_64.zip) +RUN echo 'export PATH="$PATH:/protobuf-bin/bin"' >> ~/.bashrc + +# attach libjvm.so +RUN echo 'export LD_LIBRARY_PATH=${JAVA_HOME}/jre/lib/amd64/server:${LD_LIBRARY_PATH}' >> ~/.bashrc \ No newline at end of file diff --git a/dev/docker-compose.yml b/dev/docker-compose.yml new file mode 100644 index 0000000..f22d0ee --- /dev/null +++ b/dev/docker-compose.yml @@ -0,0 +1,15 @@ +version: "3" + +services: + build-release: + build: ./centos7 + volumes: + - ~/.m2:/root/.m2:rw + - ~/.sbt:/root/.sbt:rw + - ~/.cargo/git:/root/.cargo/git:rw + - ~/.cargo/registry:/root/.cargo/registry:rw + - ./../:/R1:rw + - ./../target-docker:/R1/target:rw + environment: + RUSTFLAGS: "-C target-cpu=skylake" + command: "bash -c 'source ~/.bashrc && cd /R1 && cargo build --release'" diff --git a/release.sh b/release.sh new file mode 100755 index 0000000..1ffcb2a --- /dev/null +++ b/release.sh @@ -0,0 +1,3 @@ +#!/bin/bash + +docker-compose -f dev/docker-compose.yml up \ No newline at end of file