-
Notifications
You must be signed in to change notification settings - Fork 54
101 lines (87 loc) · 3.48 KB
/
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
name: CI
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
jobs:
build:
strategy:
fail-fast: false
matrix:
include:
- version: 3.4.0
conf: Procfile-single
- version: 3.5.0
conf: Procfile-single
- version: 3.4.0
conf: Procfile-single-enable-tls
- version: 3.4.0
conf: Procfile-single-enable-mtls
runs-on: "ubuntu-20.04"
env:
OPENRESTY_PREFIX: "/usr/local/openresty"
AUTH_ENDPOINT_V3: "127.0.0.1:12379"
AUTH_USER: root
AUTH_PWD: abc123
ETCD_VER: "${{ matrix.version }}"
GOREMAN_CONF: "${{ matrix.conf }}"
steps:
- uses: actions/checkout@v2
- name: setup go
uses: actions/setup-go@v2.1.3
with:
# goreman requires 1.17
go-version: "1.17"
- name: get dependencies
run: sudo apt install -y cpanminus build-essential libncurses5-dev libreadline-dev libssl-dev perl
- name: Setup Lua
uses: leafo/gh-actions-lua@v8.0.0
with:
luaVersion: "5.1.5"
- name: Install Luarocks
uses: leafo/gh-actions-luarocks@v4
- name: install
run: |
git clone https://github.com/openresty/test-nginx.git test-nginx
cd test-nginx && (sudo cpanm --notest . > build.log 2>&1 || (cat build.log && exit 1)) && cd ..
wget https://raw.githubusercontent.com/api7/apisix-build-tools/master/build-apisix-base.sh
chmod +x build-apisix-base.sh
OR_PREFIX=$OPENRESTY_PREFIX ./build-apisix-base.sh latest
luarocks make rockspec/lua-resty-etcd-master-0.1-0.rockspec
luarocks install luacheck > build.log 2>&1 || (cat build.log && exit 1)
luarocks install dkjson > build.log 2>&1 || (cat build.log && exit 1)
make utils
wget https://github.com/etcd-io/etcd/releases/download/v$ETCD_VER/etcd-v$ETCD_VER-linux-amd64.tar.gz
tar xf etcd-v$ETCD_VER-linux-amd64.tar.gz
# run etcd local cluster, startup at localhost:2379, localhost:22379, and localhost:32379
# see more https://github.com/etcd-io/etcd/blob/master/Documentation/dev-guide/local_cluster.md
go get github.com/mattn/goreman
- name: script
if: matrix.conf != 'Procfile-single-enable-mtls'
run: |
if [[ "$GOREMAN_CONF" == "Procfile-single-enable-tls" ]]; then
export ETCD_ENABLE_TLS=TRUE
export ETCDCTL_EXTRA_OPTS="--insecure-transport=false --insecure-skip-tls-verify=true"
fi
export PATH=$OPENRESTY_PREFIX/nginx/sbin:$OPENRESTY_PREFIX/luajit/bin:$PWD/etcd-v$ETCD_VER-linux-amd64:$PATH
etcd --version
goreman -f ./t/$GOREMAN_CONF start > goreman.log 2>&1 &
sleep 5
chmod +x ./t/v3/add-auth.sh
[[ $ETCD_ENABLE_TLS != TRUE ]] && ./t/v3/add-auth.sh || true
cat goreman.log
ps -ef | grep etcd
luajit -v
luajit -v | awk '{print$2}'| grep 2.1
make lint || exit 1
make test
- name: script
if: matrix.conf == 'Procfile-single-enable-mtls'
run: |
export ETCD_ENABLE_MTLS=TRUE
export PATH=$OPENRESTY_PREFIX/nginx/sbin:$OPENRESTY_PREFIX/luajit/bin:$PWD/etcd-v$ETCD_VER-linux-amd64:$PATH
etcd --version
goreman -f ./t/$GOREMAN_CONF start > goreman.log 2>&1 &
sleep 5
prove -I../test-nginx/lib t/v3/mtls.t t/v3/grpc/mtls.t