Merge pull request #232 from EasyPost/io #630
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: CI | |
on: | |
push: | |
branches: [master] | |
pull_request: ~ | |
workflow_dispatch: ~ | |
jobs: | |
lint: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout Repository | |
uses: actions/checkout@v4 | |
- uses: actions/setup-go@v4 | |
with: | |
go-version: '1.22' | |
- 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', '1.22'] | |
steps: | |
- name: Checkout Repository | |
uses: actions/checkout@v4 | |
- 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@v4 | |
- 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@v4 | |
- 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 |