Skip to content

Commit 534c16c

Browse files
authored
SWI-2096 Update Test Workflow (#91)
1 parent 33ad57b commit 534c16c

File tree

1 file changed

+65
-39
lines changed

1 file changed

+65
-39
lines changed

.github/workflows/test.yml

Lines changed: 65 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -4,43 +4,51 @@ on:
44
schedule:
55
- cron: "0 4 * * *"
66
pull_request:
7-
workflow_dispatch:
87

98
concurrency:
109
group: ${{ github.workflow }}-${{ github.head_ref }}
1110
cancel-in-progress: true
1211

12+
env:
13+
BW_ACCOUNT_ID: ${{ secrets.BW_ACCOUNT_ID }}
14+
BW_USERNAME: ${{ secrets.BW_USERNAME }}
15+
BW_PASSWORD: ${{ secrets.BW_PASSWORD }}
16+
BW_USERNAME_FORBIDDEN: ${{ secrets.BW_USERNAME_FORBIDDEN }}
17+
BW_PASSWORD_FORBIDDEN: ${{ secrets.BW_PASSWORD_FORBIDDEN }}
18+
BW_VOICE_APPLICATION_ID: ${{ secrets.BW_VOICE_APPLICATION_ID }}
19+
BW_MESSAGING_APPLICATION_ID: ${{ secrets.BW_MESSAGING_APPLICATION_ID }}
20+
BW_NUMBER: ${{ secrets.BW_NUMBER }}
21+
USER_NUMBER: ${{ secrets.USER_NUMBER }}
22+
BASE_CALLBACK_URL: ${{ secrets.BASE_CALLBACK_URL }}
23+
MANTECA_ACTIVE_NUMBER: ${{ secrets.MANTECA_ACTIVE_NUMBER }}
24+
MANTECA_IDLE_NUMBER: ${{ secrets.MANTECA_IDLE_NUMBER }}
25+
MANTECA_BASE_URL: ${{ secrets.MANTECA_BASE_URL }}
26+
MANTECA_APPLICATION_ID: ${{ secrets.MANTECA_APPLICATION_ID }}
27+
1328
jobs:
14-
test_production:
15-
name: Test Production
29+
test_main:
30+
name: Test Main Branch
1631
runs-on: ${{ matrix.os }}
32+
if: ${{ github.event_name == 'schedule' }}
1733
strategy:
1834
matrix:
1935
os: [windows-2022, windows-2019, ubuntu-20.04, ubuntu-22.04]
2036
ruby-version: [2.6, 2.7, 3.0]
2137
steps:
2238
- name: Checkout
2339
uses: actions/checkout@v3
40+
with:
41+
ref: 'main'
2442

2543
- name: Set up Ruby
2644
uses: ruby/setup-ruby@v1
2745
with:
2846
ruby-version: ${{ matrix.ruby-version }}
2947

30-
- name: Install Packages
31-
run: bundle install
32-
33-
- name: Test
34-
env:
35-
BW_ACCOUNT_ID: ${{ secrets.BW_ACCOUNT_ID }}
36-
BW_USERNAME: ${{ secrets.BW_USERNAME }}
37-
BW_PASSWORD: ${{ secrets.BW_PASSWORD }}
38-
BW_VOICE_APPLICATION_ID: ${{ secrets.BW_VOICE_APPLICATION_ID }}
39-
BW_MESSAGING_APPLICATION_ID: ${{ secrets.BW_MESSAGING_APPLICATION_ID }}
40-
BW_NUMBER: ${{ secrets.BW_NUMBER }}
41-
USER_NUMBER: ${{ secrets.USER_NUMBER }}
42-
BASE_CALLBACK_URL: ${{ secrets.BASE_CALLBACK_URL }}
43-
run: rake
48+
- name: Install Packages and Test
49+
run: |
50+
bundle install
51+
rake
4452
4553
- name: Notify Slack of Failures
4654
uses: Bandwidth/[email protected]
@@ -52,12 +60,15 @@ jobs:
5260

5361
test_feature:
5462
name: Test Feature Branch
55-
needs: test_production
5663
runs-on: ${{ matrix.os }}
64+
if: ${{ github.event_name == 'schedule' }}
5765
strategy:
5866
matrix:
5967
os: [windows-2022, windows-2019, ubuntu-20.04, ubuntu-22.04]
6068
ruby-version: [2.7, 3.0, 3.1, 3.2]
69+
env:
70+
RUBY_VERSION: ${{ matrix.ruby-version }}
71+
OPERATING_SYSTEM: ${{ matrix.os }}
6172
steps:
6273
- name: Checkout
6374
uses: actions/checkout@v3
@@ -69,28 +80,43 @@ jobs:
6980
with:
7081
ruby-version: ${{ matrix.ruby-version }}
7182

72-
- name: Install Packages
73-
run: bundle install
83+
- name: Install Packages and Test
84+
run: |
85+
bundle install
86+
rake
87+
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 }}
107+
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 }}
74115

75-
- name: Test
76-
env:
77-
BW_ACCOUNT_ID: ${{ secrets.BW_ACCOUNT_ID }}
78-
BW_USERNAME: ${{ secrets.BW_USERNAME }}
79-
BW_PASSWORD: ${{ secrets.BW_PASSWORD }}
80-
BW_USERNAME_FORBIDDEN: ${{ secrets.BW_USERNAME_FORBIDDEN }}
81-
BW_PASSWORD_FORBIDDEN: ${{ secrets.BW_PASSWORD_FORBIDDEN }}
82-
BW_VOICE_APPLICATION_ID: ${{ secrets.BW_VOICE_APPLICATION_ID }}
83-
BW_MESSAGING_APPLICATION_ID: ${{ secrets.BW_MESSAGING_APPLICATION_ID }}
84-
BW_NUMBER: ${{ secrets.BW_NUMBER }}
85-
USER_NUMBER: ${{ secrets.USER_NUMBER }}
86-
BASE_CALLBACK_URL: ${{ secrets.BASE_CALLBACK_URL }}
87-
RUBY_VERSION: ${{ matrix.ruby-version }}
88-
OPERATING_SYSTEM: ${{ matrix.os }}
89-
MANTECA_ACTIVE_NUMBER: ${{ secrets.MANTECA_ACTIVE_NUMBER }}
90-
MANTECA_IDLE_NUMBER: ${{ secrets.MANTECA_IDLE_NUMBER }}
91-
MANTECA_BASE_URL: ${{ secrets.MANTECA_BASE_URL }}
92-
MANTECA_APPLICATION_ID: ${{ secrets.MANTECA_APPLICATION_ID }}
93-
run: rake
116+
- name: Install Packages and Test
117+
run: |
118+
bundle install
119+
rake
94120
95121
- name: Notify Slack of Failures
96122
uses: Bandwidth/[email protected]

0 commit comments

Comments
 (0)