Skip to content

Commit fb8a113

Browse files
laojianzithinkerouappleboy
authored
ci: add github action workflows (gin-gonic#2596)
* ci: add github action workflows * test: fixed the TestUnixSocket test on windows (gin-gonic#20) * ci: add github action workflows (gin-gonic#18) * Remove .travis.yml * ci: replace GITTER_ROOM_ID and upload coverage every time you go test * ci: update coverage using codecov/codecov-action@v1 * Merge branch 'master' into github-actions * repo: replace travis ci to github actions * ci: add go version 1.16 * fix: go install requires a specific version * chore(ci): remove go 1.12 support * chore(ci): remove os windows-latest Co-authored-by: thinkerou <thinkerou@gmail.com> Co-authored-by: Bo-Yi Wu <appleboy.tw@gmail.com>
1 parent a8857ed commit fb8a113

File tree

6 files changed

+73
-57
lines changed

6 files changed

+73
-57
lines changed

.github/PULL_REQUEST_TEMPLATE.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
- With pull requests:
22
- Open your pull request against `master`
33
- Your pull request should have no more than two commits, if not you should squash them.
4-
- It should pass all tests in the available continuous integration systems such as TravisCI.
4+
- It should pass all tests in the available continuous integration systems such as GitHub Actions.
55
- You should add/modify tests to cover your proposed code changes.
66
- If your pull request contains a new feature, please document it on the README.
77

.github/workflows/gin.yml

+62
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
name: Run Tests
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
pull_request:
8+
branches:
9+
- master
10+
11+
jobs:
12+
test:
13+
strategy:
14+
matrix:
15+
os: [ubuntu-latest, macos-latest]
16+
go: [1.13, 1.14, 1.15, 1.16]
17+
test-tags: ['', nomsgpack]
18+
name: ${{ matrix.os }} @ Go ${{ matrix.go }} ${{ matrix.test-tags }}
19+
runs-on: ${{ matrix.os }}
20+
env:
21+
GO111MODULE: on
22+
TESTTAGS: ${{ matrix.test-tags }}
23+
GOPROXY: https://proxy.golang.org
24+
steps:
25+
- name: Set up Go ${{ matrix.go }}
26+
uses: actions/setup-go@v2
27+
with:
28+
go-version: ${{ matrix.go }}
29+
30+
- name: Checkout Code
31+
uses: actions/checkout@v2
32+
with:
33+
ref: ${{ github.ref }}
34+
35+
- name: Install Dependencies
36+
run: make tools
37+
38+
- name: Run Check
39+
run: |
40+
make vet
41+
make fmt-check
42+
make misspell-check
43+
44+
- name: Run Tests
45+
run: make test
46+
47+
- name: Upload coverage to Codecov
48+
uses: codecov/codecov-action@v1
49+
notification-gitter:
50+
needs: test
51+
runs-on: ubuntu-latest
52+
steps:
53+
- name: Notification failure message
54+
if: failure()
55+
run: |
56+
PR_OR_COMPARE="$(if [ "${{ github.event.pull_request }}" != "" ]; then echo "${{ github.event.pull_request.html_url }}"; else echo "${{ github.event.compare }}"; fi)"
57+
curl -d message="GitHub Actions [$GITHUB_REPOSITORY]($PR_OR_COMPARE) ($GITHUB_REF) [normal]($GITHUB_API_URL/$GITHUB_REPOSITORY/actions/runs/$GITHUB_RUN_ID) ($GITHUB_RUN_NUMBER)" -d level=error https://webhooks.gitter.im/e/7f95bf605c4d356372f4
58+
- name: Notification success message
59+
if: success()
60+
run: |
61+
PR_OR_COMPARE="$(if [ "${{ github.event.pull_request }}" != "" ]; then echo "${{ github.event.pull_request.html_url }}"; else echo "${{ github.event.compare }}"; fi)"
62+
curl -d message="GitHub Actions [$GITHUB_REPOSITORY]($PR_OR_COMPARE) ($GITHUB_REF) [normal]($GITHUB_API_URL/$GITHUB_REPOSITORY/actions/runs/$GITHUB_RUN_ID) ($GITHUB_RUN_NUMBER)" https://webhooks.gitter.im/e/7f95bf605c4d356372f4

.travis.yml

-52
This file was deleted.

CONTRIBUTING.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,6 @@
88
- With pull requests:
99
- Open your pull request against `master`
1010
- Your pull request should have no more than two commits, if not you should squash them.
11-
- It should pass all tests in the available continuous integration systems such as TravisCI.
11+
- It should pass all tests in the available continuous integration systems such as GitHub Actions.
1212
- You should add/modify tests to cover your proposed code changes.
1313
- If your pull request contains a new feature, please document it on the README.

Makefile

+8-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
GO ?= go
22
GOFMT ?= gofmt "-s"
3+
GO_VERSION=$(shell $(GO) version | cut -c 14- | cut -d' ' -f1 | cut -d'.' -f2)
34
PACKAGES ?= $(shell $(GO) list ./...)
45
VETPACKAGES ?= $(shell $(GO) list ./... | grep -v /examples/)
56
GOFILES := $(shell find . -name "*.go")
@@ -67,5 +68,10 @@ misspell:
6768

6869
.PHONY: tools
6970
tools:
70-
go install golang.org/x/lint/golint; \
71-
go install github.com/client9/misspell/cmd/misspell;
71+
@if [ $(GO_VERSION) -gt 15 ]; then \
72+
$(GO) install golang.org/x/lint/golint@latest; \
73+
$(GO) install github.com/client9/misspell/cmd/misspell@latest; \
74+
elif [ $(GO_VERSION) -lt 16 ]; then \
75+
$(GO) install golang.org/x/lint/golint; \
76+
$(GO) install github.com/client9/misspell/cmd/misspell; \
77+
fi

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
<img align="right" width="159px" src="https://raw.githubusercontent.com/gin-gonic/logo/master/color.png">
44

5-
[![Build Status](https://travis-ci.org/gin-gonic/gin.svg)](https://travis-ci.org/gin-gonic/gin)
5+
[![Build Status](https://github.com/gin-gonic/gin/workflows/Run%20Tests/badge.svg?branch=master)](https://github.com/gin-gonic/gin/actions?query=branch%3Amaster)
66
[![codecov](https://codecov.io/gh/gin-gonic/gin/branch/master/graph/badge.svg)](https://codecov.io/gh/gin-gonic/gin)
77
[![Go Report Card](https://goreportcard.com/badge/github.com/gin-gonic/gin)](https://goreportcard.com/report/github.com/gin-gonic/gin)
88
[![GoDoc](https://pkg.go.dev/badge/github.com/gin-gonic/gin?status.svg)](https://pkg.go.dev/github.com/gin-gonic/gin?tab=doc)

0 commit comments

Comments
 (0)