blob: 2a8dd832f3d6ec12a8586fae8e920f0511df1352 [file] [log] [blame]
name: Backend Unit Test
on:
push:
branches:
- master
pull_request:
branches:
- master
- v2.0
jobs:
run-test:
runs-on: ubuntu-latest
services:
etcd:
image: bitnami/etcd:3.4.13
ports:
- 2379:2379
- 2380:2380
env:
ALLOW_NONE_AUTHENTICATION: yes
steps:
- uses: actions/checkout@v2
- name: get lua lib
run: |
wget https://github.com/api7/dag-to-lua/archive/v1.1.tar.gz
sudo mkdir -p ./api/dag-to-lua
tar -zxvf v1.1.tar.gz
sudo mv ./dag-to-lua-1.1/lib/* ./api/dag-to-lua/
- name: setup go
uses: actions/setup-go@v1
with:
go-version: '1.13'
- name: setup lua
run: |
sudo apt-get update
sudo apt-get install lua5.1
- name: run test
run: |
make api-test
- name: upload coverage profile
working-directory: ./api
run: |
bash <(curl -s https://codecov.io/bash)
- name: run with custom port
working-directory: ./api
run: |
export GO111MOUDULE=on
export APISIX_CONF_PATH=$PWD/conf
sed -i 's/8080/8088/' conf/conf.yaml
go build -o ./manager-api
./manager-api > ./api.log 2>&1 &
sleep 2
cat ./api.log
cat conf/conf.yaml
- name: run with custom port
working-directory: ./api
run: |
curl http://127.0.0.1:8088/apisix/admin/user/login -X POST -i -d '{"username":"admin", "password": "admin"}'
code=$(curl -k -i -m 20 -o /dev/null -s -w %{http_code} http://127.0.0.1:8088/apisix/admin/user/login -X POST -i -d '{"username":"admin", "password": "admin"}')
if [ ! $code -eq 200 ]; then
echo "failed: failed to custom port"
exit 1
fi