Skip to content

Commit 3251610

Browse files
chore: migrate to gh actions (#1329)
* chore: migrate to gh actions
1 parent 2aed5b2 commit 3251610

5 files changed

Lines changed: 88 additions & 56 deletions

File tree

.codeclimate.yml

Lines changed: 0 additions & 15 deletions
This file was deleted.
Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
name: Test and Deploy
2+
on:
3+
push:
4+
branches: [ '*' ]
5+
tags: [ '*' ]
6+
pull_request:
7+
branches: [ main ]
8+
schedule:
9+
# Run automatically at 8AM PST Monday-Friday
10+
- cron: '0 15 * * 1-5'
11+
workflow_dispatch:
12+
13+
jobs:
14+
test:
15+
name: Test
16+
runs-on: ubuntu-latest
17+
timeout-minutes: 20
18+
strategy:
19+
matrix:
20+
node: [ 6, 7, 8, 10, lts/* ]
21+
steps:
22+
- name: Checkout sendgrid-nodejs
23+
uses: actions/checkout@v2
24+
25+
- name: Login to Docker Hub
26+
uses: docker/login-action@v1
27+
with:
28+
username: ${{ secrets.DOCKER_USERNAME }}
29+
password: ${{ secrets.DOCKER_AUTH_TOKEN }}
30+
31+
- name: Set up Node
32+
uses: actions/setup-node@v2
33+
with:
34+
node-version: ${{ matrix.node }}
35+
36+
- run: npm install
37+
- name: Run Tests
38+
run: make test-docker
39+
40+
deploy:
41+
name: Deploy
42+
if: success() && github.ref_type == 'tag'
43+
needs: [ test ]
44+
runs-on: ubuntu-latest
45+
steps:
46+
- name: Checkout sendgrid-nodejs
47+
uses: actions/checkout@v2
48+
with:
49+
fetch-depth: 0
50+
51+
- name: Set up Node
52+
uses: actions/setup-node@v2
53+
with:
54+
node-version: 10
55+
56+
- name: Create GitHub Release
57+
uses: sendgrid/dx-automator/actions/release@main
58+
env:
59+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
60+
61+
- run: npm install
62+
- name: Publish
63+
run: |
64+
npm config set //registry.npmjs.org/:_authToken ${NODE_AUTH_TOKEN}
65+
lerna publish from-package --yes --no-verify-access
66+
env:
67+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
68+
69+
notify-on-failure:
70+
name: Slack notify on failure
71+
if: failure() && github.event_name != 'pull_request' && (github.ref == 'refs/heads/main' || github.ref_type == 'tag')
72+
needs: [ test, deploy ]
73+
runs-on: ubuntu-latest
74+
steps:
75+
- uses: rtCamp/action-slack-notify@v2
76+
env:
77+
SLACK_COLOR: failure
78+
SLACK_ICON_EMOJI: ':github:'
79+
SLACK_MESSAGE: ${{ format('Tests *{0}*, Deploy *{1}*, {2}/{3}/actions/runs/{4}', needs.test.result, needs.deploy.result, github.server_url, github.repository, github.run_id) }}
80+
SLACK_TITLE: Action Failure - ${{ github.repository }}
81+
SLACK_USERNAME: GitHub Actions
82+
SLACK_MSG_AUTHOR: twilio-dx
83+
SLACK_FOOTER: Posted automatically using GitHub Actions
84+
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }}
85+
MSG_MINIMAL: true

.travis.yml

Lines changed: 0 additions & 34 deletions
This file was deleted.

packages/contact-importer/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
[![BuildStatus](https://travis-ci.com/sendgrid/sendgrid-nodejs.svg?branch=main)](https://travis-ci.com/sendgrid/sendgrid-nodejs)
1+
[![Test and Deploy](https://github.com/sendgrid/sendgrid-nodejs/actions/workflows/test-and-deploy.yml/badge.svg)](https://github.com/sendgrid/sendgrid-nodejs/actions/workflows/test-and-deploy.yml)
22
[![npm version](https://badge.fury.io/js/%40sendgrid%2Fclient.svg)](https://www.npmjs.com/org/sendgrid)
33
[![Email Notifications Badge](https://dx.sendgrid.com/badge/nodejs)](https://dx.sendgrid.com/newsletter/nodejs)
44

test/files.spec.js

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,8 @@ describe('sendgrid-nodejs repo', function() {
2020
assert(fileExists('.gitignore'));
2121
});
2222

23-
it('should have ./.travis.yml file', function() {
24-
assert(fileExists('.travis.yml'));
25-
});
26-
27-
it('should have ./.codeclimate.yml file', function() {
28-
assert(fileExists('.codeclimate.yml'));
23+
it('should have ./.github/workflows/test-and-deploy file', function() {
24+
assert(fileExists('.github/workflows/test-and-deploy.yml'));
2925
});
3026

3127
it('should have ./CHANGELOG.md file', function() {

0 commit comments

Comments
 (0)