forked from apache/apisix
-
Notifications
You must be signed in to change notification settings - Fork 0
115 lines (99 loc) · 4.05 KB
/
centos7-ci.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
name: CI Centos7
on:
push:
branches: [master, 'release/**']
paths-ignore:
- 'docs/**'
pull_request:
branches: [master]
paths-ignore:
- 'docs/**'
concurrency:
group: ${{ github.workflow }}-${{ github.ref == 'refs/heads/master' && github.run_number || github.ref }}
cancel-in-progress: true
jobs:
test_apisix:
name: run ci on centos7
runs-on: ubuntu-latest
services:
etcd:
image: bitnami/etcd:3.4.0
ports:
- 2379:2379
- 2380:2380
env:
ALLOW_NONE_AUTHENTICATION: yes
ETCD_ADVERTISE_CLIENT_URLS: http://0.0.0.0:2379
steps:
- name: Check out code
uses: actions/[email protected]
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 -b v2.1.0 https://github.com/api7/apisix-build-tools.git
cd apisix-build-tools
make package type=rpm app=apisix version=${VERSION} checkout=release/${VERSION} image_base=centos image_tag=7 local_code_path=../apisix
cd ..
rm -rf $(ls -1 --ignore=apisix-build-tools --ignore=t --ignore=utils --ignore=ci --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
env:
MASTER1_PORT: 5000
MASTER2_PORT: 5001
MASTER3_PORT: 5002
SLAVE1_PORT: 5003
SLAVE2_PORT: 5004
SLAVE3_PORT: 5005
- name: Running Redis Cluster Test
run: |
sudo apt-get install -y redis-tools
docker ps -a
redis-cli -h 127.0.0.1 -p 5000 ping
redis-cli -h 127.0.0.1 -p 5000 cluster nodes
- name: Running etcd server with TLS
run: |
sudo docker run -d -p 12379:12379 -p 12380:12380 \
-e ALLOW_NONE_AUTHENTICATION=yes \
-e ETCD_ADVERTISE_CLIENT_URLS=https://0.0.0.0:12379 \
-e ETCD_LISTEN_CLIENT_URLS=https://0.0.0.0:12379 \
-e ETCD_CERT_FILE=/certs/etcd.pem \
-e ETCD_KEY_FILE=/certs/etcd.key \
-v /home/runner/work/apisix/apisix/t/certs:/certs \
bitnami/etcd:3.4.0
- name: Run centos7 docker and mapping apisix into container
run: |
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
run: |
./ci/install-ext-services-via-docker.sh
- name: Install dependencies
run: |
docker exec centos7Instance bash -c "cd apisix && ./ci/centos7-ci.sh install_dependencies"
- 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.el7.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 && ./ci/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.el7.x86_64.rpm"