Skip to content

Commit

Permalink
ci: improve Go test steps
Browse files Browse the repository at this point in the history
The following improvements have been made:

* Updated the Go version from 1.13 to 1.15. This is done for two reason.
  First, we should always aim to use the latest version, this is a
  common theme in Go projects and each version provides more performance
  or overall UX improvements we need. Second, starting with Go 1.14, the
  `go` commandline CLI now automatically detects the `vendor/` folder
  and uses that during `go build` and `go test`. This is needed so the
  CI detects any inconsistencies during a pull request and that the
  source code is 100% buildable.

* I removed the `Get dependencies` part because we're vendoring the
  source code and `go get` makes a network call to fetch dependencies.
  We don't need to fetch the dependencies again, because our source of
  truth is the `vendor/` folder. Also, this particular step breaks our
  CI if we start using private dependencies (i.e:
  planetscale/cli#27). We could configure our CI
  to easily so `go get` could work easily, but I'm not sure we need it
  at all due the usage of `vendor/`

* I removed the `-v` flag from `go test -v`. The main reason is that
  `-v` outputs to much information. It' s not needed. The best outcome
  is to output only the issues we see. The benefit is, it's easier to
  parse the CI output for humans and we don't have to scroll hundreds of
  lines.

(nit: the pictures are attached to the GitHub Pull Request, please find
the appropriate PR and check that it out there :))

Before:

```
```

After:

```
```
  • Loading branch information
asbiaidw5 authored and fatih committed Jan 11, 2021
1 parent 4cfe462 commit c82b685
Showing 1 changed file with 2 additions and 10 deletions.
12 changes: 2 additions & 10 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,24 +14,16 @@ jobs:
- name: Set up Go 1.x
uses: actions/setup-go@v2
with:
go-version: ^1.13
go-version: ^1.15

- name: Check out code into the Go module directory
uses: actions/checkout@v2

- name: Get dependencies
run: |
go get -v -t -d ./...
if [ -f Gopkg.toml ]; then
curl https://raw.githubusercontent.com/golang/dep/master/install.sh | sh
dep ensure
fi
- name: Build
run: go build -v ./...

- name: Test
run: go test -v ./...
run: go test ./...

lint:
name: lint
Expand Down

0 comments on commit c82b685

Please sign in to comment.