Merge pull request #20 from webp-sh/better-ci

Better CI
This commit is contained in:
Nova Kwok 2020-03-03 23:10:37 +08:00 committed by GitHub
commit 10fe5e3f80
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 28 additions and 4 deletions

View File

@ -3,16 +3,27 @@ language: go
go: go:
- 1.13 - 1.13
arch:
- amd64
- arm64
- ppc64le
os:
- windows
- osx
- linux
env: GO111MODULE=on env: GO111MODULE=on
script: GOARCH=amd64 go build -o webp-server-linux-amd64 webp-server.go script:
- sh scripts/build.sh $TRAVIS_OS_NAME $TRAVIS_CPU_ARCH
deploy: deploy:
provider: releases provider: releases
api_key: $GITHUB_OAUTH_TOKEN api_key: $GITHUB_OAUTH_TOKEN
file_glob: true
file: builds/*
skip_cleanup: true skip_cleanup: true
file:
- webp-server-linux-amd64
on: on:
repo: webp-sh/webp_server_go repo: webp-sh/webp_server_go
tags: true tags: true

13
scripts/build.sh Normal file
View File

@ -0,0 +1,13 @@
#!/bin/bash
CGO_ENABLED=0
if [ "${1}" == "windows" ]
then
go build -v -ldflags "-s -w" -o builds/webp-server-${1}-${2}.exe
else
go build -v -ldflags "-s -w" -o builds/webp-server-${1}-${2}
fi
echo "build done!"
ls builds

View File

@ -9,5 +9,5 @@ then
elif [[ $platform =~ "x86_64" ]];then elif [[ $platform =~ "x86_64" ]];then
go build -o webp-server-unix-amd64 webp-server.go go build -o webp-server-unix-amd64 webp-server.go
else else
go build -o webp-server-linux-i386 webp-server.go go build -o webp-server-linux-amd64 webp-server.go
fi fi