-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
github actions ci instead of travis
- Loading branch information
Showing
8 changed files
with
197 additions
and
60 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
name: publish | ||
on: | ||
release: | ||
types: | ||
- published | ||
jobs: | ||
publish: | ||
runs-on: ubuntu-20.04 | ||
strategy: | ||
matrix: | ||
goVersion: ["1.10", "1.16"] | ||
env: | ||
GO_VERSION: ${{ matrix.goVersion }} | ||
steps: | ||
- name: Set up Go | ||
uses: actions/setup-go@v2 | ||
with: | ||
go-version: ${{ matrix.goVersion }} | ||
|
||
- name: install dos2unix | ||
run: sudo apt-get install dos2unix | ||
|
||
- name: checkout | ||
uses: actions/checkout@v2 | ||
|
||
- name: build release binaries | ||
run: bash ./tests/build-release.sh | ||
|
||
- name: make archives | ||
run: bash ./tests/make-archives.sh | ||
|
||
- name: ls | ||
run: ls output/ | ||
- name: upload binaries to release | ||
uses: softprops/action-gh-release@v1 | ||
if: startsWith(github.ref, 'refs/tags/') | ||
with: | ||
files: output/* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
name: Test | ||
on: [push, pull_request] | ||
jobs: | ||
test-build: | ||
runs-on: ubuntu-20.04 | ||
|
||
steps: | ||
- uses: actions/checkout@v2 | ||
|
||
- name: Set up Go | ||
uses: actions/setup-go@v2 | ||
with: | ||
go-version: "1.10" | ||
|
||
- name: test-build | ||
run: bash ./tests/build-test.sh | ||
|
||
run-test: | ||
needs: test-build | ||
runs-on: ubuntu-20.04 | ||
strategy: | ||
matrix: | ||
goVersion: ["1.10", "1.16"] | ||
env: | ||
GO_VERSION: ${{ matrix.goVersion }} | ||
steps: | ||
- name: checkout | ||
uses: actions/checkout@v2 | ||
|
||
- name: Test | ||
run: bash ./tests/test.sh | ||
|
||
- name: push coverage | ||
uses: shogo82148/actions-goveralls@v1 | ||
with: | ||
path-to-profile: coverage.out | ||
flag-name: Go-${{ matrix.go }} | ||
parallel: true | ||
|
||
# notifies that all test jobs are finished. | ||
finish: | ||
needs: run-test | ||
runs-on: ubuntu-20.04 | ||
steps: | ||
- uses: shogo82148/actions-goveralls@v1 | ||
with: | ||
parallel-finished: true |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
#!/bin/bash | ||
|
||
set -eux | ||
|
||
REALPATH=$(realpath "$0") | ||
ROOT=$(dirname "$REALPATH") | ||
ROOT=$(dirname "$ROOT") | ||
TESTBUILD_DIR="$ROOT/test-build" | ||
OUTPUT="$ROOT/output" | ||
|
||
rm -rf "$TESTBUILD_DIR" | ||
|
||
export PATH="$GOROOT/bin:$PATH" | ||
( | ||
# prevent modify project's go.mod | ||
cd /tmp | ||
go get github.com/mitchellh/gox | ||
) | ||
export GOPATH="$TESTBUILD_DIR" | ||
DEST="$GOPATH/src/github.com/rekby/lets-proxy2" | ||
mkdir -p "$TESTBUILD_DIR/src/github.com/rekby" | ||
ln -Ts "$ROOT" "$DEST" | ||
cd "$DEST" | ||
|
||
go version | ||
go env | ||
|
||
if [ "$GO_VERSION" = "1.10" ]; then | ||
OS_ARCH_BUILDS="linux/386 linux/amd64 linux/arm freebsd/386 freebsd/amd64 freebsd/arm windows/386 windows/amd64" | ||
else | ||
OS_ARCH_BUILDS="linux/386 linux/amd64 linux/arm freebsd/386 freebsd/amd64 freebsd/arm windows/386 windows/amd64 darwin/amd64" | ||
fi | ||
|
||
GITHUB_TAG="${GITHUB_REF/refs\/tags\//}" | ||
BUILD_TIME=$(TZ=UTC date --rfc-3339=seconds) | ||
|
||
export CGO_ENABLED=0 | ||
gox -osarch "$OS_ARCH_BUILDS" --ldflags "-X \"main.VERSION=$GITHUB_TAG+build-$GITHUB_RUN_ID, Build time $BUILD_TIME, commit $GITHUB_SHA, $GO_VERSION\"" --output="$OUTPUT/lets-proxy_{{.OS}}_{{.Arch}}" -verbose --rebuild ./cmd/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
#!/bin/bash | ||
|
||
set -eux | ||
|
||
REALPATH=$(realpath "$0") | ||
ROOT=$(dirname "$REALPATH") | ||
ROOT=$(dirname "$ROOT") | ||
TESTBUILD_DIR="$ROOT/test-build" | ||
|
||
rm -rf "$TESTBUILD_DIR" | ||
|
||
export GOPATH="$TESTBUILD_DIR" | ||
DEST="$GOPATH/src/github.com/rekby/lets-proxy2" | ||
mkdir -p "$TESTBUILD_DIR/src/github.com/rekby" | ||
ln -Ts "$ROOT" "$DEST" | ||
cd "$DEST" | ||
|
||
go version | ||
go env | ||
go build -v ./... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.