Skip to content

Commit c5ca0e1

Browse files
authored
ci: use GitHub Action (#114)
Fix #113.
1 parent a1815ae commit c5ca0e1

File tree

3 files changed

+90
-71
lines changed

3 files changed

+90
-71
lines changed

.github/workflows/ci.yml

Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: [ master ]
6+
pull_request:
7+
branches: [ master ]
8+
9+
10+
jobs:
11+
build:
12+
strategy:
13+
fail-fast: true
14+
matrix:
15+
include:
16+
- version: 2.2.5
17+
conf: Procfile-single
18+
- version: 3.1.0
19+
conf: Procfile-single
20+
- version: 3.2.0
21+
conf: Procfile-single
22+
- version: 3.3.0
23+
conf: Procfile-single-enable-v2
24+
- version: 3.4.0
25+
conf: Procfile-single-enable-v2
26+
- version: 3.4.0
27+
conf: Procfile-single-enable-tls
28+
29+
runs-on: "ubuntu-20.04"
30+
env:
31+
OPENRESTY_PREFIX: "/usr/local/openresty"
32+
AUTH_ENDPOINT_V2: http://127.0.0.1:12379
33+
AUTH_ENDPOINT_V3: "127.0.0.1:12379"
34+
AUTH_USER: root
35+
AUTH_PWD: abc123
36+
ETCD_VER: "${{ matrix.version }}"
37+
GOREMAN_CONF: "${{ matrix.conf }}"
38+
39+
steps:
40+
- uses: actions/checkout@v2
41+
42+
- name: setup go
43+
uses: actions/[email protected]
44+
with:
45+
go-version: "1.15"
46+
47+
- name: get dependencies
48+
run: sudo apt install -y cpanminus build-essential libncurses5-dev libreadline-dev libssl-dev perl luarocks
49+
50+
- name: install
51+
run: |
52+
git clone https://github.com/openresty/test-nginx.git test-nginx
53+
sudo luarocks make rockspec/lua-resty-etcd-master-0.1-0.rockspec
54+
wget -qO - https://openresty.org/package/pubkey.gpg | sudo apt-key add -
55+
sudo apt-get -y install software-properties-common
56+
sudo add-apt-repository -y "deb http://openresty.org/package/ubuntu $(lsb_release -sc) main"
57+
sudo apt-get update
58+
sudo apt-get install openresty
59+
sudo luarocks install luacheck > build.log 2>&1 || (cat build.log && exit 1)
60+
sudo luarocks install dkjson > build.log 2>&1 || (cat build.log && exit 1)
61+
make utils
62+
wget https://github.com/etcd-io/etcd/releases/download/v$ETCD_VER/etcd-v$ETCD_VER-linux-amd64.tar.gz
63+
tar xf etcd-v$ETCD_VER-linux-amd64.tar.gz
64+
# run etcd local cluster, startup at localhost:2379, localhost:22379, and localhost:32379
65+
# see more https://github.com/etcd-io/etcd/blob/master/Documentation/dev-guide/local_cluster.md
66+
go get github.com/mattn/goreman
67+
68+
- name: script
69+
run: |
70+
if [[ "$GOREMAN_CONF" == "Procfile-single-enable-tls" ]]; then
71+
export ETCD_ENABLE_TLS=TRUE
72+
export AUTH_ENDPOINT_V2=https://127.0.0.1:12379
73+
export ETCDCTL_EXTRA_OPTS="--insecure-transport=false --insecure-skip-tls-verify=true"
74+
fi
75+
cd test-nginx && (sudo cpanm --notest . > build.log 2>&1 || (cat build.log && exit 1)) && cd ..
76+
export PATH=$OPENRESTY_PREFIX/nginx/sbin:$OPENRESTY_PREFIX/luajit/bin:$PWD/etcd-v$ETCD_VER-linux-amd64:$PATH
77+
etcd --version
78+
goreman -f ./t/$GOREMAN_CONF start > goreman.log 2>&1 &
79+
sleep 5
80+
chmod +x ./t/v2/add-auth.sh
81+
chmod +x ./t/v3/add-auth.sh
82+
[[ $ETCD_ENABLE_TLS != TRUE ]] && ./t/v2/add-auth.sh || true
83+
[[ $ETCD_ENABLE_TLS != TRUE ]] && ./t/v3/add-auth.sh || true
84+
cat goreman.log
85+
ps -ef | grep etcd
86+
luajit -v
87+
luajit -v | awk '{print$2}'| grep 2.1
88+
make lint || exit 1
89+
make test

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,3 +56,4 @@ go
5656
t/servroot
5757
utils/lj-releng
5858
[\.]*
59+
!.github/

.travis.yml

Lines changed: 0 additions & 71 deletions
This file was deleted.

0 commit comments

Comments
 (0)