-
Notifications
You must be signed in to change notification settings - Fork 0
156 lines (139 loc) · 5.61 KB
/
scheduled-idp-web-tests.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
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
name: Scheduled UW IdP Test Matrix
on:
push:
branches:
# You can test this workflow by pushing to this branch
- run-scheduled-idp-web-tests
schedule:
# The cron string must be quoted!
# https://docs.github.com/en/actions/reference/events-that-trigger-workflows#schedule
# Do not change this without also changing stop-test-service-providers.yml
- cron: '0 10 * * *' # 3am PDT, 2am PST
jobs:
run-web-tests:
strategy:
matrix:
include:
- idp_env: eval
- idp_env: prod
fail-fast: false # Don't cancel prod tests if eval fails and vice versa
runs-on: ubuntu-latest
permissions:
contents: read
id-token: write
actions: write
env:
SLACK_BOT_TOKEN: ${{ secrets.ACTIONS_SLACK_BOT_TOKEN }}
ARTIFACT_BUCKET: ${{ secrets.IDENTITY_ARTIFACT_BUCKET }}
steps:
- uses: actions/checkout@v3
- id: config
run: |
set -x
timestamp=$(date "+%Y.%d.%m-%H.%m.%S")
storyboard_path="idp/schedule/${{ matrix.idp_env }}/${timestamp}"
report_dir="web-tests/${storyboard_path}"
echo timestamp=${timestamp} >> $GITHUB_OUTPUT
echo storyboard_path=${storyboard_path} >> $GITHUB_OUTPUT
echo report_dir=${report_dir} >> $GITHUB_OUTPUT
echo storyboard_link=${storyboard_url}/${report_dir}/index.html >> $GITHUB_OUTPUT
echo workflow_link=${{ env.workflow_link }} >> $GITHUB_OUTPUT
env:
storyboard_url: https://identity-artifact.iamdev.s.uw.edu/
workflow_link: https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}
- uses: UWIT-IAM/actions/[email protected]
with:
gcloud-token: ${{ secrets.TEST_RUNNER_GOOGLE_TOKEN }}
- name: Initialize slack workflow canvas
env:
IDP_ENV: ${{ steps.configure.outputs.idp-env }}
with:
json: >
{
"channel": "#iam-bots",
"status": "in progress",
"description": "Scheduled ${{ matrix.idp_env }} IdP Web Tests",
"steps": [
{
"description": "Run tests",
"stepId": "run-tests",
"status": "in progress"
},
{
"description": "Upload test artifacts",
"stepId": "upload-artifacts"
}
]
}
uses: UWIT-IAM/actions/[email protected]
id: slack
- if: steps.slack.outputs.canvas-id
name: Add workflow link to slack notification
uses: UWIT-IAM/actions/[email protected]
with:
command: add-artifact
description: "<${{ env.workflow_link }} | View Workflow>"
env:
workflow_link: ${{ steps.config.outputs.workflow_link }}
- name: Run tests
run: ./scripts/run-tests.sh -- --env ${{ matrix.idp_env }}
id: run
- name: Determine post-test actions
if: always()
run: |
if test -f webdriver-report/index.html
then
mkdir -pv ${{ steps.config.outputs.report_dir }}
cp -r webdriver-report/* ${{ steps.config.outputs.report_dir }}
echo upload_storyboards='true' >> $GITHUB_OUTPUT
fi
id: post-run
- if: always() && steps.slack.outputs.canvas-id
env:
run_status: ${{ steps.run.outcome == 'success' && 'succeeded' || 'failed' }}
upload_status: ${{ steps.post-run.outputs.upload_storyboards == 'true' && 'in progress' || 'failed'}}
uses: UWIT-IAM/actions/[email protected]
with:
step-id: run-tests, upload-artifacts
step-status: ${{ env.run_status }}, ${{ env.upload_status }}
command: update-workflow
- if: always() && steps.post-run.outputs.upload_storyboards == 'true'
name: Upload storyboards to identity-artifact
id: upload-storyboards
uses: google-github-actions/upload-cloud-storage@v0
with:
path: 'web-tests'
destination: ${{ secrets.IDENTITY_ARTIFACT_BUCKET }}
- if: >
always()
&& steps.post-run.outputs.upload_storyboards =='true'
&& steps.upload-storyboards.outcome == 'success'
&& steps.slack.outputs.canvas-id
name: Add storyboard link to slack notification
id: add-storyboard-link-to-slack
uses: UWIT-IAM/actions/[email protected]
with:
command: add-artifact
description: "<${{ steps.config.outputs.storyboard_link }} | View Storyboards>"
- if: >
always()
&& steps.post-run.outputs.upload_storyboards =='true'
&& steps.upload-storyboards.outcome == 'success'
name: Set notices on workflow
env:
storyboard_link: ${{ steps.config.outputs.storyboard_link }}
run: echo "::notice::Storyboards located at ${{ env.storyboard_link }}"
- if: >
always()
&& steps.post-run.outputs.upload_storyboards == 'true'
uses: UWIT-IAM/actions/[email protected]
env:
step_status: ${{ steps.upload-storyboards.outcome == 'success' && 'succeeded' || 'failed' }}
with:
command: update-workflow
step-id: upload-artifacts
step-status: ${{ env.step_status }}
- if: always() && steps.slack.outputs.canvas-id
uses: UWIT-IAM/actions/[email protected]
with:
workflow-status: ${{ job.status == 'success' && 'succeeded' || 'failed' }}