-
Notifications
You must be signed in to change notification settings - Fork 475
90 lines (86 loc) · 3.61 KB
/
Copy pathbrowser-compatibility-test.yml
File metadata and controls
90 lines (86 loc) · 3.61 KB
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
name: Browser Compatibility Test
on:
schedule:
- cron: '0 13 * * *'
env:
CLOUD_WATCH_METRIC: false
TEST_TYPE: Browser-Compatibility-Test
SAUCE_USERNAME: ${{secrets.SAUCE_USERNAME}}
SAUCE_ACCESS_KEY: ${{secrets.SAUCE_ACCESS_KEY}}
TEST_URL: ${{secrets.TEST_URL}}
MESSAGING_USER_ARN: ${{secrets.MESSAGING_USER_ARN}}
SLACK_JS_SDK_DEV_CORE_WEBHOOK: ${{secrets.SLACK_JS_SDK_DEV_CORE_WEBHOOK}}
PRE_RUN_SCRIPT_URL: ${{secrets.PRE_RUN_SCRIPT_URL}}
METRIC_NAME: ${{ secrets.METRIC_NAME }}
METRIC_NAMESPACE: ${{ secrets.METRIC_NAMESPACE }}
GITHUB_TOKEN: ${{ github.token }}
permissions:
id-token: write # This is required for requesting the JWT
jobs:
browser-compatibility-tests:
name: Browser Compatibility Test
runs-on: ubuntu-latest
steps:
- name: Checkout Package
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup GitHub Actions Host
uses: ./.github/actions/setup-integration-test
with:
aws-role-to-assume: ${{ secrets.AWS_ROLE_TO_ASSUME_SDK_DEV }}
aws-role-session-name: ${{ env.TEST_TYPE }}
sauce-username: ${{ secrets.SAUCE_USERNAME }}
sauce-access-key: ${{ secrets.SAUCE_ACCESS_KEY }}
browser-compatibility-test: true
- name: Run Audio Test
id: audio_test
continue-on-error: true
working-directory: ./integration
run: npm run test -- --test-name AudioTest --host saucelabs --test-type browser-compatibility
- name: Run Video Test
id: video_test
continue-on-error: true
working-directory: ./integration
run: npm run test -- --test-name VideoTest --host saucelabs --test-type browser-compatibility
# - name: Run Video Processing Test
# working-directory: ./integration
# run: npm run test -- --test-name VideoProcessingTest --host saucelabs --test-type browser-compatibility
- name: Configure AWS Credentials for CloudWatch
if: always()
uses: aws-actions/configure-aws-credentials@v4
with:
role-to-assume: ${{ secrets.AWS_ROLE_TO_ASSUME_SDK_DEV }}
aws-region: us-east-1
- name: Send Metric to CloudWatch
if: always()
run: |
npm install @aws-sdk/client-cloudwatch
node -e "
const { CloudWatchClient, PutMetricDataCommand } = require('@aws-sdk/client-cloudwatch');
const client = new CloudWatchClient({ region: 'us-east-1' });
const allPassed = '${{ steps.audio_test.outcome }}' === 'success' && '${{ steps.video_test.outcome }}' === 'success';
const value = allPassed ? 1 : 0;
const command = new PutMetricDataCommand({
Namespace: process.env.METRIC_NAMESPACE,
MetricData: [{
MetricName: process.env.METRIC_NAME,
Dimensions: [
{ Name: 'Platform', Value: 'JS SDK Daily Compatibility' }
],
Value: value,
}]
});
client.send(command).then(() => console.log('Daily test result sent to CloudWatch')).catch(err => {
console.error('Failed to send metric. Error: ', err);
process.exit(1);
});
"
- name: Fail job if any test failed
if: always()
run: |
if [ "${{ steps.audio_test.outcome }}" != "success" ] || [ "${{ steps.video_test.outcome }}" != "success" ]; then
echo "One or more browser compatibility tests failed (AudioTest=${{ steps.audio_test.outcome }}, VideoTest=${{ steps.video_test.outcome }})"
exit 1
fi
echo "All browser compatibility tests passed"