databricks-cli/.github/workflows/push.yml

66 lines
1.5 KiB
YAML
Raw Normal View History

2022-05-16 11:02:12 +00:00
name: build
on:
pull_request:
types: [opened, synchronize]
push:
2022-05-16 11:03:02 +00:00
branches: [main]
2022-05-16 11:02:12 +00:00
jobs:
tests:
runs-on: ubuntu-latest
steps:
- name: Checkout repository and submodules
2022-05-16 11:02:12 +00:00
uses: actions/checkout@v2
with:
token: ${{ secrets.DECO_GITHUB_TOKEN }}
submodules: recursive
2022-05-16 11:02:12 +00:00
- name: Unshallow
run: git fetch --prune --unshallow
- name: Setup Go
uses: actions/setup-go@v3
2022-05-16 11:02:12 +00:00
with:
go-version: 1.18.x
cache: true
2022-05-16 11:02:12 +00:00
- name: Set go env
run: |
echo "GOPATH=$(go env GOPATH)" >> $GITHUB_ENV
echo "$(go env GOPATH)/bin" >> $GITHUB_PATH
go install gotest.tools/gotestsum@latest
go install honnef.co/go/tools/cmd/staticcheck@latest
2022-05-16 11:02:12 +00:00
- name: Pull external libraries
run: make vendor
- name: Run tests
run: make test
2022-09-07 13:15:23 +00:00
fmt:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
2022-09-07 13:15:23 +00:00
- name: Setup Go
uses: actions/setup-go@v3
2022-09-07 13:15:23 +00:00
with:
go-version: 1.18.x
# No need to download cached dependencies when running gofmt.
cache: false
2022-09-07 13:15:23 +00:00
- name: Run gofmt
run: |
# -l: list files that were reformatted
# -w: write back formatted files to disk
gofmt -l -w ./
- name: Fail on differences
run: |
# Exit with status code 1 if there are differences (i.e. unformatted files)
git diff --exit-code