Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci: improve github workflows #1460

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 0 additions & 14 deletions .ci.gofmt.sh

This file was deleted.

16 changes: 0 additions & 16 deletions .ci.gogenerate.sh

This file was deleted.

5 changes: 0 additions & 5 deletions .ci.govet.sh

This file was deleted.

25 changes: 18 additions & 7 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: All builds
on: [push, pull_request]

jobs:
build:
validate:
runs-on: ubuntu-latest
strategy:
matrix:
Expand All @@ -12,13 +12,24 @@ jobs:
steps:
- uses: actions/checkout@v3
- name: Setup Go
uses: actions/setup-go@v3.2.0
uses: actions/setup-go@v4
with:
go-version: ${{ matrix.go_version }}
- run: ./.ci.gogenerate.sh
- run: ./.ci.gofmt.sh
- run: ./.ci.govet.sh
- run: go test -v -race ./...
- name: Check go mod tidy
run: |
go mod tidy
(cd _codegen && go mod tidy)
git --no-pager diff && [[ -z $(git status -s) ]]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can use --exit-code parameter here and below:

Suggested change
git --no-pager diff && [[ -z $(git status -s) ]]
git --no-pager diff --exit-code

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That wouldn't handle the case where there are new files generated unfortunately., which is what git status -s catches.

- name: Check go generate
run: |
go generate ./...
git --no-pager diff && [[ -z $(git status -s) ]]
- name: Check gofmt
run: |
gofmt -w .
git --no-pager diff && [[ -z $(git status -s) ]]
- name: Check go vet
run: go vet ./...
test:
runs-on: ubuntu-latest
strategy:
Expand All @@ -31,7 +42,7 @@ jobs:
steps:
- uses: actions/checkout@v3
- name: Setup Go
uses: actions/setup-go@v3.2.0
uses: actions/setup-go@v4
with:
go-version: ${{ matrix.go_version }}
- run: go test -v -race ./...
5 changes: 4 additions & 1 deletion _codegen/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,7 @@ module github.com/stretchr/testify/_codegen

go 1.11

require github.com/ernesto-jimenez/gogen v0.0.0-20180125220232-d7d4131e6607
require (
github.com/ernesto-jimenez/gogen v0.0.0-20180125220232-d7d4131e6607
github.com/stretchr/testify v1.8.4 // indirect
)
17 changes: 17 additions & 0 deletions _codegen/go.sum
Original file line number Diff line number Diff line change
@@ -1,2 +1,19 @@
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/ernesto-jimenez/gogen v0.0.0-20180125220232-d7d4131e6607 h1:cTavhURetDkezJCvxFggiyLeP40Mrk/TtVg2+ycw1Es=
github.com/ernesto-jimenez/gogen v0.0.0-20180125220232-d7d4131e6607/go.mod h1:Cg4fM0vhYWOZdgM7RIOSTRNIc8/VT7CXClC3Ni86lu4=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw=
github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo=
github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU=
github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk=
github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=