Skip to content

Commit c06b8c2

Browse files
chore: merge test and deploy workflows (#137)
1 parent a8d5e4d commit c06b8c2

File tree

3 files changed

+39
-61
lines changed

3 files changed

+39
-61
lines changed

.github/workflows/release.yml renamed to .github/workflows/test-and-deploy.yml

+38-10
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,41 @@
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
16+
runs-on: ubuntu-latest
17+
timeout-minutes: 20
18+
strategy:
19+
matrix:
20+
java: [8, 11]
21+
steps:
22+
- uses: actions/checkout@v2
23+
24+
- name: Set up Java
25+
uses: actions/setup-java@v2
26+
with:
27+
distribution: 'temurin'
28+
java-version: ${{ matrix.java }}
29+
cache: 'maven'
30+
31+
- run: mvn install -DskipTests=true -Dgpg.skip -Dmaven.javadoc.skip=true -B -V
32+
- name: Run Unit Tests
33+
run: mvn test -B
34+
35+
deploy:
36+
name: Deploy
37+
if: success() && github.ref_type == 'tag'
38+
needs: [ test ]
1139
runs-on: ubuntu-latest
1240
steps:
1341
- uses: actions/checkout@v2
@@ -33,16 +61,16 @@ jobs:
3361

3462
notify-on-failure:
3563
name: Slack notify on failure
36-
if: ${{ failure() }}
37-
needs: [release]
64+
if: failure() && github.event_name != 'pull_request' && (github.ref == 'refs/heads/main' || github.ref_type == 'tag')
65+
needs: [ test, deploy ]
3866
runs-on: ubuntu-latest
3967
steps:
4068
- uses: rtCamp/action-slack-notify@v2
4169
env:
42-
SLACK_COLOR: 'danger'
70+
SLACK_COLOR: failure
4371
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
72+
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) }}
73+
SLACK_TITLE: Action Failure - ${{ github.repository }}
4674
SLACK_USERNAME: GitHub Actions
4775
SLACK_MSG_AUTHOR: twilio-dx
4876
SLACK_FOOTER: Posted automatically using GitHub Actions

.github/workflows/test.yml

-50
This file was deleted.

README.md

+1-1
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/java-http-client/actions/workflows/test.yml/badge.svg)](https://github.com/sendgrid/java-http-client/actions/workflows/test.yml)
3+
[![Test and Deploy](https://github.com/sendgrid/java-http-client/actions/workflows/test-and-deploy.yml/badge.svg)](https://github.com/sendgrid/java-http-client/actions/workflows/test-and-deploy.yml)
44
[![Maven Central](https://img.shields.io/maven-central/v/com.sendgrid/java-http-client.svg)](http://mvnrepository.com/artifact/com.sendgrid/java-http-client)
55
[![MIT licensed](https://img.shields.io/badge/license-MIT-blue.svg)](LICENSE)
66
[![Twitter Follow](https://img.shields.io/twitter/follow/sendgrid.svg?style=social&label=Follow)](https://twitter.com/sendgrid)

0 commit comments

Comments
 (0)