-
Notifications
You must be signed in to change notification settings - Fork 2
56 lines (46 loc) · 1.36 KB
/
go.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
name: Go
on: [push]
jobs:
build:
name: Build
runs-on: ubuntu-latest
steps:
- name: Set up Go 1.18
uses: actions/setup-go@v1
with:
go-version: 1.18
id: go
- name: Check out code into the Go module directory
uses: actions/checkout@v1
- name: Get dependencies
run: |
go get -v -t -d ./...
go get golang.org/x/tools/cmd/goimports
- name: Formatting
run: gofmt -l . | if [ $(grep -c -o -E ".*") -gt 0 ]; then return 1; fi
- name: Imports
run: |
`go list -f {{.Target}} golang.org/x/tools/cmd/goimports` -l . | if [ $(grep -c -o -E ".*") -gt 0 ]; then return 1; fi
- name: Build
run: go build -v ./...
- name: Test
run: go test -race -coverprofile=coverage.txt -covermode=atomic ./...
- name: Run Samples
run: |
shopt -s globstar
for i in examples/**/main.go; do
echo "\nRunning $i\n"
go build -o binoutput github.com/saantiaguilera/go-pipeline/$(dirname $i)
./binoutput
if [ $? -ne 0 ]; then
rm binoutput
exit 1
fi
rm binoutput
done
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v1
with:
token: ${{ secrets.CODECOV_TOKEN }}
fail_ci_if_error: true
yml: ./codecov.yml