From d16922e59e30fc7208173d4688528d5fc6c341eb Mon Sep 17 00:00:00 2001 From: tzssangglass Date: Sat, 12 Jun 2021 10:23:47 +0800 Subject: [PATCH] feat: Add CI for the apisix-openresty build and install rpm (#48) --- .../workflows/package-apisix-openresty.yml | 44 +++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 .github/workflows/package-apisix-openresty.yml diff --git a/.github/workflows/package-apisix-openresty.yml b/.github/workflows/package-apisix-openresty.yml new file mode 100644 index 0000000..691fd8b --- /dev/null +++ b/.github/workflows/package-apisix-openresty.yml @@ -0,0 +1,44 @@ +name: package apisix-openresty + +on: + push: + branches: [ master ] + pull_request: + branches: [ master ] + +jobs: + build: + runs-on: ubuntu-latest + env: + BUILD_APISIX_OR_VERSION: 1.0.0 + steps: + - uses: actions/checkout@v2 + + - name: install dependencies + run: | + sudo apt-get install -y make ruby ruby-dev rubygems build-essential + sudo gem install --no-document fpm + sudo apt-get install -y rpm + + - name: build apisix-openresty rpm + run: | + make package type=rpm app=apisix-openresty version=${BUILD_APISIX_OR_VERSION} + + - name: run centos7 docker and mapping apisix-openresty rpm into container + run: | + docker run -itd -v /home/runner/work/apisix-build-tools/apisix-build-tools/output:/output --name centos7Instance --net="host" docker.io/centos:7 /bin/bash + + - name: install dependencies in container + run: | + docker exec centos7Instance bash -c "yum-config-manager --add-repo https://openresty.org/package/centos/openresty.repo" + docker exec centos7Instance bash -c "yum -y install openresty-openssl111 openresty-pcre openresty-zlib" + + - name: install rpm in container + run: | + docker exec centos7Instance bash -c "yum -y localinstall /output/apisix-openresty-${BUILD_APISIX_OR_VERSION}-0.x86_64.rpm" + + - name: check and ensure openresty is installed + run: | + export APISIX_OPENRESTY_VER=$(docker exec centos7Instance bash -c "openresty -V" 2>&1 | awk '/-O2 -DAPISIX_OPENRESTY_VER=/{print $5}' | awk -v FS="=" '{print $2}') + if [ "$APISIX_OPENRESTY_VER" != "${BUILD_APISIX_OR_VERSION}" ]; then exit 1; fi +