blob: 8a10bcbd6a0a12a36159ccf19d81434f517549c3 [file] [log] [blame]
name: Backend Unit Test
on:
push:
branches:
- master
paths-ignore:
- 'docs/**'
- 'web/**'
pull_request:
branches:
- master
paths-ignore:
- 'docs/**'
- 'web/**'
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: setup go
uses: actions/setup-go@v2.1.3
with:
go-version: "1.13"
- name: run test
run: |
make api-test
- name: upload coverage profile
working-directory: ./api
run: |
bash <(curl -s https://codecov.io/bash) -F backend-unit-test
- name: run with custom port
working-directory: ./api
run: |
export GO111MOUDULE=on
export APISIX_CONF_PATH=$PWD/conf
sed -i 's/9000/8088/' conf/conf.yaml
go build -o ./manager-api ./cmd/manager
./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