-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use GitHub actions to run golang-ci-lint, cross, and test. The "Test()" target in Mage was a plain "go test -v ./...", and should be portable to other CI systems if needed; running it through the mage file effectively resulted in "compile a go binary to run go". The "Lint()" target in Mage relied on Travis CI setting up Golang-CI lint before it was executed, which required bash. Moving it to GitHub actions also allowed it to be run on Windows. Golang CI can still be run locally either through the mage file (which is kept for now), or running `golangci-lint run ./...` after installing golangci-lint. The "CrossBuild() Mage target is still used to perform cross-compile, as it contains code to generate the GOOS/GOARCH matrix, which makes it easier to run locally. Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
- Loading branch information
Showing
2 changed files
with
62 additions
and
1 deletion.
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,61 @@ | ||
name: CI | ||
|
||
on: | ||
push: | ||
branches: | ||
- master | ||
pull_request: | ||
branches: | ||
- master | ||
|
||
jobs: | ||
|
||
lint: | ||
name: Golang-CI Lint | ||
timeout-minutes: 10 | ||
strategy: | ||
matrix: | ||
platform: [ubuntu-latest, windows-latest] | ||
runs-on: ${{ matrix.platform }} | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: golangci/golangci-lint-action@v2 | ||
with: | ||
# must be specified without patch version | ||
version: v1.36 | ||
cross: | ||
name: Cross | ||
timeout-minutes: 10 | ||
strategy: | ||
matrix: | ||
go-version: [1.16.x] | ||
platform: [ubuntu-latest] | ||
runs-on: ${{ matrix.platform }} | ||
steps: | ||
- name: Install Go | ||
uses: actions/setup-go@v2 | ||
with: | ||
go-version: ${{ matrix.go-version }} | ||
- name: Checkout code | ||
uses: actions/checkout@v2 | ||
- name: Cross | ||
working-directory: ci | ||
run: go run mage.go -v -w ../ crossBuild | ||
|
||
test: | ||
name: Unit test | ||
timeout-minutes: 10 | ||
strategy: | ||
matrix: | ||
go-version: [1.14.x, 1.15.x, 1.16.x] | ||
platform: [ubuntu-latest, windows-latest] | ||
runs-on: ${{ matrix.platform }} | ||
steps: | ||
- name: Install Go | ||
uses: actions/setup-go@v2 | ||
with: | ||
go-version: ${{ matrix.go-version }} | ||
- name: Checkout code | ||
uses: actions/checkout@v2 | ||
- name: Test | ||
run: go test -race -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