diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 00000000..edc8bcd9 --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,54 @@ +name: Run Tests +on: + push: + branches: [ '*' ] + pull_request: + branches: [ main ] + schedule: + # Run automatically at 8AM PST Monday-Friday + - cron: '0 15 * * 1-5' + workflow_dispatch: + +jobs: + tests: + name: Build & Test + runs-on: ubuntu-latest + timeout-minutes: 20 + strategy: + matrix: + go: [ '1.14', '1.15', '1.16' ] + steps: + - name: Checkout sendgrid-go + uses: actions/checkout@v2 + + - name: Setup Go environment + uses: actions/setup-go@v2 + with: + go-version: ${{ matrix.go }} + + - name: Set Go env vars + run: | + echo "GOPATH=$HOME" >> $GITHUB_ENV + echo "GOBIN=$HOME/bin" >> $GITHUB_ENV + echo "GO111MODULE=off" >> $GITHUB_ENV + + - name: Run Tests + run: make test-docker + + notify-on-failure: + name: Slack notify on failure + if: ${{ failure() && github.ref == 'refs/heads/main' && github.event_name != 'pull_request' }} + needs: [ tests ] + runs-on: ubuntu-latest + steps: + - uses: rtCamp/action-slack-notify@v2 + env: + SLACK_COLOR: 'failure' + SLACK_ICON_EMOJI: ':github:' + SLACK_MESSAGE: ${{ format('Failed running build on {1}{3} {0}/{1}/actions/runs/{2}', github.server_url, github.repository, github.run_id, ':') }} + SLACK_TITLE: Build Failure + SLACK_USERNAME: GitHub Actions + SLACK_MSG_AUTHOR: twilio-dx + SLACK_FOOTER: Posted automatically using GitHub Actions + SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }} + MSG_MINIMAL: true diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 87a7c32c..00000000 --- a/.travis.yml +++ /dev/null @@ -1,20 +0,0 @@ -language: go -env: -- version=1.14 -- version=1.15 -- version=1.16 -script: -- if [[ "$TRAVIS_BRANCH" == "main" || "$TRAVIS_BRANCH" == "travis" ]] && [ "$TRAVIS_PULL_REQUEST" == "false" ]; then - echo "${DOCKER_PASSWORD}" | docker login -u "${DOCKER_USERNAME}" --password-stdin; - fi -- make test-docker -after_success: -- bash <(curl -s https://codecov.io/bash) -notifications: - slack: - if: branch = main - on_pull_requests: false - on_success: never - on_failure: change - rooms: - secure: fq8yXU8xLhSB0NG2K1Y/dcA4z2V3rJAVRz8t83pGj5nxhjMz8xUgtElLxOaO+tLcE2of2U+cbisVeCbHn9VDDmNXuYFHeuxpxKF46N+X80e/4adKpLYGZHjuOyBTTpuDabCl5wDp1tuFX8IdIdj0wVTVRFpQnqfNf4NVDDtqwik= diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 2d5366d8..cd224444 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -51,7 +51,7 @@ We welcome direct contributions to the sendgrid-go code base. Thank you! ##### Prerequisites ##### -- Go 1.6 +- Go version 1.14, 1.15 or 1.16 - [rest](https://github.com/sendgrid/rest) ##### Initial setup: ##### diff --git a/Dockerfile b/Dockerfile index 07895cfb..09f21116 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,7 +1,6 @@ ARG version=latest FROM golang:$version -ENV GODEBUG 'x509ignoreCN=0' ENV GO111MODULE 'off' COPY prism/prism/nginx/cert.crt /usr/local/share/ca-certificates/cert.crt diff --git a/README.md b/README.md index c8101ac1..62e0a7cc 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ ![Twilio SendGrid Logo](twilio_sendgrid_logo.png) -[![BuildStatus](https://travis-ci.com/sendgrid/sendgrid-go.svg?branch=main)](https://travis-ci.com/sendgrid/sendgrid-go) +[![BuildStatus](https://github.com/sendgrid/sendgrid-go/actions/workflows/test.yml/badge.svg)](https://github.com/sendgrid/sendgrid-go/actions/workflows/test.yml) [![GoDoc](https://godoc.org/github.com/sendgrid/sendgrid-go?status.svg)](https://godoc.org/github.com/sendgrid/sendgrid-go) [![MIT licensed](https://img.shields.io/badge/license-MIT-blue.svg)](LICENSE) [![Twitter Follow](https://img.shields.io/twitter/follow/sendgrid.svg?style=social&label=Follow)](https://twitter.com/sendgrid) @@ -37,9 +37,11 @@ We appreciate your continued support, thank you! # Installation +## Supported Versions +- Go version 1.14, 1.15 or 1.16 + ## Prerequisites -- Go version 1.14, 1.15 or 1.16 - The Twilio SendGrid service, starting at the [free level](https://sendgrid.com/free?source=sendgrid-go), to send up to 40,000 emails for the first 30 days, then send 100 emails/day free forever or check out [our pricing](https://sendgrid.com/pricing?source=sendgrid-go). ## Setup Environment Variables diff --git a/sendgrid_test.go b/sendgrid_test.go index d497ed69..bae188ae 100644 --- a/sendgrid_test.go +++ b/sendgrid_test.go @@ -30,7 +30,7 @@ func TestRepoFiles(t *testing.T) { "Dockerfile", ".env_sample", ".gitignore", - ".travis.yml", + ".github/workflows/test.yml", // ".codeclimate.yml", // TODO: uncomment this file "CHANGELOG.md", "CODE_OF_CONDUCT.md", @@ -2735,7 +2735,7 @@ func Test_test_suppression_invalid_emails__email__delete(t *testing.T) { } func Test_test_suppression_spam_report__email__get(t *testing.T) { - request := getRequest("/v3/suppression/spam_report/{email}") + request := getRequest("/v3/suppression/spam_reports/{email}") request.Method = "GET" request.Headers["X-Mock"] = "200" response, err := MakeRequest(request) @@ -2746,7 +2746,7 @@ func Test_test_suppression_spam_report__email__get(t *testing.T) { } func Test_test_suppression_spam_report__email__delete(t *testing.T) { - request := getRequest("/v3/suppression/spam_report/{email}") + request := getRequest("/v3/suppression/spam_reports/{email}") request.Method = "DELETE" request.Headers["X-Mock"] = "204" response, err := MakeRequest(request)