Skip to content
This repository has been archived by the owner on Dec 12, 2024. It is now read-only.

Commit

Permalink
Merge branch 'main' into feature/supported-open-telemetry
Browse files Browse the repository at this point in the history
  • Loading branch information
Gabe authored Jul 25, 2022
2 parents af7c804 + c06bae1 commit 1e763d6
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 7 deletions.
5 changes: 4 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,7 @@ jobs:
run: mage build

- name: Test
run: mage test
run: mage CITest

- name: Upload coverage to Codecov
uses: codecov/codecov-action@v3
4 changes: 2 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ module github.com/tbd54566975/ssi-service
go 1.17

require (
github.com/BurntSushi/toml v1.1.0
github.com/BurntSushi/toml v1.2.0
github.com/TBD54566975/ssi-sdk v0.0.0-20220719010135-e2fdcfb80e49
github.com/ardanlabs/conf v1.5.0
github.com/boltdb/bolt v1.3.1
Expand All @@ -15,7 +15,7 @@ require (
github.com/magefile/mage v1.13.0
github.com/mr-tron/base58 v1.2.0
github.com/pkg/errors v0.9.1
github.com/sirupsen/logrus v1.8.1
github.com/sirupsen/logrus v1.9.0
github.com/stretchr/testify v1.8.0
go.opentelemetry.io/otel/exporters/jaeger v1.8.0
go.opentelemetry.io/otel/trace v1.8.0
Expand Down
7 changes: 4 additions & 3 deletions go.sum
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
github.com/BurntSushi/toml v1.1.0 h1:ksErzDEI1khOiGPgpwuI7x2ebx/uXQNw7xJpn9Eq1+I=
github.com/BurntSushi/toml v1.1.0/go.mod h1:CxXYINrC8qIiEnFrOxCa7Jy5BFHlXnUU2pbicEuybxQ=
github.com/BurntSushi/toml v1.2.0 h1:Rt8g24XnyGTyglgET/PRUNlrUeu9F5L+7FilkXfZgs0=
github.com/BurntSushi/toml v1.2.0/go.mod h1:CxXYINrC8qIiEnFrOxCa7Jy5BFHlXnUU2pbicEuybxQ=
github.com/TBD54566975/ssi-sdk v0.0.0-20220719010135-e2fdcfb80e49 h1:BozkJ4jg1nZyTzBs/ltNq+KtTuveZDh48Ax85cVh0M4=
github.com/TBD54566975/ssi-sdk v0.0.0-20220719010135-e2fdcfb80e49/go.mod h1:uWJkLbobBINP2QFVFL5kku5GtCmbmggzCHh8sTH5NYs=
github.com/ardanlabs/conf v1.5.0 h1:5TwP6Wu9Xi07eLFEpiCUF3oQXh9UzHMDVnD3u/I5d5c=
Expand Down Expand Up @@ -92,8 +92,9 @@ github.com/rogpeppe/go-internal v1.6.1/go.mod h1:xXDCJY+GAPziupqXw64V24skbSoqbTE
github.com/rogpeppe/go-internal v1.8.0/go.mod h1:WmiCO8CzOY8rg0OYDC4/i/2WRWAB6poM+XZ2dLUbcbE=
github.com/rogpeppe/go-internal v1.8.1 h1:geMPLpDpQOgVyCg5z5GoRwLHepNdb71NXb67XFkP+Eg=
github.com/rogpeppe/go-internal v1.8.1/go.mod h1:JeRgkft04UBgHMgCIwADu4Pn6Mtm5d4nPKWu0nJ5d+o=
github.com/sirupsen/logrus v1.8.1 h1:dJKuHgqk1NNQlqoA6BTlM1Wf9DOH3NBjQyu0h9+AZZE=
github.com/sirupsen/logrus v1.8.1/go.mod h1:yWOB1SBYBC5VeMP7gHvWumXLIWorT60ONWic61uBYv0=
github.com/sirupsen/logrus v1.9.0 h1:trlNQbNUG3OdDrDil03MCb1H2o9nJ1x4/5LYw7byDE0=
github.com/sirupsen/logrus v1.9.0/go.mod h1:naHLuLoDiP4jHNo9R0sCBMtWGeIprob74mVsIT4qYEQ=
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/objx v0.4.0 h1:M2gUjqZET1qApGOWNSnZ49BAIMX4F/1plDv3+l31EJ4=
github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw=
Expand Down
29 changes: 28 additions & 1 deletion magefile.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ func Build() error {
// Clean deletes any build artifacts.
func Clean() {
fmt.Println("Cleaning...")
_ = os.RemoveAll("bin")
os.RemoveAll("bin")
}

// Run the service via docker-compose
Expand All @@ -48,6 +48,12 @@ func Test() error {
return runTests()
}

// CITest runs unit tests with coverage as a part of CI.
// The mage `-v` option will trigger a verbose output of the test
func CITest() error {
return runCITests()
}

// Spec generates an OpenAPI spec yaml based on code annotations.
func Spec() error {
swagCommand := "swag"
Expand All @@ -58,6 +64,27 @@ func Spec() error {
return sh.Run(swagCommand, "init", "-g", "cmd/main.go", "--pd", "-ot", "yaml")
}

func runCITests(extraTestArgs ...string) error {
args := []string{"test"}
if mg.Verbose() {
args = append(args, "-v")
}
args = append(args, "-tags=jwx_es256k")
args = append(args, "-covermode=atomic")
args = append(args, "-coverprofile=coverage.out")
args = append(args, extraTestArgs...)
args = append(args, "./...")
testEnv := map[string]string{
"CGO_ENABLED": "1",
"GO111MODULE": "on",
}
writer := ColorizeTestStdout()
fmt.Printf("%+v", args)
_, err := sh.Exec(testEnv, writer, os.Stderr, Go, args...)
return err
}


func runTests(extraTestArgs ...string) error {
args := []string{"test"}
if mg.Verbose() {
Expand Down

0 comments on commit 1e763d6

Please sign in to comment.