Skip to content

Commit

Permalink
Migrate to GitHub actions (#587)
Browse files Browse the repository at this point in the history
* Migrate to GitHub actions

* Install golint

* Don't fetch all tags for normal builds

* Build zips for Windows

* Build & upload release assets

* Remove travis

* Add job names
  • Loading branch information
der-eismann committed Jan 13, 2021
1 parent 1710d34 commit dfb7298
Show file tree
Hide file tree
Showing 4 changed files with 67 additions and 29 deletions.
30 changes: 30 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: Golang CI

on:
push:
branches: [master]
pull_request:
types: [opened, reopened, synchronize]
schedule:
- cron: '15 3 * * 0'

jobs:
build:
name: CI Build
runs-on: ubuntu-latest
steps:
- name: Setup Go
uses: actions/setup-go@v2
with:
go-version: '1.15'
- name: Setup tools
run: |
go get golang.org/x/lint/golint
- name: Checkout code
uses: actions/checkout@v2
- name: Test Project
run: |
make test
- name: Build Project
run: |
make
32 changes: 32 additions & 0 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: Publish release artifacts

on:
release:
type: [created]

jobs:
release:
name: Publish binaries
runs-on: ubuntu-latest
steps:
- name: Setup Go
uses: actions/setup-go@v2
with:
go-version: '1.15'
- name: Checkout code
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Build Project binaries
env:
CGO_ENABLED: 0
run: |
make xc
- name: Upload binaries to release
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: dist/aws*
tag: ${{ github.ref }}
overwrite: true
file_glob: true
29 changes: 0 additions & 29 deletions .travis.yml

This file was deleted.

5 changes: 5 additions & 0 deletions golang.mk
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ GOPKGS=$(shell go list ./...)

OUTPUT_FILE=$(NAME)-$(BUILD_VERSION)-$(shell go env GOOS)-$(shell go env GOARCH)$(shell go env GOARM)$(shell go env GOEXE)
OUTPUT_LINK=$(NAME)$(shell go env GOEXE)
WINDOWS_ZIP=$(shell echo $(OUTPUT_FILE) | sed 's/\.exe/\.zip/')

default: build

Expand Down Expand Up @@ -69,7 +70,11 @@ build: go_generate _build
$(foreach TARGET,$(TARGETS),ln -sf $(OUTPUT_FILE) dist/$(OUTPUT_LINK);)

compress: _build
ifeq ($(GOOS),windows)
zip -j dist/$(WINDOWS_ZIP) dist/$(OUTPUT_FILE)
else
tar czf dist/$(OUTPUT_FILE).tar.gz -C dist $(OUTPUT_FILE)
endif
rm -f dist/$(OUTPUT_FILE)

xc: go_generate
Expand Down

0 comments on commit dfb7298

Please sign in to comment.