This is an automated email from the ASF dual-hosted git repository.
spacewander pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/apisix.git
The following commit(s) were added to refs/heads/master by this push:
new 01849b9 ci: auto generate and check for rpm package (#3621)
01849b9 is described below
commit 01849b98f17e0a5fa63bcc1b5a78c9df7f582202
Author: Shuyang Wu <[email protected]>
AuthorDate: Wed Mar 3 17:59:59 2021 +0800
ci: auto generate and check for rpm package (#3621)
Co-authored-by: John Bampton <[email protected]>
---
.github/workflows/build.yml | 1 +
.github/workflows/centos7-ci.yml | 51 ++++++++++++++++++++++++++++++++--------
utils/centos7-ci.sh | 6 ++---
3 files changed, 45 insertions(+), 13 deletions(-)
diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
index 4337e2f..46cfcd8 100644
--- a/.github/workflows/build.yml
+++ b/.github/workflows/build.yml
@@ -54,6 +54,7 @@ jobs:
submodules: recursive
- name: Extract branch name
+ if: ${{ startsWith(github.ref, 'refs/heads/release/') }}
id: branch_env
shell: bash
run: |
diff --git a/.github/workflows/centos7-ci.yml b/.github/workflows/centos7-ci.yml
index 1e3b5fc..4f99fd3 100644
--- a/.github/workflows/centos7-ci.yml
+++ b/.github/workflows/centos7-ci.yml
@@ -2,11 +2,9 @@ name: CI Centos7
on:
push:
- branches:
- - master
+ branches: [master, 'release/**']
pull_request:
- branches:
- - master
+ branches: [master]
jobs:
test_apisix:
@@ -29,6 +27,24 @@ jobs:
with:
submodules: recursive
+ - name: Extract branch name
+ if: ${{ startsWith(github.ref, 'refs/heads/release/') }}
+ id: branch_env
+ shell: bash
+ run: |
+ echo "##[set-output name=version;]$(echo ${GITHUB_REF##*/})"
+
+ - name: Build rpm package
+ if: ${{ startsWith(github.ref, 'refs/heads/release/') }}
+ run: |
+ export VERSION=${{ steps.branch_env.outputs.version }}
+ sudo gem install --no-document fpm
+ git clone https://github.com/api7/apisix-build-tools.git
+ cd apisix-build-tools
+ make package type=rpm app=apisix version=${VERSION}
checkout=release/${VERSION}
+ cd ..
+ rm -rf $(ls -1 --ignore=apisix-build-tools --ignore=t --ignore=utils
--ignore=Makefile --ignore=rockspec)
+
- name: Install Redis Cluster
run: |
docker run -d -p ${MASTER1_PORT}:6379 -p ${MASTER2_PORT}:6380 -p
${MASTER3_PORT}:6381 -p ${SLAVE1_PORT}:6382 -p ${SLAVE2_PORT}:6383 -p
${SLAVE3_PORT}:6384 --name redis-cluster vishnunair/docker-redis-cluster:latest
@@ -60,11 +76,12 @@ jobs:
-v /home/runner/work/apisix/apisix/t/certs:/certs \
bitnami/etcd:3.4.0
- - name: run centos7 docker and mapping apisix into container
+ - name: Run centos7 docker and mapping apisix into container
run: |
- docker run -itd -v /home/runner/work/apisix/apisix:/tmp/apisix --name
centos7Instance --net="host" docker.io/centos:7 /bin/bash
+ docker run -itd -v /home/runner/work/apisix/apisix:/apisix --name
centos7Instance --net="host" docker.io/centos:7 /bin/bash
+ # docker exec centos7Instance bash -c "cp -r /tmp/apisix ./"
- - name: run other docker containers for test
+ - name: Run other docker containers for test
run: |
docker run --rm -itd -p 6379:6379 --name apisix_redis redis:3.0-alpine
docker run --rm -itd -e HTTP_PORT=8888 -e HTTPS_PORT=9999 -p 8888:8888
-p 9999:9999 mendhak/http-https-echo
@@ -80,11 +97,25 @@ jobs:
docker run --rm --name consul_1 -d -p 8500:8500 consul:1.7 consul
agent -server -bootstrap-expect=1 -client 0.0.0.0 -log-level info
-data-dir=/consul/data
docker run --rm --name consul_2 -d -p 8600:8500 consul:1.7 consul
agent -server -bootstrap-expect=1 -client 0.0.0.0 -log-level info
-data-dir=/consul/data
- - name: install dependencies
+ - name: Install dependencies
run: |
- docker exec centos7Instance bash -c "cp -r /tmp/apisix ./"
docker exec centos7Instance bash -c "cd apisix &&
./utils/centos7-ci.sh install_dependencies"
- - name: run test cases
+ - name: Install rpm package
+ if: ${{ startsWith(github.ref, 'refs/heads/release/') }}
+ run: |
+ docker exec centos7Instance bash -c "cd apisix && rpm -iv
--prefix=/apisix ./apisix-build-tools/output/apisix-${{
steps.branch_env.outputs.version }}-0.x86_64.rpm"
+ # Dependencies are attached with rpm, so revert `make deps`
+ docker exec centos7Instance bash -c "cd apisix && rm -rf deps"
+ docker exec centos7Instance bash -c "cd apisix && mv usr/bin . && mv
usr/local/apisix/* ."
+
+ - name: Run test cases
run: |
docker exec centos7Instance bash -c "cd apisix &&
./utils/centos7-ci.sh run_case"
+
+ - name: Publish Artifact
+ if: ${{ startsWith(github.ref, 'refs/heads/release/') }}
+ uses: actions/[email protected]
+ with:
+ name: "rpm"
+ path: "./apisix-build-tools/output/apisix-${{
steps.branch_env.outputs.version }}-0.x86_64.rpm"
diff --git a/utils/centos7-ci.sh b/utils/centos7-ci.sh
index 5ca6ef5..db60fcf 100755
--- a/utils/centos7-ci.sh
+++ b/utils/centos7-ci.sh
@@ -25,9 +25,9 @@ install_dependencies() {
yum install -y wget tar gcc automake autoconf libtool make unzip \
curl git which sudo
- # install openresty
+ # install openresty to make apisix's rpm test work
yum install -y yum-utils && yum-config-manager --add-repo
https://openresty.org/package/centos/openresty.repo
- yum install -y openresty-debug openresty-openssl111-debug-devel
+ yum install -y openresty openresty-debug openresty-openssl111-debug-devel
# install luarocks
./utils/linux-install-luarocks.sh
@@ -57,11 +57,11 @@ install_dependencies() {
# install dependencies
git clone https://github.com/iresty/test-nginx.git test-nginx
make deps
- make init
}
run_case() {
export_or_prefix
+ make init
./utils/set-dns.sh
# run test cases
FLUSH_ETCD=1 prove -I./test-nginx/lib -I./ -r t/