Skip to content

Commit

Permalink
Adding Pipeline to Test GO SDK
Browse files Browse the repository at this point in the history
  • Loading branch information
hermeswaldemarin committed Dec 5, 2023
1 parent 6f0020e commit 88ff003
Show file tree
Hide file tree
Showing 5 changed files with 51 additions and 3 deletions.
14 changes: 14 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
name: Go SDK
on: [push]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

- name: Setup Go
uses: actions/setup-go@v4

- name: Run Tests
run:
./test.sh
1 change: 0 additions & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,4 @@ go 1.15

require (
github.com/go-resty/resty/v2 v2.7.0
github.com/procyon-projects/chrono v1.1.2
)
29 changes: 27 additions & 2 deletions sdk/DefaultContextDataDeserializer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,18 @@ func TestDeserialize(t *testing.T) {
}},
AudienceStrict: false,
Audience: "",
CustomFieldValues: []jsonmodels.CustomFieldValue{
{
Name: "country",
Value: "US,PT,ES,DE,FR",
Type: "string",
},
{
Name: "overrides",
Value: "{\"123\":1,\"456\":0}",
Type: "json",
},
},
}

var experiment_2 = jsonmodels.Experiment{
Expand Down Expand Up @@ -59,6 +71,18 @@ func TestDeserialize(t *testing.T) {
}},
AudienceStrict: false,
Audience: "",
CustomFieldValues: []jsonmodels.CustomFieldValue{
{
Name: "country",
Value: "US,PT,ES,DE,FR",
Type: "string",
},
{
Name: "languages",
Value: "en-US,en-GB,pt-PT,pt-BR,es-ES,es-MX",
Type: "string",
},
},
}

var experiment_3 = jsonmodels.Experiment{
Expand Down Expand Up @@ -86,8 +110,9 @@ func TestDeserialize(t *testing.T) {
Name: "C",
Config: "{\"card.width\":\"75%\"}",
}},
AudienceStrict: false,
Audience: "{}",
AudienceStrict: false,
Audience: "{}",
CustomFieldValues: nil,
}

var experiment_4 = jsonmodels.Experiment{
Expand Down
7 changes: 7 additions & 0 deletions sdk/jsonmodels/CustomFieldValue.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package jsonmodels

type CustomFieldValue struct {
Name string `json:"name"`
Type string `json:"type"`
Value string `json:"value"`
}
3 changes: 3 additions & 0 deletions test.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
#!/bin/bash

echo "run golang get"
go get github.com/go-resty/resty/[email protected]

echo "run golang fmt"
go fmt ./...

Expand Down

0 comments on commit 88ff003

Please sign in to comment.