2021-01-05 21:08:14 +08:00
|
|
|
name: CI
|
2020-07-09 12:15:17 +08:00
|
|
|
|
|
|
|
on:
|
|
|
|
push:
|
2021-02-19 09:09:33 +08:00
|
|
|
branches: [master, 'release/**']
|
2021-04-02 15:26:24 +08:00
|
|
|
paths-ignore:
|
|
|
|
- 'docs/**'
|
2020-07-09 12:15:17 +08:00
|
|
|
pull_request:
|
2020-12-18 08:29:17 +08:00
|
|
|
branches: [master]
|
2021-04-02 15:26:24 +08:00
|
|
|
paths-ignore:
|
|
|
|
- 'docs/**'
|
2020-07-09 12:15:17 +08:00
|
|
|
|
|
|
|
jobs:
|
|
|
|
build:
|
|
|
|
strategy:
|
|
|
|
fail-fast: false
|
|
|
|
matrix:
|
2020-10-30 08:34:03 +08:00
|
|
|
platform:
|
|
|
|
- ubuntu-18.04
|
|
|
|
os_name:
|
|
|
|
- linux_openresty
|
2020-11-30 10:32:35 +08:00
|
|
|
- linux_openresty_1_17
|
2020-10-30 08:34:03 +08:00
|
|
|
- linux_tengine
|
|
|
|
- linux_apisix_master_luarocks
|
|
|
|
- linux_apisix_current_luarocks
|
|
|
|
- linux_openresty_mtls
|
2020-07-09 12:15:17 +08:00
|
|
|
|
|
|
|
runs-on: ${{ matrix.platform }}
|
|
|
|
env:
|
|
|
|
SERVER_NAME: ${{ matrix.os_name }}
|
2020-11-30 10:32:35 +08:00
|
|
|
OPENRESTY_VERSION: default
|
2020-07-09 12:15:17 +08:00
|
|
|
|
|
|
|
|
2020-10-28 23:41:14 +08:00
|
|
|
services:
|
|
|
|
etcd:
|
|
|
|
image: bitnami/etcd:3.4.0
|
2020-12-15 08:56:20 +08:00
|
|
|
ports:
|
2020-10-28 23:41:14 +08:00
|
|
|
- 2379:2379
|
|
|
|
- 2380:2380
|
2020-12-15 08:56:20 +08:00
|
|
|
env:
|
2020-10-28 23:41:14 +08:00
|
|
|
ALLOW_NONE_AUTHENTICATION: yes
|
|
|
|
ETCD_ADVERTISE_CLIENT_URLS: http://0.0.0.0:2379
|
|
|
|
|
2020-11-24 18:48:45 +08:00
|
|
|
old_etcd:
|
|
|
|
image: bitnami/etcd:3.3.8
|
2020-12-15 08:56:20 +08:00
|
|
|
ports:
|
2020-11-24 18:48:45 +08:00
|
|
|
- 3379:2379
|
|
|
|
- 3380:2380
|
2020-12-15 08:56:20 +08:00
|
|
|
env:
|
2020-11-24 18:48:45 +08:00
|
|
|
ALLOW_NONE_AUTHENTICATION: yes
|
|
|
|
ETCD_ADVERTISE_CLIENT_URLS: http://0.0.0.0:2379
|
|
|
|
|
2020-07-17 15:27:08 +08:00
|
|
|
steps:
|
2020-07-09 12:15:17 +08:00
|
|
|
- name: Check out code
|
|
|
|
uses: actions/checkout@v2
|
2020-11-30 10:32:35 +08:00
|
|
|
with:
|
|
|
|
submodules: recursive
|
2020-07-09 12:15:17 +08:00
|
|
|
|
2021-02-19 09:09:33 +08:00
|
|
|
- name: Extract branch name
|
2021-03-03 17:59:59 +08:00
|
|
|
if: ${{ startsWith(github.ref, 'refs/heads/release/') }}
|
2021-02-19 09:09:33 +08:00
|
|
|
id: branch_env
|
|
|
|
shell: bash
|
|
|
|
run: |
|
|
|
|
echo "##[set-output name=version;]$(echo ${GITHUB_REF##*/})"
|
|
|
|
echo "##[set-output name=fullname;]$(echo apache-apisix-${GITHUB_REF##*/}-src.tgz)"
|
|
|
|
|
|
|
|
- name: Create tarball
|
|
|
|
if: ${{ startsWith(github.ref, 'refs/heads/release/') && !endsWith(matrix.os_name, 'luarocks') }}
|
|
|
|
run: |
|
|
|
|
export VERSION=${{ steps.branch_env.outputs.version }}
|
|
|
|
make compress-tar
|
|
|
|
|
|
|
|
- name: Remove source code
|
|
|
|
if: ${{ startsWith(github.ref, 'refs/heads/release/') && !endsWith(matrix.os_name, 'luarocks') }}
|
|
|
|
run: |
|
2021-03-29 23:34:01 +08:00
|
|
|
rm -rf $(ls -1 --ignore=*.tgz --ignore=ci --ignore=t --ignore=utils --ignore=.github)
|
2021-02-19 09:09:33 +08:00
|
|
|
tar zxvf ${{ steps.branch_env.outputs.fullname }}
|
|
|
|
|
2020-07-09 12:15:17 +08:00
|
|
|
- name: Linux Get dependencies
|
2020-10-28 23:41:14 +08:00
|
|
|
run: sudo apt install -y cpanminus build-essential libncurses5-dev libreadline-dev libssl-dev perl
|
2020-07-09 12:15:17 +08:00
|
|
|
|
|
|
|
- name: Linux Before install
|
2021-03-29 23:34:01 +08:00
|
|
|
run: sudo ./ci/${{ matrix.os_name }}_runner.sh before_install
|
2020-07-09 12:15:17 +08:00
|
|
|
|
2021-01-20 09:47:09 +08:00
|
|
|
- name: Start Dubbo Backend
|
|
|
|
if: matrix.os_name == 'linux_openresty'
|
|
|
|
run: |
|
|
|
|
sudo apt install -y maven
|
|
|
|
cd t/lib/dubbo-backend
|
|
|
|
mvn package
|
|
|
|
cd dubbo-backend-provider/target
|
|
|
|
java -Djava.net.preferIPv4Stack=true -jar dubbo-demo-provider.one-jar.jar > /tmp/java.log &
|
|
|
|
|
2020-10-17 08:21:47 +08:00
|
|
|
- name: Install Redis Cluster
|
2021-01-11 17:53:57 +08:00
|
|
|
if: startsWith(matrix.os_name, 'linux_openresty')
|
2020-12-28 11:21:16 +08:00
|
|
|
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
|
2020-10-17 08:21:47 +08:00
|
|
|
|
|
|
|
- name: Running Redis Cluster Test
|
2021-01-11 17:53:57 +08:00
|
|
|
if: startsWith(matrix.os_name, 'linux_openresty')
|
2020-10-17 08:21:47 +08:00
|
|
|
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
|
|
|
|
|
2020-11-03 13:53:39 +08:00
|
|
|
- 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 \
|
|
|
|
-e GITHUB_ACTIONS=true \
|
|
|
|
-e CI=true \
|
|
|
|
-v ${{ github.workspace }}/t/certs:/certs \
|
|
|
|
bitnami/etcd:3.4.0
|
|
|
|
|
2021-03-23 20:03:21 +08:00
|
|
|
- name: Running etcd server with mTLS
|
|
|
|
run: |
|
|
|
|
sudo docker run -d --rm --name etcd_mtls \
|
|
|
|
-p 22379:22379 -p 22380:22380 \
|
|
|
|
-e ALLOW_NONE_AUTHENTICATION=yes \
|
|
|
|
-e ETCD_ADVERTISE_CLIENT_URLS=https://0.0.0.0:22379 \
|
|
|
|
-e ETCD_LISTEN_CLIENT_URLS=https://0.0.0.0:22379 \
|
|
|
|
-e ETCD_CERT_FILE=/certs/mtls_server.crt \
|
|
|
|
-e ETCD_KEY_FILE=/certs/mtls_server.key \
|
|
|
|
-e ETCD_CLIENT_CERT_AUTH=true \
|
|
|
|
-e ETCD_TRUSTED_CA_FILE=/certs/mtls_ca.crt \
|
|
|
|
-e GITHUB_ACTIONS=true \
|
|
|
|
-e CI=true \
|
|
|
|
-v ${{ github.workspace }}/t/certs:/certs \
|
|
|
|
bitnami/etcd:3.4.0
|
|
|
|
|
2020-07-09 12:15:17 +08:00
|
|
|
- name: Linux Install
|
2020-11-30 10:32:35 +08:00
|
|
|
run: |
|
|
|
|
sudo --preserve-env=OPENRESTY_VERSION \
|
2021-03-29 23:34:01 +08:00
|
|
|
./ci/${{ matrix.os_name }}_runner.sh do_install
|
2020-07-09 12:15:17 +08:00
|
|
|
|
|
|
|
- name: Linux Script
|
2021-03-29 23:34:01 +08:00
|
|
|
run: sudo ./ci/${{ matrix.os_name }}_runner.sh script
|
2021-02-19 09:09:33 +08:00
|
|
|
|
|
|
|
- name: Publish Artifact
|
|
|
|
if: ${{ startsWith(github.ref, 'refs/heads/release/') && matrix.os_name == 'linux_openresty' }}
|
2021-04-07 15:39:28 +08:00
|
|
|
uses: actions/upload-artifact@v2.2.3
|
2021-02-19 09:09:33 +08:00
|
|
|
with:
|
|
|
|
name: ${{ steps.branch_env.outputs.fullname }}
|
|
|
|
path: ${{ steps.branch_env.outputs.fullname }}
|