Skip to content

Commit 3633b38

Browse files
authored
chore: merge test and deploy workflows (#715)
1 parent b91aae4 commit 3633b38

File tree

3 files changed

+32
-52
lines changed

3 files changed

+32
-52
lines changed
Lines changed: 31 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,37 @@
1-
name: Release
1+
name: Test and Deploy
22
on:
33
push:
4-
tags:
5-
- '*'
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'
611
workflow_dispatch:
712

813
jobs:
9-
release:
10-
name: Release
14+
test:
15+
name: Test
1116
runs-on: ubuntu-latest
17+
timeout-minutes: 20
18+
strategy:
19+
matrix:
20+
java: [8, 11]
1221
steps:
22+
- name: Checkout sendgrid-java
23+
- uses: actions/checkout@v2
24+
25+
- name: Run Unit Tests
26+
run: make test-docker version=${{ matrix.java }}
27+
28+
deploy:
29+
name: Deploy
30+
if: success() && github.ref_type == 'tag'
31+
needs: [ test ]
32+
runs-on: ubuntu-latest
33+
steps:
34+
- name: Checkout sendgrid-java
1335
- uses: actions/checkout@v2
1436

1537
- name: Set up Sonatype Maven
@@ -33,16 +55,16 @@ jobs:
3355

3456
notify-on-failure:
3557
name: Slack notify on failure
36-
if: ${{ failure() }}
37-
needs: [release]
58+
if: failure() && github.event_name != 'pull_request' && (github.ref == 'refs/heads/main' || github.ref_type == 'tag')
59+
needs: [ test, deploy ]
3860
runs-on: ubuntu-latest
3961
steps:
4062
- uses: rtCamp/action-slack-notify@v2
4163
env:
4264
SLACK_COLOR: failure
4365
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
66+
SLACK_MESSAGE: ${{ format('Test *{0}*, Deploy *{1}*, {2}/{3}/actions/runs/{4}', needs.test.result, needs.deploy.result, github.server_url, github.repository, github.run_id) }}
67+
SLACK_TITLE: Action Failure - ${{ github.repository }}
4668
SLACK_USERNAME: GitHub Actions
4769
SLACK_MSG_AUTHOR: twilio-dx
4870
SLACK_FOOTER: Posted automatically using GitHub Actions

.github/workflows/test.yml

Lines changed: 0 additions & 42 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-
[![BuildStatus](https://github.com/sendgrid/sendgrid-java/actions/workflows/test.yml/badge.svg)](https://github.com/sendgrid/sendgrid-java/actions/workflows/test.yml)
3+
[![BuildStatus](https://github.com/sendgrid/sendgrid-java/actions/workflows/test-and-deploy.yml/badge.svg)](https://github.com/sendgrid/sendgrid-java/actions/workflows/test-and-deploy.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)

0 commit comments

Comments
 (0)