diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md index 6d3811c..7cad4db 100644 --- a/.github/CONTRIBUTING.md +++ b/.github/CONTRIBUTING.md @@ -2,7 +2,7 @@ ## Quality Standard -To ensure the continued stability of this package, tests are required to be written or already exist in order for a pull request to be merged. +To ensure the continued stability of this package, tests are required that cover the change in order for a pull request to be merged. ## Reporting issues diff --git a/.github/ISSUE_TEMPLATE.md b/.github/ISSUE_TEMPLATE.md index 8afb259..0104499 100644 --- a/.github/ISSUE_TEMPLATE.md +++ b/.github/ISSUE_TEMPLATE.md @@ -1,4 +1,4 @@ -### Package version eg. v8, v9: +### Package version eg. v9, v10: diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md index 7bebde3..6bb0db3 100644 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -1,13 +1,7 @@ -Fixes Or Enhances # . +## Fixes Or Enhances + **Make sure that you've checked the boxes below before you submit PR:** - [ ] Tests exist or have been written that cover this particular change. -Change Details: - -- -- -- - - @go-playground/admins \ No newline at end of file diff --git a/.github/workflows/workflow.yml b/.github/workflows/workflow.yml new file mode 100644 index 0000000..f9dbbc6 --- /dev/null +++ b/.github/workflows/workflow.yml @@ -0,0 +1,45 @@ +on: + push: + branches: + - master + pull_request: +name: Test +jobs: + test: + strategy: + matrix: + go-version: [1.14.x, 1.15.x] + os: [ubuntu-latest, macos-latest, windows-latest] + runs-on: ${{ matrix.os }} + steps: + - name: Install Go + uses: actions/setup-go@v2 + with: + go-version: ${{ matrix.go-version }} + + - name: Restore Cache + if: matrix.os != 'ubuntu-latest' && matrix.go-version != '1.15.x' + uses: actions/cache@v2 + with: + path: ~/go/pkg/mod + key: ${{ runner.os }}-v1-go-${{ hashFiles('**/go.sum') }} + restore-keys: | + ${{ runner.os }}-v1-go- + + - name: Checkout code + uses: actions/checkout@v2 + + - name: lint + if: matrix.os == 'ubuntu-latest' && matrix.go-version == '1.15.x' + uses: golangci/golangci-lint-action@v2 + with: + version: v1.31 + + - name: Test + run: go test -race -covermode=atomic -coverprofile="profile.cov" ./... + + - name: Send Coverage + if: matrix.os == 'ubuntu-latest' && matrix.go-version == '1.15.x' + uses: shogo82148/actions-goveralls@v1 + with: + path-to-profile: profile.cov diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 85a7be3..0000000 --- a/.travis.yml +++ /dev/null @@ -1,29 +0,0 @@ -language: go -go: - - 1.15.2 - - tip -matrix: - allow_failures: - - go: tip - -notifications: - email: - recipients: dean.karn@gmail.com - on_success: change - on_failure: always - -before_install: - - go install github.com/mattn/goveralls - - mkdir -p $GOPATH/src/gopkg.in - - ln -s $GOPATH/src/github.com/$TRAVIS_REPO_SLUG $GOPATH/src/gopkg.in/validator.v9 - -# Only clone the most recent commit. -git: - depth: 1 - -script: - - go test -v -race -covermode=atomic -coverprofile=coverage.coverprofile ./... - -after_success: | - [ $TRAVIS_GO_VERSION = 1.15.2 ] && - goveralls -coverprofile=coverage.coverprofile -service travis-ci -repotoken $COVERALLS_TOKEN diff --git a/validator_test.go b/validator_test.go index 6c9fb1e..683a2dd 100644 --- a/validator_test.go +++ b/validator_test.go @@ -1789,7 +1789,7 @@ func TestCrossStructEqFieldValidation(t *testing.T) { errs = validate.Struct(test) Equal(t, errs, nil) - newTime := time.Now().UTC() + newTime := time.Now().Add(time.Hour).UTC() test.CreatedAt = &newTime errs = validate.Struct(test) @@ -4607,7 +4607,7 @@ func TestIsNeFieldValidation(t *testing.T) { NotEqual(t, errs, nil) AssertError(t, errs, "Test.Start", "Test.Start", "Start", "Start", "nefield") - now3 := time.Now().UTC() + now3 := time.Now().Add(time.Hour).UTC() sv = &Test{ Start: &now, @@ -4840,7 +4840,7 @@ func TestIsEqFieldValidation(t *testing.T) { errs = validate.Struct(sv) Equal(t, errs, nil) - now3 := time.Now().UTC() + now3 := time.Now().Add(time.Hour).UTC() sv = &Test{ Start: &now,