Skip to content

Commit 10a2717

Browse files
author
Mrunal Patel
authored
Merge pull request #137 from kolyshkin/gha
ci: switch from travis to github actions
2 parents b458975 + 9612a36 commit 10a2717

3 files changed

Lines changed: 71 additions & 41 deletions

File tree

.github/workflows/validate.yml

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
name: validate
2+
on:
3+
push:
4+
tags:
5+
- v*
6+
branches:
7+
- master
8+
pull_request:
9+
10+
jobs:
11+
12+
commit:
13+
runs-on: ubuntu-20.04
14+
# Only check commits on pull requests.
15+
if: github.event_name == 'pull_request'
16+
steps:
17+
- name: get pr commits
18+
id: 'get-pr-commits'
19+
uses: tim-actions/[email protected]
20+
with:
21+
token: ${{ secrets.GITHUB_TOKEN }}
22+
23+
- name: check subject line length
24+
uses: tim-actions/[email protected]
25+
with:
26+
commits: ${{ steps.get-pr-commits.outputs.commits }}
27+
pattern: '^.{0,72}(\n.*)*$'
28+
error: 'Subject too long (max 72)'
29+
30+
lint:
31+
runs-on: ubuntu-20.04
32+
steps:
33+
- uses: actions/checkout@v2
34+
- uses: golangci/golangci-lint-action@v2
35+
with:
36+
# must be specified without patch version
37+
version: v1.36
38+
# Only show new issues for a pull request.
39+
only-new-issues: true
40+
41+
cross:
42+
runs-on: ubuntu-20.04
43+
steps:
44+
- uses: actions/checkout@v2
45+
- name: cross
46+
run: make build-cross
47+
48+
49+
test:
50+
strategy:
51+
fail-fast: false
52+
matrix:
53+
go-version: [1.14.x, 1.15.x, 1.16.0-rc1]
54+
runs-on: ubuntu-20.04
55+
steps:
56+
- uses: actions/checkout@v2
57+
58+
- name: install go ${{ matrix.go-version }}
59+
uses: actions/setup-go@v2
60+
with:
61+
stable: '!contains(${{ matrix.go-version }}, "beta") && !contains(${{ matrix.go-version }}, "rc")'
62+
go-version: ${{ matrix.go-version }}
63+
64+
- name: build
65+
run: make build
66+
67+
- name: test
68+
run: make test

.travis.yml

Lines changed: 0 additions & 22 deletions
This file was deleted.

Makefile

Lines changed: 3 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -21,30 +21,14 @@ build-cross:
2121
$(call go-build,windows,amd64)
2222
$(call go-build,windows,386)
2323

24-
BUILD_PATH := $(shell pwd)/build
25-
BUILD_BIN_PATH := ${BUILD_PATH}/bin
26-
GOLANGCI_LINT := ${BUILD_BIN_PATH}/golangci-lint
27-
GOLANGCI_INSTALL := https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh
28-
GOLANGCI_VERSION := v1.31.0
29-
30-
.PHONY: check-gopath
31-
check-gopath:
32-
ifndef GOPATH
33-
$(error GOPATH is not set)
34-
endif
3524

3625
.PHONY: test
37-
test: check-gopath
26+
test:
3827
go test -timeout 3m ${TESTFLAGS} -v ./...
3928

40-
${GOLANGCI_LINT}:
41-
curl -sSfL ${GOLANGCI_INSTALL} | sh -s -- -b ${BUILD_BIN_PATH} ${GOLANGCI_VERSION}
42-
4329
.PHONY: lint
44-
lint: ${GOLANGCI_LINT}
45-
${GOLANGCI_LINT} version
46-
${GOLANGCI_LINT} linters
47-
${GOLANGCI_LINT} run
30+
lint:
31+
golangci-lint run
4832

4933
.PHONY: vendor
5034
vendor:

0 commit comments

Comments
 (0)