From bf801c26053f854ce18ded10ddfcec87ecb6962d Mon Sep 17 00:00:00 2001 From: Serge Smertin Date: Mon, 16 May 2022 13:02:12 +0200 Subject: [PATCH] run tests on push or PR --- .github/workflows/push.yml | 47 ++++++++++++++++++++++++++++++++++++++ .gitignore | 5 +++- README.md | 2 ++ project/config.go | 2 +- 4 files changed, 54 insertions(+), 2 deletions(-) create mode 100644 .github/workflows/push.yml diff --git a/.github/workflows/push.yml b/.github/workflows/push.yml new file mode 100644 index 0000000000..c2297f16e9 --- /dev/null +++ b/.github/workflows/push.yml @@ -0,0 +1,47 @@ +name: build + +on: + pull_request: + types: [opened, synchronize] + push: + branches: [master] + +jobs: + tests: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v2 + + - name: Unshallow + run: git fetch --prune --unshallow + + - name: Set up Go + uses: actions/setup-go@v1 + with: + go-version: 1.16.x + + - name: Cache packages + uses: actions/cache@v2 + with: + path: | + ~/go/pkg/mod + ~/.cache/go-build + /opt/hostedtoolcache/go + vendor + key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} + restore-keys: | + ${{ runner.os }}-go- + + - name: Set go env + run: | + echo "GOPATH=$(go env GOPATH)" >> $GITHUB_ENV + echo "$(go env GOPATH)/bin" >> $GITHUB_PATH + go get gotest.tools/gotestsum + go install honnef.co/go/tools/cmd/staticcheck@v0.2.2 + + - name: Pull external libraries + run: make vendor + + - name: Run tests + run: make test diff --git a/.gitignore b/.gitignore index 7d19b3bf74..2af3ee7f34 100644 --- a/.gitignore +++ b/.gitignore @@ -14,4 +14,7 @@ bricks # Dependency directories (remove the comment below to include it) vendor/ -dist/ \ No newline at end of file +dist/ + +*.log +coverage.txt \ No newline at end of file diff --git a/README.md b/README.md index 5efbb2364a..ddb8063db3 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,7 @@ # Bricks! +[![build](https://github.com/databricks/bricks/workflows/build/badge.svg?branch=main)](https://github.com/databricks/bricks/actions?query=workflow%3Abuild+branch%3Amain) + This is an early PoC at this stage! `make build` (or [download the latest from releases page](https://github.com/databricks/bricks/releases)). diff --git a/project/config.go b/project/config.go index 8c9ab3378c..13bac13faf 100644 --- a/project/config.go +++ b/project/config.go @@ -65,7 +65,7 @@ func (p *Project) IsDevClusterJustReference() bool { if p.DevCluster.ClusterName == "" { return false } - return reflect.DeepEqual(p.DevCluster, clusters.Cluster{ + return reflect.DeepEqual(p.DevCluster, &clusters.Cluster{ ClusterName: p.DevCluster.ClusterName, }) }