Skip to content

Commit 67ce090

Browse files
authored
SWI-2096 Update Test Workflow (#92)
* SWI-2096 Slack Notify * migrate to 2 workflows to maintain test matrix * typo * fix slack notify logic * move env vars
1 parent 534c16c commit 67ce090

File tree

2 files changed

+83
-51
lines changed

2 files changed

+83
-51
lines changed
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
1-
name: Test
1+
name: Test Main and Feature Branch Nightly
22

33
on:
44
schedule:
55
- cron: "0 4 * * *"
6-
pull_request:
76

87
concurrency:
98
group: ${{ github.workflow }}-${{ github.head_ref }}
@@ -27,9 +26,8 @@ env:
2726

2827
jobs:
2928
test_main:
30-
name: Test Main Branch
29+
name: Test Main Branch Nightly
3130
runs-on: ${{ matrix.os }}
32-
if: ${{ github.event_name == 'schedule' }}
3331
strategy:
3432
matrix:
3533
os: [windows-2022, windows-2019, ubuntu-20.04, ubuntu-22.04]
@@ -50,25 +48,13 @@ jobs:
5048
bundle install
5149
rake
5250
53-
- name: Notify Slack of Failures
54-
uses: Bandwidth/[email protected]
55-
if: failure() && !github.event.pull_request.draft
56-
with:
57-
job-status: ${{ job.status }}
58-
slack-bot-token: ${{ secrets.SLACK_BOT_TOKEN }}
59-
slack-channel: ${{ secrets.SLACK_CHANNEL }}
60-
6151
test_feature:
62-
name: Test Feature Branch
52+
name: Test Feature Branch Nightly
6353
runs-on: ${{ matrix.os }}
64-
if: ${{ github.event_name == 'schedule' }}
6554
strategy:
6655
matrix:
6756
os: [windows-2022, windows-2019, ubuntu-20.04, ubuntu-22.04]
6857
ruby-version: [2.7, 3.0, 3.1, 3.2]
69-
env:
70-
RUBY_VERSION: ${{ matrix.ruby-version }}
71-
OPERATING_SYSTEM: ${{ matrix.os }}
7258
steps:
7359
- name: Checkout
7460
uses: actions/checkout@v3
@@ -81,47 +67,21 @@ jobs:
8167
ruby-version: ${{ matrix.ruby-version }}
8268

8369
- name: Install Packages and Test
70+
env:
71+
RUBY_VERSION: ${{ matrix.ruby-version }}
72+
OPERATING_SYSTEM: ${{ matrix.os }}
8473
run: |
8574
bundle install
8675
rake
8776
88-
- name: Notify Slack of Failures
89-
uses: Bandwidth/[email protected]
90-
if: failure() && !github.event.pull_request.draft
91-
with:
92-
job-status: ${{ job.status }}
93-
slack-bot-token: ${{ secrets.SLACK_BOT_TOKEN }}
94-
slack-channel: ${{ secrets.SLACK_CHANNEL }}
95-
96-
test_pr:
97-
name: Test PR Branch
98-
runs-on: ${{ matrix.os }}
99-
if: ${{ github.event_name == 'pull_request' }}
100-
strategy:
101-
matrix:
102-
os: [windows-2022, windows-2019, ubuntu-20.04, ubuntu-22.04]
103-
ruby-version: [2.7, 3.0, 3.1, 3.2]
104-
env:
105-
RUBY_VERSION: ${{ matrix.ruby-version }}
106-
OPERATING_SYSTEM: ${{ matrix.os }}
77+
notify_for_failures:
78+
name: Notify for Failures
79+
if: failure()
80+
runs-on: ubuntu-latest
10781
steps:
108-
- name: Checkout
109-
uses: actions/checkout@v3
110-
111-
- name: Set up Ruby
112-
uses: ruby/setup-ruby@v1
113-
with:
114-
ruby-version: ${{ matrix.ruby-version }}
115-
116-
- name: Install Packages and Test
117-
run: |
118-
bundle install
119-
rake
120-
12182
- name: Notify Slack of Failures
12283
uses: Bandwidth/[email protected]
123-
if: failure() && !github.event.pull_request.draft
12484
with:
125-
job-status: ${{ job.status }}
85+
job-status: failure
12686
slack-bot-token: ${{ secrets.SLACK_BOT_TOKEN }}
12787
slack-channel: ${{ secrets.SLACK_CHANNEL }}

.github/workflows/test-pr.yml

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
name: Test PR
2+
3+
on:
4+
pull_request:
5+
6+
concurrency:
7+
group: ${{ github.workflow }}-${{ github.head_ref }}
8+
cancel-in-progress: true
9+
10+
env:
11+
BW_ACCOUNT_ID: ${{ secrets.BW_ACCOUNT_ID }}
12+
BW_USERNAME: ${{ secrets.BW_USERNAME }}
13+
BW_PASSWORD: ${{ secrets.BW_PASSWORD }}
14+
BW_USERNAME_FORBIDDEN: ${{ secrets.BW_USERNAME_FORBIDDEN }}
15+
BW_PASSWORD_FORBIDDEN: ${{ secrets.BW_PASSWORD_FORBIDDEN }}
16+
BW_VOICE_APPLICATION_ID: ${{ secrets.BW_VOICE_APPLICATION_ID }}
17+
BW_MESSAGING_APPLICATION_ID: ${{ secrets.BW_MESSAGING_APPLICATION_ID }}
18+
BW_NUMBER: ${{ secrets.BW_NUMBER }}
19+
USER_NUMBER: ${{ secrets.USER_NUMBER }}
20+
BASE_CALLBACK_URL: ${{ secrets.BASE_CALLBACK_URL }}
21+
MANTECA_ACTIVE_NUMBER: ${{ secrets.MANTECA_ACTIVE_NUMBER }}
22+
MANTECA_IDLE_NUMBER: ${{ secrets.MANTECA_IDLE_NUMBER }}
23+
MANTECA_BASE_URL: ${{ secrets.MANTECA_BASE_URL }}
24+
MANTECA_APPLICATION_ID: ${{ secrets.MANTECA_APPLICATION_ID }}
25+
26+
jobs:
27+
test_pr_main:
28+
name: Test PR to Main Branch
29+
runs-on: ${{ matrix.os }}
30+
if: github.base_ref == 'main'
31+
strategy:
32+
matrix:
33+
os: [windows-2022, windows-2019, ubuntu-20.04, ubuntu-22.04]
34+
ruby-version: [2.6, 2.7, 3.0]
35+
steps:
36+
- name: Checkout
37+
uses: actions/checkout@v3
38+
39+
- name: Set up Ruby
40+
uses: ruby/setup-ruby@v1
41+
with:
42+
ruby-version: ${{ matrix.ruby-version }}
43+
44+
- name: Install Packages and Test
45+
run: |
46+
bundle install
47+
rake
48+
49+
test_pr_feature:
50+
name: Test PR to Feature Branch
51+
runs-on: ${{ matrix.os }}
52+
if: github.base_ref == 'feature/openapi-generator-sdk'
53+
strategy:
54+
matrix:
55+
os: [windows-2022, windows-2019, ubuntu-20.04, ubuntu-22.04]
56+
ruby-version: [2.7, 3.0, 3.1, 3.2]
57+
steps:
58+
- name: Checkout
59+
uses: actions/checkout@v3
60+
61+
- name: Set up Ruby
62+
uses: ruby/setup-ruby@v1
63+
with:
64+
ruby-version: ${{ matrix.ruby-version }}
65+
66+
- name: Install Packages and Test
67+
env:
68+
RUBY_VERSION: ${{ matrix.ruby-version }}
69+
OPERATING_SYSTEM: ${{ matrix.os }}
70+
run: |
71+
bundle install
72+
rake

0 commit comments

Comments
 (0)