From 0c59095d066c759ff2e1041cd5e35a5706673705 Mon Sep 17 00:00:00 2001 From: Bilal Boussayoud Date: Mon, 29 Nov 2021 11:11:24 -0700 Subject: [PATCH 01/15] chore: migrate to github actions --- .github/workflows/test.yml | 53 ++++++++++++++++++++++++++++++++++++++ .travis.yml | 20 -------------- sendgrid_test.go | 2 +- 3 files changed, 54 insertions(+), 21 deletions(-) create mode 100644 .github/workflows/test.yml delete mode 100644 .travis.yml diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 00000000..a2f183eb --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,53 @@ +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 }} + + - run: go mod init rest && go mod tidy + + - name: Build sendgrid-go + run: make install + + - 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: 'danger' + 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 \ No newline at end of file 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/sendgrid_test.go b/sendgrid_test.go index d497ed69..f0671284 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", From f1b2e47df7abf3adcc05a38033665e31072437fd Mon Sep 17 00:00:00 2001 From: Bilal Boussayoud Date: Mon, 29 Nov 2021 12:46:02 -0700 Subject: [PATCH 02/15] see env var values --- .github/workflows/test.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index a2f183eb..2c7f350c 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -26,6 +26,7 @@ jobs: with: go-version: ${{ matrix.go }} + - run: echo $GODEBUG && echo $GO111MODULE - run: go mod init rest && go mod tidy - name: Build sendgrid-go From c834698c3fd0d108c54aa1a38d2226a619eacdc5 Mon Sep 17 00:00:00 2001 From: Bilal Boussayoud Date: Mon, 29 Nov 2021 12:52:24 -0700 Subject: [PATCH 03/15] set env vars in workflow --- .github/workflows/test.yml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 2c7f350c..7b497d28 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -26,7 +26,11 @@ jobs: with: go-version: ${{ matrix.go }} - - run: echo $GODEBUG && echo $GO111MODULE + - name: Set GODEBUG + run: echo "GODEBUG='x509ignoreCN=0'" >> $GITHUB_ENV + - name: Set GO111MODULE + run: echo "GO111MODULE='off'" >> $GITHUB_ENV + - run: go mod init rest && go mod tidy - name: Build sendgrid-go From a193c98b5041c443bff9f4e0e7de963926f946c0 Mon Sep 17 00:00:00 2001 From: Bilal Boussayoud Date: Mon, 29 Nov 2021 12:56:13 -0700 Subject: [PATCH 04/15] remove quotes --- .github/workflows/test.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 7b497d28..d7d26edd 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -27,9 +27,9 @@ jobs: go-version: ${{ matrix.go }} - name: Set GODEBUG - run: echo "GODEBUG='x509ignoreCN=0'" >> $GITHUB_ENV + run: echo "GODEBUG="x509ignoreCN=0"" >> $GITHUB_ENV - name: Set GO111MODULE - run: echo "GO111MODULE='off'" >> $GITHUB_ENV + run: echo "GO111MODULE=off" >> $GITHUB_ENV - run: go mod init rest && go mod tidy From 6fe3ee34ace28d5704495ba34d8c5948e2228046 Mon Sep 17 00:00:00 2001 From: Bilal Boussayoud Date: Mon, 29 Nov 2021 12:59:16 -0700 Subject: [PATCH 05/15] remove go mod init --- .github/workflows/test.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index d7d26edd..39704fb3 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -31,8 +31,6 @@ jobs: - name: Set GO111MODULE run: echo "GO111MODULE=off" >> $GITHUB_ENV - - run: go mod init rest && go mod tidy - - name: Build sendgrid-go run: make install From e83c4c271ae1ad61fc4593df3b873c7c3da1db06 Mon Sep 17 00:00:00 2001 From: Bilal Boussayoud Date: Mon, 29 Nov 2021 13:02:46 -0700 Subject: [PATCH 06/15] set gopath --- .github/workflows/test.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 39704fb3..707ae9a9 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -26,6 +26,8 @@ jobs: with: go-version: ${{ matrix.go }} + - name: Set GOPATH + run: echo "GOPATH=$HOME" >> $GITHUB_ENV - name: Set GODEBUG run: echo "GODEBUG="x509ignoreCN=0"" >> $GITHUB_ENV - name: Set GO111MODULE From aa27eb7545a90ea4e4707cd04f9b67d55f3c9655 Mon Sep 17 00:00:00 2001 From: Bilal Boussayoud Date: Mon, 29 Nov 2021 13:04:15 -0700 Subject: [PATCH 07/15] add bin directory --- .github/workflows/test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 707ae9a9..28d4ff97 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -27,7 +27,7 @@ jobs: go-version: ${{ matrix.go }} - name: Set GOPATH - run: echo "GOPATH=$HOME" >> $GITHUB_ENV + run: echo "GOPATH=$HOME" >> $GITHUB_ENV && mkdir $GOPATH/bin - name: Set GODEBUG run: echo "GODEBUG="x509ignoreCN=0"" >> $GITHUB_ENV - name: Set GO111MODULE From 095dfe4d27248951bd63458e8e456ee11e946f3a Mon Sep 17 00:00:00 2001 From: Bilal Boussayoud Date: Mon, 29 Nov 2021 13:06:39 -0700 Subject: [PATCH 08/15] set GOBIN --- .github/workflows/test.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 28d4ff97..f684fac6 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -27,7 +27,9 @@ jobs: go-version: ${{ matrix.go }} - name: Set GOPATH - run: echo "GOPATH=$HOME" >> $GITHUB_ENV && mkdir $GOPATH/bin + run: echo "GOPATH=$HOME" >> $GITHUB_ENV + - name: Set GOBIN + run: echo "GOBIN=$GOPATH/bin" >> $GITHUB_ENV - name: Set GODEBUG run: echo "GODEBUG="x509ignoreCN=0"" >> $GITHUB_ENV - name: Set GO111MODULE From f966b4c4df039482ffb3b1258c99a64ecc005986 Mon Sep 17 00:00:00 2001 From: Bilal Boussayoud Date: Mon, 29 Nov 2021 13:10:43 -0700 Subject: [PATCH 09/15] remove double quotes for godebug --- .github/workflows/test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index f684fac6..967adf23 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -31,7 +31,7 @@ jobs: - name: Set GOBIN run: echo "GOBIN=$GOPATH/bin" >> $GITHUB_ENV - name: Set GODEBUG - run: echo "GODEBUG="x509ignoreCN=0"" >> $GITHUB_ENV + run: echo "GODEBUG=x509ignoreCN=0" >> $GITHUB_ENV - name: Set GO111MODULE run: echo "GO111MODULE=off" >> $GITHUB_ENV From 7646aeaf149b70d7659bbcf988014c0d97b4e54b Mon Sep 17 00:00:00 2001 From: Bilal Boussayoud Date: Tue, 30 Nov 2021 15:32:21 -0700 Subject: [PATCH 10/15] see if regenerating oai cert fixes tests --- .github/workflows/test.yml | 2 -- Dockerfile | 1 - Makefile | 2 +- 3 files changed, 1 insertion(+), 4 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 967adf23..7d0e4b19 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -30,8 +30,6 @@ jobs: run: echo "GOPATH=$HOME" >> $GITHUB_ENV - name: Set GOBIN run: echo "GOBIN=$GOPATH/bin" >> $GITHUB_ENV - - name: Set GODEBUG - run: echo "GODEBUG=x509ignoreCN=0" >> $GITHUB_ENV - name: Set GO111MODULE run: echo "GO111MODULE=off" >> $GITHUB_ENV 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/Makefile b/Makefile index f1802268..e5a8192b 100644 --- a/Makefile +++ b/Makefile @@ -11,5 +11,5 @@ test-integ: test version ?= latest test-docker: - curl -s https://raw.githubusercontent.com/sendgrid/sendgrid-oai/HEAD/prism/prism.sh -o prism.sh + curl -s https://raw.githubusercontent.com/sendgrid/sendgrid-oai/cert-regen/prism/prism.sh -o prism.sh version=$(version) bash ./prism.sh From ea8ce223667b157168a1c7d0d05cf4cc6b87b55e Mon Sep 17 00:00:00 2001 From: Bilal Boussayoud Date: Thu, 2 Dec 2021 11:18:13 -0700 Subject: [PATCH 11/15] revise tests & remove oai ft branch --- Makefile | 2 +- sendgrid_test.go | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index e5a8192b..f1802268 100644 --- a/Makefile +++ b/Makefile @@ -11,5 +11,5 @@ test-integ: test version ?= latest test-docker: - curl -s https://raw.githubusercontent.com/sendgrid/sendgrid-oai/cert-regen/prism/prism.sh -o prism.sh + curl -s https://raw.githubusercontent.com/sendgrid/sendgrid-oai/HEAD/prism/prism.sh -o prism.sh version=$(version) bash ./prism.sh diff --git a/sendgrid_test.go b/sendgrid_test.go index f0671284..bae188ae 100644 --- a/sendgrid_test.go +++ b/sendgrid_test.go @@ -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) From 65bbbefc75a4247e7ce3e5f04586eb411319efe4 Mon Sep 17 00:00:00 2001 From: Bilal Boussayoud Date: Mon, 13 Dec 2021 14:14:07 -0700 Subject: [PATCH 12/15] update build badge & CONTRIBUTING.md --- CONTRIBUTING.md | 2 +- README.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) 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/README.md b/README.md index c8101ac1..d7f13a28 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) From b1661474da31ee32036e8259b2e0aa26e260b10c Mon Sep 17 00:00:00 2001 From: Bilal Boussayoud Date: Mon, 13 Dec 2021 16:48:12 -0700 Subject: [PATCH 13/15] feedback --- .github/workflows/test.yml | 4 ++-- README.md | 3 +++ 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 7d0e4b19..39dc6a4d 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -47,7 +47,7 @@ jobs: steps: - uses: rtCamp/action-slack-notify@v2 env: - SLACK_COLOR: 'danger' + 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 @@ -55,4 +55,4 @@ jobs: SLACK_MSG_AUTHOR: twilio-dx SLACK_FOOTER: Posted automatically using GitHub Actions SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }} - MSG_MINIMAL: true \ No newline at end of file + MSG_MINIMAL: true diff --git a/README.md b/README.md index d7f13a28..e7727016 100644 --- a/README.md +++ b/README.md @@ -37,6 +37,9 @@ 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 From 947f2bff21cd6db04abf4e75e7b7411009073702 Mon Sep 17 00:00:00 2001 From: Bilal Boussayoud Date: Tue, 14 Dec 2021 12:15:27 -0700 Subject: [PATCH 14/15] consolidate env var steps --- .github/workflows/test.yml | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 39dc6a4d..842de188 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -26,12 +26,11 @@ jobs: with: go-version: ${{ matrix.go }} - - name: Set GOPATH - run: echo "GOPATH=$HOME" >> $GITHUB_ENV - - name: Set GOBIN - run: echo "GOBIN=$GOPATH/bin" >> $GITHUB_ENV - - name: Set GO111MODULE - run: echo "GO111MODULE=off" >> $GITHUB_ENV + - name: Set Go env vars + run: | + echo "GOPATH=$HOME" >> $GITHUB_ENV + echo "GOBIN=$HOME/bin" >> $GITHUB_ENV + echo "GO111MODULE=off" >> $GITHUB_ENV - name: Build sendgrid-go run: make install From 98e372c31d02d476a51abdcba546c09358cbc10e Mon Sep 17 00:00:00 2001 From: Bilal Boussayoud Date: Tue, 14 Dec 2021 13:50:53 -0700 Subject: [PATCH 15/15] address feedback --- .github/workflows/test.yml | 3 --- README.md | 1 - 2 files changed, 4 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 842de188..edc8bcd9 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -32,9 +32,6 @@ jobs: echo "GOBIN=$HOME/bin" >> $GITHUB_ENV echo "GO111MODULE=off" >> $GITHUB_ENV - - name: Build sendgrid-go - run: make install - - name: Run Tests run: make test-docker diff --git a/README.md b/README.md index e7727016..62e0a7cc 100644 --- a/README.md +++ b/README.md @@ -42,7 +42,6 @@ We appreciate your continued support, thank you! ## 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