@@ -3,20 +3,33 @@ name: Daily Test
33on :
44 schedule :
55 # More information on cron https://crontab.guru/
6- # GitHub actions is using UTC time. Scheduling action at 4 am PST
7- - cron : ' 0 12 * * *'
6+ # GitHub actions is using UTC time. Scheduling action at 3 am PST
7+ - cron : ' 0 11 * * *'
88
99 workflow_dispatch :
1010
1111env :
1212 SAUCE_USERNAME : ${{ secrets.SAUCE_USERNAME }}
1313 SAUCE_ACCESS_KEY : ${{ secrets.SAUCE_ACCESS_KEY }}
1414 SLACK_WEBHOOK_URL : ${{ secrets.SLACK_WEBHOOK_URL }}
15+ DEMO_APP_DOWNLOAD_LINK : ${{ secrets.DEMO_APP_DOWNLOAD_LINK }}
16+ DEMO_APP_DOWNLOAD_LINK_NO_VIDEO_CODECS : ${{ secrets.DEMO_APP_DOWNLOAD_LINK_NO_VIDEO_CODECS }}
17+ ROLE_TO_ASSUME : ${{ secrets.ROLE_TO_ASSUME }}
18+ OIDC_PROVIDER_ARN : ${{ secrets.OIDC_PROVIDER_ARN }}
19+
20+ permissions :
21+ id-token : write
22+ contents : read
1523
1624jobs :
1725 daily-test :
1826 name : Amazon Chime Android SDK Daily Test
1927 runs-on : ubuntu-latest
28+ strategy :
29+ matrix :
30+ # Latest 2 Android versions. TODO: Upgrade to Appium 2 for OS 14 and above.
31+ os_list : ["12", "13"]
32+ demo_download_url_list : ["$DEMO_APP_DOWNLOAD_LINK", "$DEMO_APP_DOWNLOAD_LINK_NO_VIDEO_CODECS"]
2033 outputs :
2134 job-status : ${{ job.status }}
2235
@@ -30,31 +43,75 @@ jobs:
3043
3144 - name : Get latest prod demo app
3245 run : |
33- wget -O amazon-chime-sdk-app.apk ${{ secrets.DEMO_APP_DOWNLOAD_LINK }}
46+ wget -O amazon-chime-sdk-app.apk ${{ matrix.demo_download_url_list }}
3447
35- - name : Setup Node.js - 15 .x
48+ - name : Setup Node.js - 18 .x
3649 uses : actions/setup-node@v4
3750 with :
38- node-version : 15.x
51+ node-version : 18.x
52+
53+ - name : Install Dependencies
54+ run : |
55+ sudo apt-get update
56+ sudo apt-get install -y libcairo2-dev libjpeg-dev libpango1.0-dev libgif-dev build-essential g++
57+ npm install @aws-sdk/client-cloudwatch
3958
40- - name : Run tests against the latest 2 Android versions
59+ - name : Run tests against specified Android versions
4160 id : tests
4261 run : |
4362 id=$(curl -F 'payload=@amazon-chime-sdk-app.apk' -F name=amazon-chime-sdk-app.apk -u "${{ secrets.SAUCE_USERNAME }}:${{ secrets.SAUCE_ACCESS_KEY }}" 'https://api.us-west-1.saucelabs.com/v1/storage/upload' |jq '.item.id')
44- npm install
45- npm run build
46- for os in 12 13; do
47- npm run cma -- --app-url "sample.apk" --log-level error --tag "@common" --app-id "${id}" --retry --platform-version $os
48- sleep 10
49- done
50-
51- - name : Send Notification
52- uses : slackapi/slack-github-action@v1.25.0
53- if : failure()
63+ # npm install
64+ # npm run build
65+ # npm run cma -- --app-url "sample.apk" --log-level error --tag "@common" --app-id "${id}" --retry --platform-version ${{ matrix.os_list }}
66+
67+ # - name: Send Notification
68+ # uses: slackapi/slack-github-action@v1.25.0
69+ # if: failure()
70+ # with:
71+ # payload: |
72+ # {
73+ # "Platform": "Android",
74+ # "Link": "${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}",
75+ # "Status": "${{ steps.tests.outcome }}"
76+ # }
77+ - name : Debug OIDC Token
78+ env :
79+ ACTIONS_ID_TOKEN_REQUEST_URL : ${{ secrets.ACTIONS_ID_TOKEN_REQUEST_URL }}
80+ ACTIONS_ID_TOKEN_REQUEST_TOKEN : ${{ secrets.ACTIONS_ID_TOKEN_REQUEST_TOKEN }}
81+ run : |
82+ echo "OIDC Token URL: $ACTIONS_ID_TOKEN_REQUEST_URL"
83+ curl -H "Authorization: Bearer $ACTIONS_ID_TOKEN_REQUEST_TOKEN" "$ACTIONS_ID_TOKEN_REQUEST_URL"
84+ - name : Configure AWS Credentials
85+ uses : aws-actions/configure-aws-credentials@v2
5486 with :
55- payload : |
56- {
57- "Platform": "Android",
58- "Link": "${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}",
59- "Status": "${{ steps.tests.outcome }}"
60- }
87+ role-to-assume : ${{ secrets.ROLE_TO_ASSUME }}
88+ aws-region : us-east-1
89+
90+ - name : Send Metric to CloudWatch
91+ run : |
92+ node -e "
93+ const { CloudWatchClient, PutMetricDataCommand } = require('@aws-sdk/client-cloudwatch');
94+ const client = new CloudWatchClient({ region: 'us-east-1' });
95+
96+ const value = '${{ job.status }}' === 'failure' ? 0 : 1;
97+
98+ const now = new Date();
99+ const command = new PutMetricDataCommand({
100+ Namespace: 'ChimeMobileSDKTests',
101+ MetricData: [{
102+ MetricName: 'MobileSDKDailyTestMetric',
103+ Dimensions: [
104+ { Name: 'Workflow', Value: 'DailyTest' },
105+ { Name: 'Platform', Value: 'Android' }
106+ ],
107+ Value: value,
108+ Timestamp: now.toISOString()
109+ }]
110+ });
111+
112+ client.send(command).then(() => console.log('Daily test result sent to CloudWatch')).catch(err => {
113+ console.error('Failed to send metric. Error: ', err);
114+ process.exit(1);
115+ });
116+ ";
117+
0 commit comments