Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: migrate to GitHub Actions #88

Merged
merged 12 commits into from
Dec 14, 2021
Merged
Show file tree
Hide file tree
Changes from 8 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
58 changes: 58 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
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.11', '1.12', '1.13', '1.14', '1.15', '1.16' ]
steps:
- name: Checkout smtpapi-go
uses: actions/checkout@v2

- name: Setup Go environment
uses: actions/setup-go@v2
with:
go-version: ${{ matrix.go }}

- name: Set GOPATH
run: echo "GOPATH=$HOME" >> $GITHUB_ENV
- name: Set GOBIN

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why set GOBIN?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In sg-go, not setting GOBIN yielded a bunch of errors with go get (whereas setting it fixed the issue).

run: echo "GOBIN=$GOPATH/bin" >> $GITHUB_ENV
- name: Set GO111MODULE

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Doesn't the GO111MODULE default to auto if not set?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It should, but not explicitly disabling GO111MODULE didn't work for version 1.16.

run: echo "GO111MODULE=off" >> $GITHUB_ENV
childish-sambino marked this conversation as resolved.
Show resolved Hide resolved

- name: Build smtpapi-go
run: make install
childish-sambino marked this conversation as resolved.
Show resolved Hide resolved

- name: Run Tests
run: make test

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
25 changes: 0 additions & 25 deletions .travis.yml

This file was deleted.

4 changes: 2 additions & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,9 @@ We welcome direct contributions to our smtpapi-go code base. Thank you!

#### Install and Run Locally ####

##### Prerequisites #####
##### Supported Versions #####

- Go 1.6
- Go 1.11-1.16
childish-sambino marked this conversation as resolved.
Show resolved Hide resolved

##### Initial setup: #####

Expand Down
7 changes: 5 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
![SendGrid Logo](twilio_sendgrid_logo.png)

[![BuildStatus](https://travis-ci.com/sendgrid/smtpapi-go.svg?branch=main)](https://travis-ci.com/sendgrid/smtpapi-go)
[![BuildStatus](https://github.com/sendgrid/smtpapi-go/actions/workflows/test.yml/badge.svg)](https://github.com/sendgrid/smtpapi-go/actions/workflows/test.yml)
[![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)
[![GitHub contributors](https://img.shields.io/github/contributors/sendgrid/smtpapi-go.svg)](https://github.com/sendgrid/smtpapi-go/graphs/contributors)
Expand All @@ -27,9 +27,12 @@ All the updates to this library are documented in our [CHANGELOG](CHANGELOG.md).
<a name="installation"></a>
# Installation

## Supported Versions

* Go version 1.11-1.16

## Prerequisites

* Go version 1.6
* The SendGrid service, starting at the [free level](https://sendgrid.com/free?source=smtpapi-go)

## Install the Package
Expand Down
2 changes: 1 addition & 1 deletion smtpapi_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -371,7 +371,7 @@ func TestMarshalUnmarshall(t *testing.T) {
}

func TestRepoFiles(t *testing.T) {
files := []string{".env_sample", ".gitignore", ".travis.yml", "CHANGELOG.md", "CODE_OF_CONDUCT.md",
files := []string{".env_sample", ".gitignore", ".github/workflows/test.yml", "CHANGELOG.md", "CODE_OF_CONDUCT.md",
"CONTRIBUTING.md", "ISSUE_TEMPLATE.md", "LICENSE", "PULL_REQUEST_TEMPLATE.md",
"README.md", "TROUBLESHOOTING.md", "USAGE.md"}

Expand Down