Skip to content

Commit 20858db

Browse files
dunglasburaksezer
authored andcommitted
ci: use GitHub Actions to also run the tests on Windows and Mac
1 parent f807163 commit 20858db

File tree

2 files changed

+70
-23
lines changed

2 files changed

+70
-23
lines changed

.github/workflows/ci.yml

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
name: Tests
2+
3+
on:
4+
push:
5+
pull_request:
6+
7+
jobs:
8+
test:
9+
strategy:
10+
# Default is true, cancels jobs for other platforms in the matrix if one fails
11+
fail-fast: false
12+
matrix:
13+
os: [ ubuntu-latest, macos-latest, windows-latest ]
14+
go: [ '1.15' ]
15+
16+
runs-on: ${{ matrix.os }}
17+
18+
steps:
19+
- name: Install Go
20+
uses: actions/setup-go@v2
21+
with:
22+
go-version: ${{ matrix.go }}
23+
24+
- name: Checkout code
25+
uses: actions/checkout@v2
26+
27+
- name: Print Go version and environment
28+
id: vars
29+
run: |
30+
printf "Using go at: $(which go)\n"
31+
printf "Go version: $(go version)\n"
32+
printf "\n\nGo environment:\n\n"
33+
go env
34+
printf "\n\nSystem environment:\n\n"
35+
env
36+
# Calculate the short SHA1 hash of the git commit
37+
echo "::set-output name=short_sha::$(git rev-parse --short HEAD)"
38+
echo "::set-output name=go_cache::$(go env GOCACHE)"
39+
40+
- name: Cache the build cache
41+
uses: actions/cache@v2
42+
with:
43+
path: ${{ steps.vars.outputs.go_cache }}
44+
key: ${{ runner.os }}-${{ matrix.go }}-go-ci-${{ hashFiles('**/go.sum') }}
45+
restore-keys: |
46+
${{ runner.os }}-${{ matrix.go }}-go-ci
47+
48+
- name: Install dependencies
49+
run: |
50+
go mod download
51+
52+
- name: Run tests
53+
run: |
54+
./cover.sh $HOME/build coverage.out
55+
56+
- uses: shogo82148/actions-goveralls@v1
57+
with:
58+
path-to-profile: coverage.out
59+
60+
golangci:
61+
name: Lint
62+
63+
runs-on: ubuntu-latest
64+
65+
steps:
66+
- uses: actions/checkout@v2
67+
- name: golangci-lint
68+
uses: golangci/golangci-lint-action@v2
69+
with:
70+
version: v1.31

.travis.yml

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

0 commit comments

Comments
 (0)