Skip to content

Commit c655b12

Browse files
authored
chore: migrate to github actions (#709)
1 parent f6b666c commit c655b12

File tree

8 files changed

+97
-83
lines changed

8 files changed

+97
-83
lines changed

.codeclimate.yml

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

.github/workflows/release.yml

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
name: Release
2+
on:
3+
push:
4+
tags:
5+
- '*'
6+
workflow_dispatch:
7+
8+
jobs:
9+
release:
10+
name: Release
11+
runs-on: ubuntu-latest
12+
steps:
13+
- uses: actions/checkout@v2
14+
15+
- name: Set up Sonatype Maven
16+
uses: actions/setup-java@v2
17+
with:
18+
java-version: 8
19+
distribution: temurin
20+
server-id: ossrh
21+
server-username: MAVEN_USERNAME
22+
server-password: MAVEN_PASSWORD
23+
gpg-private-key: ${{ secrets.GPG_PRIVATE_KEY }}
24+
gpg-passphrase: GPG_PASSPHRASE
25+
26+
- run: mvn install -DskipTests=true -Dgpg.skip -Dmaven.javadoc.skip=true -B -V
27+
- name: Publish to Maven
28+
env:
29+
MAVEN_USERNAME: ${{ secrets.SONATYPE_USERNAME }}
30+
MAVEN_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }}
31+
GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
32+
run: mvn clean deploy -DskipTests=true -B -U -Prelease
33+
34+
notify-on-failure:
35+
name: Slack notify on failure
36+
if: ${{ failure() }}
37+
needs: [release]
38+
runs-on: ubuntu-latest
39+
steps:
40+
- uses: rtCamp/action-slack-notify@v2
41+
env:
42+
SLACK_COLOR: 'danger'
43+
SLACK_ICON_EMOJI: ':github:'
44+
SLACK_MESSAGE: ${{ format('Failed to release {1}{3} {0}/{1}/actions/runs/{2}', github.server_url, github.repository, github.run_id, ':') }}
45+
SLACK_TITLE: Release Failure
46+
SLACK_USERNAME: GitHub Actions
47+
SLACK_MSG_AUTHOR: twilio-dx
48+
SLACK_FOOTER: Posted automatically using GitHub Actions
49+
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }}
50+
MSG_MINIMAL: true

.github/workflows/test.yml

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
name: Tests
2+
on:
3+
push:
4+
branches: [ '*' ]
5+
pull_request:
6+
branches: [ main ]
7+
schedule:
8+
# Run automatically at 8AM PST Monday-Friday
9+
- cron: '0 15 * * 1-5'
10+
workflow_dispatch:
11+
12+
jobs:
13+
test:
14+
name: Test
15+
runs-on: ubuntu-latest
16+
timeout-minutes: 20
17+
strategy:
18+
matrix:
19+
java: [8, 11]
20+
steps:
21+
- uses: actions/checkout@v2
22+
23+
- name: Run Unit Tests
24+
run: make test-docker version=${{ matrix.java }}
25+
26+
notify-on-failure:
27+
name: Slack notify on failure
28+
if: ${{ failure() && github.ref == 'refs/heads/main' && github.event_name != 'pull_request' }}
29+
needs: [test]
30+
runs-on: ubuntu-latest
31+
steps:
32+
- uses: rtCamp/action-slack-notify@v2
33+
env:
34+
SLACK_COLOR: ${{ needs.test.status }}
35+
SLACK_ICON_EMOJI: ':github:'
36+
SLACK_MESSAGE: ${{ format('Build {2} in {1} failed{3} {0}/{1}/actions/runs/{2}', github.server_url, github.repository, github.run_id, ':') }}
37+
SLACK_TITLE: Build Failure
38+
SLACK_USERNAME: GitHub Actions
39+
SLACK_MSG_AUTHOR: twilio-dx
40+
SLACK_FOOTER: Posted automatically using GitHub Actions
41+
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }}
42+
MSG_MINIMAL: true

.maven.xml

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

.travis.yml

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

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
![SendGrid Logo](twilio_sendgrid_logo.png)
22

3-
[![Travis Badge](https://travis-ci.com/sendgrid/sendgrid-java.svg?branch=main)](https://travis-ci.com/sendgrid/sendgrid-java)
3+
[![BuildStatus](https://github.com/sendgrid/sendgrid-java/actions/workflows/test.yml/badge.svg)](https://github.com/sendgrid/sendgrid-java/actions/workflows/test.yml)
44
[![Maven Central](https://img.shields.io/maven-central/v/com.sendgrid/sendgrid-java.svg)](http://mvnrepository.com/artifact/com.sendgrid/sendgrid-java)
55
[![Twitter Follow](https://img.shields.io/twitter/follow/sendgrid.svg?style=social&label=Follow)](https://twitter.com/sendgrid)
66
[![GitHub contributors](https://img.shields.io/github/contributors/sendgrid/sendgrid-java.svg)](https://github.com/sendgrid/sendgrid-java/graphs/contributors)

src/test/java/com/sendgrid/SendGridTest.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2193,25 +2193,25 @@ public void test_suppression_invalid_emails__email__delete() throws IOException
21932193
}
21942194

21952195
@Test
2196-
public void test_suppression_spam_report__email__get() throws IOException {
2196+
public void test_suppression_spam_reports__email__get() throws IOException {
21972197
SendGrid sg = new SendGrid("SENDGRID_API_KEY");
21982198
sg.addRequestHeader("X-Mock", "200");
21992199

22002200
Request request = new Request();
22012201
request.setMethod(Method.GET);
2202-
request.setEndpoint("suppression/spam_report/{email}");
2202+
request.setEndpoint("suppression/spam_reports/{email}");
22032203
Response response = sg.api(request);
22042204
Assert.assertEquals(200, response.getStatusCode());
22052205
}
22062206

22072207
@Test
2208-
public void test_suppression_spam_report__email__delete() throws IOException {
2208+
public void test_suppression_spam_reports__email__delete() throws IOException {
22092209
SendGrid sg = new SendGrid("SENDGRID_API_KEY");
22102210
sg.addRequestHeader("X-Mock", "204");
22112211

22122212
Request request = new Request();
22132213
request.setMethod(Method.DELETE);
2214-
request.setEndpoint("suppression/spam_report/{email}");
2214+
request.setEndpoint("suppression/spam_reports/{email}");
22152215
Response response = sg.api(request);
22162216
Assert.assertEquals(204, response.getStatusCode());
22172217
}

src/test/java/com/sendgrid/TestRequiredFilesExist.java

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -25,18 +25,6 @@ public void checkGitIgnoreExists() {
2525
assertTrue(new File("./.gitignore").exists());
2626
}
2727

28-
// ./.travis.yml
29-
@Test
30-
public void checkTravisExists() {
31-
assertTrue(new File("./.travis.yml").exists());
32-
}
33-
34-
// ./.codeclimate.yml
35-
@Test
36-
public void checkCodeClimateExists() {
37-
assertTrue(new File("./.codeclimate.yml").exists());
38-
}
39-
4028
// ./CHANGELOG.md
4129
@Test
4230
public void checkChangelogExists() {

0 commit comments

Comments
 (0)