This repository has been archived by the owner on Apr 4, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 575
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* add travis file * update lint so it reports properly * disable circleci * separate test structure into Verify deps & Lint, Unit Tests, Race Tests, Integration Tests * fix path issue now evident on ci build err * fixed golangci version to latest stable * Upgrade ci lint to go script and avoid cache issues #268 * fix lint issues #268 * bump go version for travis build to match go.mod version recently updated with Cosmos SDK upgrade * add panic for err edge cases on os.Stat * increase timeout to 10m since its failing on jenkins * bump GOLANGCI_VERSION to 1.23.8 in order to try avoiding some weird errors on CI
- Loading branch information
1 parent
7c5e0af
commit 5417b4b
Showing
14 changed files
with
275 additions
and
104 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,4 +17,6 @@ build/ | |
|
||
# Goland | ||
.idea/ | ||
start.sh | ||
start.sh | ||
|
||
bin/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
language: go | ||
|
||
go: | ||
- 1.14.x | ||
|
||
cache: | ||
directories: | ||
- "$HOME/.cache/go-build" | ||
- "$GOPATH/pkg/mod" | ||
|
||
matrix: | ||
include: | ||
- name: Verify deps & Lint | ||
script: | ||
- rm -rf $HOME/.cache/golangci-lint || true | ||
- make verify build | ||
- make lint | ||
- name: Unit Tests | ||
script: | ||
- make test-import | ||
- make test-unit | ||
- name: Race Tests | ||
script: | ||
- make test-race | ||
- name: Integration Tests | ||
script: | ||
- make it-tests || true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
// +build none | ||
|
||
package main | ||
|
||
import ( | ||
"flag" | ||
"fmt" | ||
"log" | ||
"os" | ||
"os/exec" | ||
"path/filepath" | ||
"runtime" | ||
"strings" | ||
) | ||
|
||
const ( | ||
GOLANGCI_VERSION = "github.com/golangci/golangci-lint/cmd/golangci-lint@v1.23.8" | ||
) | ||
|
||
func main() { | ||
|
||
log.SetFlags(log.Lshortfile) | ||
|
||
if _, err := os.Stat(filepath.Join("scripts", "ci.go")); os.IsNotExist(err) { | ||
log.Fatal("should run build from root dir") | ||
} else if err != nil { | ||
panic(err) | ||
} | ||
if len(os.Args) < 2 { | ||
log.Fatal("cmd required, eg: install") | ||
} | ||
switch os.Args[1] { | ||
case "lint": | ||
lint() | ||
default: | ||
log.Fatal("cmd not found", os.Args[1]) | ||
} | ||
} | ||
|
||
func lint() { | ||
|
||
verbose := flag.Bool("v", false, "Whether to log verbosely") | ||
|
||
// Make sure golangci-lint is available | ||
argsGet := append([]string{"get", GOLANGCI_VERSION}) | ||
cmd := exec.Command(filepath.Join(runtime.GOROOT(), "bin", "go"), argsGet...) | ||
out, err := cmd.CombinedOutput() | ||
if err != nil { | ||
log.Fatalf("could not list packages: %v\n%s", err, string(out)) | ||
} | ||
|
||
cmd = exec.Command(filepath.Join(GOBIN(), "golangci-lint")) | ||
cmd.Args = append(cmd.Args, "run", "--config", ".golangci.yml") | ||
|
||
if *verbose { | ||
cmd.Args = append(cmd.Args, "-v") | ||
} | ||
|
||
fmt.Println("Lint Ethermint", strings.Join(cmd.Args, " \\\n")) | ||
cmd.Stderr, cmd.Stdout = os.Stderr, os.Stdout | ||
|
||
if err := cmd.Run(); err != nil { | ||
log.Fatal("Error: Could not Lint Ethermint. ", "error: ", err, ", cmd: ", cmd) | ||
} | ||
} | ||
|
||
// GOBIN returns the GOBIN environment variable | ||
func GOBIN() string { | ||
if os.Getenv("GOBIN") == "" { | ||
log.Fatal("GOBIN is not set") | ||
} | ||
return os.Getenv("GOBIN") | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters