Skip to content

Commit 04ebfd5

Browse files
authored
Setting up a CI pipeline based on GitHub Actions (#321)
* Setting up a CI pipeline based on GitHub Actions * Handling vanity import path * Correcting for GOPATH * Fixed GOPATH * Update ci.yml * Update ci.yml * Update ci.yml * Running unit tests regardless of linter output * Running unit tests independent of linter status
1 parent 3ca24dd commit 04ebfd5

File tree

1 file changed

+49
-0
lines changed

1 file changed

+49
-0
lines changed

.github/workflows/ci.yml

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
name: Go Continuous Integration
2+
on: [push, pull_request]
3+
jobs:
4+
5+
build:
6+
name: Build
7+
runs-on: ubuntu-latest
8+
env:
9+
GOPATH: ${{ github.workspace }}/go
10+
strategy:
11+
matrix:
12+
go: [1.11, 1.12, 1.13]
13+
steps:
14+
15+
- name: Set up Go ${{ matrix.go }}
16+
uses: actions/setup-go@v1
17+
with:
18+
go-version: ${{ matrix.go }}
19+
id: go
20+
21+
- name: Check out code into GOPATH
22+
uses: actions/checkout@v2
23+
with:
24+
path: go/src/firebase.google.com/go
25+
26+
- name: Get dependencies
27+
run: go get -t -v $(go list ./... | grep -v integration)
28+
29+
- name: Run Linter
30+
run: |
31+
go get golang.org/x/lint/golint
32+
$GOPATH/bin/golint -set_exit_status firebase.google.com/go/...
33+
34+
- name: Run Unit Tests
35+
if: success() || failure()
36+
run: go test -v -race -test.short firebase.google.com/go/...
37+
38+
- name: Run Formatter
39+
working-directory: ./go/src/firebase.google.com/go
40+
if: matrix.go != '1.11'
41+
run: |
42+
if [[ ! -z "$(gofmt -l -s .)" ]]; then
43+
echo "Go code is not formatted:"
44+
gofmt -d -s .
45+
exit 1
46+
fi
47+
48+
- name: Run Static Analyzer
49+
run: go vet -v firebase.google.com/go/...

0 commit comments

Comments
 (0)