Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: remove the dependency on git from the build script #1024

Merged
merged 6 commits into from
Dec 12, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
67 changes: 67 additions & 0 deletions .github/workflows/release-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
name: Release Test

on:
push:
branches:
- master
pull_request:
branches:
- master

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@v1
with:
go-version: '1.13'

- name: release and build
run: |
VERSION=$(cat ./api/VERSION)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a duplicate file like Makefile, could we use only one of them?

mkdir release
git clean -Xdf
tar -zcvf release/apache-apisix-dashboard-${VERSION}-src.tgz \
--exclude .github \
--exclude .git \
--exclude .gitattributes \
--exclude .idea \
--exclude .vscode \
--exclude .gitignore \
--exclude .DS_Store \
--exclude docs \
--exclude release \
--exclude api/internal/core/store/validate_mock.go \
--exclude api/internal/core/storage/storage_mock.go \
.

cd release
tar -zxvf apache-apisix-dashboard-${VERSION}-src.tgz
ls -l
export GO111MOUDULE=on
api/build.sh
mkdir -p ./output/logs
cd output
./manager-api > ./api.log 2>&1 &

- name: run test
run: |
curl http://127.0.0.1:9000/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:9000/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
3 changes: 1 addition & 2 deletions api/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ export ENV=local
pwd=`pwd`

VERSION=$(cat ./api/VERSION)
GIT_VERSION=$(git log -1 --pretty=format:%h)

rm -rf output && mkdir -p output/conf && mkdir -p output/dag-to-lua

Expand All @@ -32,7 +31,7 @@ if [[ ! -f "dag-to-lua-1.1/lib/dag-to-lua.lua" ]]; then
fi

# build
cd ./api && go build -o ../output/manager-api -ldflags "-X main.Version=${VERSION}(${GIT_VERSION})" . && cd ..
cd ./api && go build -o ../output/manager-api -ldflags "-X main.Version=${VERSION}" . && cd ..

cp ./api/conf/schema.json ./output/conf/schema.json
cp ./api/conf/conf.yaml ./output/conf/conf.yaml
Expand Down