Skip to content

Commit

Permalink
Create main.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
timothy-king authored Aug 5, 2022
1 parent d5a93ee commit a29fcff
Showing 1 changed file with 73 additions and 0 deletions.
73 changes: 73 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
# This workflow is triggered on push or pull request for the master branch.
# It verifies that the code is safe to merge.
---
name: CI

# yamllint disable-line rule:truthy
on:
push:
branches: [master]
pull_request:
branches: [master]

env:
GO_VERSION: "1.14"

jobs:
lint:
name: Lint
runs-on: ubuntu-latest
steps:
- name: Setup Go
uses: actions/setup-go@v2
with:
go-version: ${{ env.GO_VERSION }}

- name: Checkout code
uses: actions/checkout@v1

- name: Check goimports
if: ${{ always() }}
run: |
go install golang.org/x/tools/cmd/goimports
if [[ $(goimports -l cmd internal pkg) ]]; then
echo 'Please run `goimports -w cmd internal pkg`.'
false
fi
- name: Check go mod
if: ${{ always() }}
run: |
go mod tidy
if ! git diff --quiet; then
echo 'Please run `go mod tidy`.'
false
fi
- name: Check for license headers
if: ${{ always() }}
run: |
go get -u github.com/google/addlicense
addlicense -check cmd internal pkg
- name: Run staticcheck
if: ${{ always() }}
run: |
go install honnef.co/go/tools/cmd/staticcheck
staticcheck ./...
- name: Check YAML
if: ${{ always() }}
run: |
yamllint .
test:
name: Test
runs-on: ubuntu-latest
steps:
- name: Setup Go
uses: actions/setup-go@v2
with:
go-version: ${{ env.GO_VERSION }}

- name: Checkout code
uses: actions/checkout@v1

- name: Run tests
run: |
go test -v ./...

0 comments on commit a29fcff

Please sign in to comment.