-
Notifications
You must be signed in to change notification settings - Fork 0
84 lines (69 loc) · 2.27 KB
/
build_and_test.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
# This workflow will build a Java project with Maven
# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-maven
name: Build
on:
push:
branches:
- '**'
tags-ignore:
- '**'
env:
IS_NON_FEATURE_BRANCH: ${{ github.ref == 'refs/heads/develop' || github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/heads/release') }}
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
# test against latest update of each major Java version, as well as specific updates of LTS versions:
java: [8, 11.0.x, 13 ]
steps:
- name: Checkout the code
uses: actions/checkout@v2
- name: Cache the maven artifacts
uses: actions/cache@v1
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: |
${{ runner.os }}-maven-
- name: Configure java
uses: actions/setup-java@v1
with:
java-version: ${{ matrix.java }}
- name: Build and run tests
run: mvn -B package
- run: echo ${{ env.IS_NON_FEATURE_BRANCH }}
- name: Run integration tests
run: mvn verify
if: env.IS_NON_FEATURE_BRANCH == 'true'
env:
REVAI_ACCESS_TOKEN: ${{ secrets.INTEGRATION_TEST_ACCESS_TOKEN }}
- name: Save build artifacts to staging area
run: mkdir staging && cp target/*.jar staging
- name: Upload build artifacts
uses: actions/upload-artifact@v3
with:
name: Package
path: staging
- name: Notify slack fail
if: failure() && env.IS_NON_FEATURE_BRANCH == 'true'
env:
SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }}
uses: voxmedia/github-action-slack-notify-build@v1
with:
channel: revai-alerts-prod
status: FAILED
color: danger
slack_success:
runs-on: ubuntu-latest
needs: build
steps:
- name: Notify slack success
if: success() && env.IS_NON_FEATURE_BRANCH == 'true'
env:
SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }}
uses: voxmedia/github-action-slack-notify-build@v1
with:
channel: revai-alerts-prod
status: SUCCESS
color: good