-
Notifications
You must be signed in to change notification settings - Fork 17
74 lines (72 loc) · 2.39 KB
/
ci.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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
name: CI
on:
push:
branches: [master]
pull_request: ~
workflow_dispatch: ~
jobs:
lint:
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v3
- uses: actions/setup-go@v4
with:
go-version: '1.20'
- name: Install dependencies
run: make install
# curl installs must occur in the same step as the linter to run properly on CI
- name: Lint project
run: |
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin
curl -sSfL https://raw.githubusercontent.com/securego/gosec/master/install.sh | sh -s -- -b $(go env GOPATH)/bin
make lint
build:
runs-on: ubuntu-latest
strategy:
matrix:
go-version: ['1.16', '1.17', '1.18', '1.19', '1.20', '1.21']
steps:
- name: Checkout Repository
uses: actions/checkout@v3
- name: use golang ${{ matrix.go-version }}
uses: actions/setup-go@v4
with:
go-version: ${{ matrix.go-version }}
- name: install
run: make install
- name: run tests
run: EASYPOST_TEST_API_KEY=123 EASYPOST_PROD_API_KEY=123 make test
coverage:
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v3
- uses: actions/setup-go@v4
with:
go-version: '1.19' # TODO: There is a bug in 1.20 that isn't calculating coverage correctly
- name: Install dependencies
run: make install
- name: Analyze coverage
run: EASYPOST_TEST_API_KEY=123 EASYPOST_PROD_API_KEY=123 make coverage
coveralls:
if: github.ref == 'refs/heads/master'
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v3
- uses: actions/setup-go@v4
with:
go-version: '1.19' # TODO: There is a bug in 1.20 that isn't calculating coverage correctly
- name: Install dependencies
run: make install
- name: analyze coverage
run: EASYPOST_TEST_API_KEY=123 EASYPOST_PROD_API_KEY=123 make coverage
- name: Install goveralls
env:
GO111MODULE: off
run: go get github.com/mattn/goveralls
- name: Coveralls
env:
COVERALLS_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: goveralls -coverprofile=covprofile -service=github