Skip to content

Commit 95a55d8

Browse files
authored
DX-2856 Update Test workflow to include feature branch (#112)
* DX-2856 Update Test workflow to include feature branch * Add dependency to feature test only run if prod test passes * Checkout correct branch * Fix failure logic * Ubuntu22 does not support python 3.6 * Add dependency to notify_failures job so that it always runs * Add unsupported ubuntu/py combo to force a failure * Update failure logic * syntax * attempt to simplify * remove forced failure * Hardcode `failure` status Job only runs on failure so this is safe to do
1 parent 5650987 commit 95a55d8

File tree

1 file changed

+80
-9
lines changed

1 file changed

+80
-9
lines changed

.github/workflows/test.yaml

Lines changed: 80 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,24 @@ on:
55
- cron: "0 4 * * *"
66
pull_request:
77
workflow_dispatch:
8+
inputs:
9+
logLevel:
10+
description: Log level
11+
required: false
12+
default: WARNING
13+
type: choice
14+
options:
15+
- WARNING
16+
- DEBUG
817

918
jobs:
10-
deploy:
11-
name: Test
19+
test_production:
20+
name: Test Production
1221
runs-on: ${{ matrix.os }}
1322
strategy:
1423
matrix:
1524
os: [windows-2022, windows-2019, ubuntu-18.04, ubuntu-20.04]
16-
python-version: [3.6, 3.7, 3.8, 3.9]
25+
python-version: [3.6, 3.7, 3.8, 3.9, '3.10']
1726
steps:
1827
- name: Checkout
1928
uses: actions/checkout@v2
@@ -38,11 +47,73 @@ jobs:
3847
BASE_CALLBACK_URL: ${{ secrets.BASE_CALLBACK_URL }}
3948
run: python -m pytest --pyargs bandwidth
4049

41-
- name: Notify Slack of Failures
42-
uses: Bandwidth/[email protected]
43-
if: failure() && !github.event.pull_request.draft
50+
test_feature:
51+
name: Test Feature
52+
needs: test_production
53+
runs-on: ${{ matrix.os }}
54+
strategy:
55+
matrix:
56+
os: [windows-2022, windows-2019, ubuntu-20.04, ubuntu-22.04]
57+
python-version: [3.7, 3.8, 3.9, '3.10']
58+
env:
59+
BW_ACCOUNT_ID: ${{ secrets.BW_ACCOUNT_ID }}
60+
BW_USERNAME: ${{ secrets.BW_USERNAME }}
61+
BW_PASSWORD: ${{ secrets.BW_PASSWORD }}
62+
BW_USERNAME_FORBIDDEN: ${{ secrets.BW_USERNAME_FORBIDDEN }}
63+
BW_PASSWORD_FORBIDDEN: ${{ secrets.BW_PASSWORD_FORBIDDEN }}
64+
BW_VOICE_APPLICATION_ID: ${{ secrets.BW_VOICE_APPLICATION_ID }}
65+
BW_MESSAGING_APPLICATION_ID: ${{ secrets.BW_MESSAGING_APPLICATION_ID }}
66+
BW_NUMBER: ${{ secrets.BW_NUMBER }}
67+
USER_NUMBER: ${{ secrets.USER_NUMBER }}
68+
VZW_NUMBER: ${{ secrets.VZW_NUMBER }}
69+
ATT_NUMBER: ${{ secrets.ATT_NUMBER }}
70+
T_MOBILE_NUMBER: ${{ secrets.T_MOBILE_NUMBER }}
71+
BASE_CALLBACK_URL: ${{ secrets.BASE_CALLBACK_URL }}
72+
PYTHON_VERSION: ${{ matrix.python-version }}
73+
OPERATING_SYSTEM: ${{ matrix.os }}
74+
MANTECA_ACTIVE_NUMBER: ${{ secrets.MANTECA_ACTIVE_NUMBER }}
75+
MANTECA_IDLE_NUMBER: ${{ secrets.MANTECA_IDLE_NUMBER }}
76+
MANTECA_BASE_URL: ${{ secrets.MANTECA_BASE_URL }}
77+
MANTECA_APPLICATION_ID: ${{ secrets.MANTECA_APPLICATION_ID }}
78+
BW_NUMBER_PROVIDER: ${{ secrets.BW_NUMBER_PROVIDER }}
79+
steps:
80+
- name: Checkout
81+
uses: actions/checkout@v2
82+
with:
83+
ref: 'feature/openapi-generator-sdk'
84+
85+
- name: Set up Python
86+
uses: actions/setup-python@v2
4487
with:
45-
job-status: ${{ job.status }}
46-
slack-bot-token: ${{ secrets.SLACK_BOT_TOKEN }}
47-
slack-channel: ${{ secrets.SLACK_CHANNEL }}
88+
python-version: ${{ matrix.python-version }}
89+
90+
- name: Install Packages
91+
run: |
92+
pip install -r requirements.txt
93+
pip install -r test-requirements.txt
94+
95+
- name: Test at Debug Level
96+
if: ${{ inputs.logLevel == 'DEBUG' }}
97+
run: |
98+
echo "Log level: DEBUG"
99+
pytest -v --log-cli-level=DEBUG
100+
101+
- name: Test at Warning Level
102+
if: ${{( inputs.logLevel == null) || ( inputs.logLevel == 'WARNING') }}
103+
run: |
104+
echo "Log level: WARNING"
105+
pytest -v --log-cli-level=WARNING
106+
107+
notify_for_failures:
108+
name: Notify for Failures
109+
needs: [test_production, test_feature]
110+
if: failure() && !github.event.pull_request.draft
111+
runs-on: ubuntu-latest
112+
steps:
113+
- name: Notify Slack of Failures
114+
uses: Bandwidth/[email protected]
115+
with:
116+
job-status: failure
117+
slack-bot-token: ${{ secrets.SLACK_BOT_TOKEN }}
118+
slack-channel: ${{ secrets.SLACK_CHANNEL }}
48119

0 commit comments

Comments
 (0)