shaka-player 4.6.14 → 4.6.16

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (126) hide show
  1. package/.github/workflows/appspot.yaml +4 -4
  2. package/.github/workflows/build-and-test.yaml +6 -6
  3. package/.github/workflows/custom-actions/set-commit-status/action.yaml +29 -7
  4. package/.github/workflows/demo-version-index.yaml +3 -3
  5. package/.github/workflows/nightly-demo.yaml +4 -4
  6. package/.github/workflows/release-please.yaml +24 -23
  7. package/.github/workflows/report-incremental-coverage.yaml +1 -1
  8. package/.github/workflows/selenium-lab-tests.yaml +30 -18
  9. package/.github/workflows/shaka-bot-commands/lib.sh +37 -12
  10. package/.github/workflows/shaka-bot-commands/main.sh +4 -2
  11. package/.github/workflows/sync-labels.yaml +1 -1
  12. package/.github/workflows/talk-to-shaka-bot.yaml +2 -1
  13. package/.github/workflows/update-issues.yaml +1 -1
  14. package/.github/workflows/update-screenshots.yaml +25 -38
  15. package/CHANGELOG.md +47 -0
  16. package/README.md +2 -4
  17. package/demo/demo.less +1 -5
  18. package/dist/controls.css +1 -1
  19. package/dist/controls.css.map +1 -1
  20. package/dist/demo.css +1 -1
  21. package/dist/demo.css.map +1 -1
  22. package/dist/deps.js +4 -5
  23. package/dist/locales.js +30 -30
  24. package/dist/shaka-player.compiled.d.ts +12 -10
  25. package/dist/shaka-player.compiled.debug.d.ts +12 -10
  26. package/dist/shaka-player.compiled.debug.externs.js +78 -64
  27. package/dist/shaka-player.compiled.debug.js +173 -165
  28. package/dist/shaka-player.compiled.debug.map +4 -4
  29. package/dist/shaka-player.compiled.externs.js +78 -64
  30. package/dist/shaka-player.compiled.js +1100 -1094
  31. package/dist/shaka-player.compiled.map +4 -4
  32. package/dist/shaka-player.ui.d.ts +12 -10
  33. package/dist/shaka-player.ui.debug.d.ts +12 -10
  34. package/dist/shaka-player.ui.debug.externs.js +78 -64
  35. package/dist/shaka-player.ui.debug.js +184 -175
  36. package/dist/shaka-player.ui.debug.map +4 -4
  37. package/dist/shaka-player.ui.externs.js +78 -64
  38. package/dist/shaka-player.ui.js +1218 -1212
  39. package/dist/shaka-player.ui.map +4 -4
  40. package/docs/tutorials/faq.md +12 -0
  41. package/externs/shaka/player.js +32 -19
  42. package/karma.conf.js +4 -0
  43. package/lib/abr/simple_abr_manager.js +21 -26
  44. package/lib/ads/ad_manager.js +1 -1
  45. package/lib/cast/cast_proxy.js +1 -3
  46. package/lib/cast/cast_sender.js +8 -11
  47. package/lib/cea/cea608_memory.js +1 -1
  48. package/lib/cea/ts_cea_parser.js +10 -1
  49. package/lib/dash/dash_parser.js +3 -0
  50. package/lib/deprecate/deprecate.js +1 -1
  51. package/lib/hls/hls_parser.js +40 -19
  52. package/lib/media/drm_engine.js +6 -3
  53. package/lib/media/manifest_parser.js +3 -2
  54. package/lib/media/media_source_engine.js +19 -1
  55. package/lib/media/presentation_timeline.js +23 -0
  56. package/lib/media/segment_utils.js +10 -1
  57. package/lib/player.js +17 -4
  58. package/lib/polyfill/media_capabilities.js +20 -1
  59. package/lib/polyfill/mediasource.js +35 -43
  60. package/lib/text/vtt_text_parser.js +53 -52
  61. package/lib/transmuxer/h264.js +3 -3
  62. package/lib/transmuxer/h265.js +3 -3
  63. package/lib/transmuxer/ts_transmuxer.js +42 -3
  64. package/lib/util/error.js +1 -0
  65. package/lib/util/manifest_parser_utils.js +1 -0
  66. package/lib/util/mp4_parser.js +57 -0
  67. package/lib/util/platform.js +4 -0
  68. package/lib/util/ts_parser.js +101 -12
  69. package/package.json +2 -2
  70. package/test/cast/cast_proxy_unit.js +0 -46
  71. package/test/cast/cast_sender_unit.js +26 -26
  72. package/test/cea/cea608_memory_unit.js +3 -2
  73. package/test/hls/hls_live_unit.js +52 -0
  74. package/test/hls/hls_parser_integration.js +86 -0
  75. package/test/hls/hls_parser_unit.js +28 -0
  76. package/test/media/drm_engine_unit.js +16 -0
  77. package/test/media/media_source_engine_integration.js +1 -1
  78. package/test/player_integration.js +22 -1
  79. package/test/player_load_graph_integration.js +13 -10
  80. package/test/player_src_equals_integration.js +2 -2
  81. package/test/player_unit.js +22 -4
  82. package/test/test/assets/6339/a.mp4 +0 -0
  83. package/test/test/assets/6339/master.mpd +37 -0
  84. package/test/test/assets/6339/v.mp4 +0 -0
  85. package/test/test/assets/hls-text-offset/index.m3u8 +8 -0
  86. package/test/test/assets/hls-text-offset/playlist-video.m3u8 +22 -0
  87. package/test/test/assets/hls-text-offset/playlist-vtt.m3u8 +22 -0
  88. package/test/test/assets/hls-text-offset/video-0000000069.ts +0 -0
  89. package/test/test/assets/hls-text-offset/video-0000000070.ts +0 -0
  90. package/test/test/assets/hls-text-offset/video-0000000071.ts +0 -0
  91. package/test/test/assets/hls-text-offset/video-0000000072.ts +0 -0
  92. package/test/test/assets/hls-text-offset/video-0000000073.ts +0 -0
  93. package/test/test/assets/hls-text-offset/video-069.ts +0 -0
  94. package/test/test/assets/hls-text-offset/video-070.ts +0 -0
  95. package/test/test/assets/hls-text-offset/video-071.ts +0 -0
  96. package/test/test/assets/hls-text-offset/video-072.ts +0 -0
  97. package/test/test/assets/hls-text-offset/video-073.ts +0 -0
  98. package/test/test/assets/hls-text-offset/vtt-069.vtt +5 -0
  99. package/test/test/assets/hls-text-offset/vtt-070.vtt +5 -0
  100. package/test/test/assets/hls-text-offset/vtt-071.vtt +2 -0
  101. package/test/test/assets/hls-text-offset/vtt-072.vtt +2 -0
  102. package/test/test/assets/hls-text-offset/vtt-073.vtt +5 -0
  103. package/test/test/assets/hls-ts-h265/index.m3u8 +2 -0
  104. package/test/test/assets/hls-ts-muxed-aac-h265/media.m3u8 +5 -1
  105. package/test/test/assets/hls-ts-raw-aac/fileSequence0.ts +0 -0
  106. package/test/test/assets/hls-ts-raw-aac/fileSequence1.ts +0 -0
  107. package/test/test/assets/hls-ts-raw-aac/fileSequence2.ts +0 -0
  108. package/test/test/assets/hls-ts-raw-aac/fileSequence3.ts +0 -0
  109. package/test/test/assets/hls-ts-raw-aac/index.m3u8 +4 -0
  110. package/test/test/assets/hls-ts-raw-aac/playlist.m3u8 +14 -0
  111. package/test/test/assets/hls-ts-rollover/360p30_h264_48k_160_aac_ts-0000000024.ts +0 -0
  112. package/test/test/assets/hls-ts-rollover/360p30_h264_48k_160_aac_ts-0000000025.ts +0 -0
  113. package/test/test/assets/hls-ts-rollover/360p30_h264_48k_160_aac_ts-0000000026.ts +0 -0
  114. package/test/test/assets/hls-ts-rollover/360p30_h264_48k_160_aac_ts-0000000027.ts +0 -0
  115. package/test/test/assets/hls-ts-rollover/360p30_h264_48k_160_aac_ts-0000000028.ts +0 -0
  116. package/test/test/assets/hls-ts-rollover/360p30_h264_48k_160_aac_ts-0000000029.ts +0 -0
  117. package/test/test/assets/hls-ts-rollover/360p30_h264_48k_160_aac_ts-0000000030.ts +0 -0
  118. package/test/test/assets/hls-ts-rollover/360p30_h264_48k_160_aac_ts-0000000031.ts +0 -0
  119. package/test/test/assets/hls-ts-rollover/360p30_h264_48k_160_aac_ts-0000000032.ts +0 -0
  120. package/test/test/assets/hls-ts-rollover/360p30_h264_48k_160_aac_ts-0000000033.ts +0 -0
  121. package/test/test/assets/hls-ts-rollover/playlist.m3u8 +39 -0
  122. package/test/test/externs/jasmine.js +2 -1
  123. package/test/text/vtt_text_parser_unit.js +43 -59
  124. package/test/transmuxer/transmuxer_integration.js +60 -53
  125. package/ui/less/containers.less +1 -0
  126. package/lib/polyfill/storage_estimate.js +0 -57
@@ -15,24 +15,24 @@ jobs:
15
15
  appspot:
16
16
  runs-on: ubuntu-latest
17
17
  steps:
18
- - uses: actions/checkout@v3
18
+ - uses: actions/checkout@v4
19
19
  with:
20
20
  ref: ${{ inputs.ref }}
21
21
  fetch-depth: 0
22
22
  persist-credentials: false
23
23
 
24
- - uses: actions/setup-node@v1
24
+ - uses: actions/setup-node@v4
25
25
  with:
26
26
  node-version: 16
27
27
  registry-url: 'https://registry.npmjs.org'
28
28
 
29
29
  - uses: ./.github/workflows/custom-actions/prep-for-appspot
30
30
 
31
- - uses: google-github-actions/auth@v0
31
+ - uses: google-github-actions/auth@v2
32
32
  with:
33
33
  credentials_json: '${{ secrets.APPENGINE_DEPLOY_KEY }}'
34
34
 
35
- - uses: google-github-actions/deploy-appengine@v0
35
+ - uses: google-github-actions/deploy-appengine@v2
36
36
  with:
37
37
  project_id: shaka-player-demo
38
38
  version: ${{ inputs.subdomain }}
@@ -25,7 +25,7 @@ jobs:
25
25
  runs-on: ubuntu-latest
26
26
  steps:
27
27
  - name: Checkout code
28
- uses: actions/checkout@v3
28
+ uses: actions/checkout@v4
29
29
  with:
30
30
  ref: ${{ inputs.ref || github.ref }}
31
31
 
@@ -89,7 +89,7 @@ jobs:
89
89
  run: sudo apt -y update && sudo apt -y install ffmpeg
90
90
 
91
91
  - name: Checkout code
92
- uses: actions/checkout@v3
92
+ uses: actions/checkout@v4
93
93
  with:
94
94
  ref: ${{ inputs.ref || github.ref }}
95
95
 
@@ -128,7 +128,7 @@ jobs:
128
128
 
129
129
  # Some CI images (self-hosted or otherwise) don't have the minimum Java
130
130
  # version necessary for the compiler (Java 11).
131
- - uses: actions/setup-java@v3
131
+ - uses: actions/setup-java@v4
132
132
  with:
133
133
  distribution: zulu
134
134
  java-version: 11
@@ -178,7 +178,7 @@ jobs:
178
178
  fi
179
179
 
180
180
  - name: Upload coverage reports
181
- uses: actions/upload-artifact@v3
181
+ uses: actions/upload-artifact@v4
182
182
  if: ${{ always() && steps.coverage.outputs.coverage_found }}
183
183
  with:
184
184
  name: coverage
@@ -194,7 +194,7 @@ jobs:
194
194
 
195
195
  # Upload new screenshots and diffs on failure; ignore if missing
196
196
  - name: Upload screenshots
197
- uses: actions/upload-artifact@v3
197
+ uses: actions/upload-artifact@v4
198
198
  if: ${{ failure() }}
199
199
  with:
200
200
  name: screenshots-${{ matrix.browser }}
@@ -212,7 +212,7 @@ jobs:
212
212
  runs-on: ubuntu-latest
213
213
  steps:
214
214
  - name: Checkout code
215
- uses: actions/checkout@v3
215
+ uses: actions/checkout@v4
216
216
  with:
217
217
  ref: ${{ inputs.ref || github.ref }}
218
218
 
@@ -14,6 +14,9 @@ inputs:
14
14
  token:
15
15
  description: A GitHub access token.
16
16
  required: true
17
+ job_name:
18
+ description: A job name, so that the status' target URL can point to a specific job.
19
+ required: false
17
20
 
18
21
  runs:
19
22
  using: composite
@@ -21,17 +24,36 @@ runs:
21
24
  - name: Report Commit Status
22
25
  shell: bash
23
26
  run: |
24
- # This is the URL to view this workflow run on GitHub. It will be
25
- # attached to the commit status, so that when someone clicks "details"
26
- # next to the status on the PR, it will link to this run where they can
27
- # see the logs.
28
- RUN_URL="https://github.com/${{github.repository}}/actions/runs/${{github.run_id}}"
27
+ export GITHUB_TOKEN="${{ inputs.token }}"
28
+
29
+ # Here we compute a "target URL". It will be attached to the commit
30
+ # status, so that when someone clicks "details" next to the status on
31
+ # the PR, it will link to the appropriate logs.
32
+ if [[ "${{ inputs.job_name }}" != "" ]]; then
33
+ # There are three identifiers for the job:
34
+ # - The job's key in YAML, which is "github.job"
35
+ # - The job's name, which is not provided by any runner environment
36
+ # - The job's numerical ID, which is not provided either
37
+ # To link to this specific job in the status, we need the numerical
38
+ # job ID. The GH API provides a list of jobs, which contain
39
+ # numerical IDs and names, but not keys. So the caller of this
40
+ # action must provide the string name, and then we look up the
41
+ # numerical ID in the API. "github.job" is useless here.
42
+ job_id=$(
43
+ gh api /repos/${{github.repository}}/actions/runs/${{github.run_id}}/jobs \
44
+ | jq '.jobs | map(select(.name=="${{ inputs.job_name }}")) | .[].id'
45
+ )
46
+ TARGET_URL="https://github.com/${{github.repository}}/actions/runs/${{github.run_id}}/job/$job_id"
47
+ else
48
+ # Generic link to the run, without any specific job.
49
+ TARGET_URL="https://github.com/${{github.repository}}/actions/runs/${{github.run_id}}"
50
+ fi
51
+
29
52
  SHA1=$(git rev-parse HEAD)
30
53
 
31
- GITHUB_TOKEN=${{ inputs.token }} \
32
54
  gh api \
33
55
  -X POST \
34
56
  -F "context=${{ inputs.context }}" \
35
57
  -F "state=${{ inputs.state }}" \
36
- -F "target_url=$RUN_URL" \
58
+ -F "target_url=$TARGET_URL" \
37
59
  "repos/${{ github.repository }}/statuses/$SHA1"
@@ -22,19 +22,19 @@ jobs:
22
22
  appspot:
23
23
  runs-on: ubuntu-latest
24
24
  steps:
25
- - uses: actions/checkout@v3
25
+ - uses: actions/checkout@v4
26
26
  with:
27
27
  # We need a list of all tags for this, so fetch the entire history.
28
28
  fetch-depth: 0
29
29
 
30
- - uses: google-github-actions/auth@v0
30
+ - uses: google-github-actions/auth@v2
31
31
  with:
32
32
  credentials_json: '${{ secrets.APPENGINE_DEPLOY_KEY }}'
33
33
 
34
34
  - name: Generate static content
35
35
  run: python3 app-engine/demo-version-index/generate.py
36
36
 
37
- - uses: google-github-actions/deploy-appengine@v0
37
+ - uses: google-github-actions/deploy-appengine@v2
38
38
  with:
39
39
  project_id: shaka-player-demo
40
40
  version: index
@@ -11,12 +11,12 @@ jobs:
11
11
  appspot:
12
12
  runs-on: ubuntu-latest
13
13
  steps:
14
- - uses: actions/checkout@v3
14
+ - uses: actions/checkout@v4
15
15
  with:
16
16
  fetch-depth: 0
17
17
  persist-credentials: false
18
18
 
19
- - uses: actions/setup-node@v1
19
+ - uses: actions/setup-node@v4
20
20
  with:
21
21
  node-version: 16
22
22
  registry-url: 'https://registry.npmjs.org'
@@ -31,11 +31,11 @@ jobs:
31
31
 
32
32
  - uses: ./.github/workflows/custom-actions/prep-for-appspot
33
33
 
34
- - uses: google-github-actions/auth@v0
34
+ - uses: google-github-actions/auth@v2
35
35
  with:
36
36
  credentials_json: '${{ secrets.APPENGINE_DEPLOY_KEY }}'
37
37
 
38
- - uses: google-github-actions/deploy-appengine@v0
38
+ - uses: google-github-actions/deploy-appengine@v2
39
39
  with:
40
40
  project_id: shaka-player-demo
41
41
  version: nightly
@@ -12,19 +12,19 @@ jobs:
12
12
  outputs:
13
13
  release_created: ${{ steps.release.outputs.release_created }}
14
14
  tag_name: ${{ steps.release.outputs.tag_name }}
15
+ patch: ${{ steps.release.outputs.patch }}
15
16
  steps:
16
17
  # Create/update release PR
17
- - uses: google-github-actions/release-please-action@v3
18
+ - uses: google-github-actions/release-please-action@v4
18
19
  id: release
19
20
  with:
20
- # Required input to specify the release type (node package).
21
- release-type: node
22
21
  # Make sure we create the PR against the correct branch.
23
- default-branch: ${{ github.ref_name }}
22
+ target-branch: ${{ github.ref_name }}
24
23
  # Use a special shaka-bot access token for releases.
25
24
  token: ${{ secrets.RELEASE_PLEASE_TOKEN }}
26
- # Update these additional files containing version numbers.
27
- extra-files: lib/player.js
25
+ # See also settings in these files:
26
+ manifest-file: .release-please-manifest.json
27
+ config-file: .release-please-config.json
28
28
 
29
29
  # The jobs below are all conditional on a release having been created by
30
30
  # someone merging the release PR. They all run in parallel.
@@ -32,9 +32,9 @@ jobs:
32
32
  tag-main:
33
33
  runs-on: ubuntu-latest
34
34
  needs: release
35
- if: needs.release.outputs.release_created && endsWith(needs.release.outputs.tag_name, '.0') == false
35
+ if: needs.release.outputs.release_created && needs.release.outputs.patch == '0'
36
36
  steps:
37
- - uses: actions/checkout@v3
37
+ - uses: actions/checkout@v4
38
38
  with:
39
39
  # Check out the origin repo, and do it at main, not the PR branch.
40
40
  ref: main
@@ -55,12 +55,12 @@ jobs:
55
55
  needs: release
56
56
  if: needs.release.outputs.release_created
57
57
  steps:
58
- - uses: actions/checkout@v3
58
+ - uses: actions/checkout@v4
59
59
  with:
60
60
  fetch-depth: 0
61
61
  persist-credentials: false
62
62
 
63
- - uses: actions/setup-node@v1
63
+ - uses: actions/setup-node@v4
64
64
  with:
65
65
  node-version: 16
66
66
  registry-url: 'https://registry.npmjs.org'
@@ -113,25 +113,26 @@ jobs:
113
113
  fi
114
114
 
115
115
  - run: npm pack
116
- - uses: svenstaro/upload-release-action@483c1e56f95e88835747b1c7c60581215016cbf2
117
- with:
118
- repo_token: ${{ secrets.GITHUB_TOKEN }}
119
- tag: ${{ needs.release.outputs.tag_name }}
120
- file: shaka-player-*.tgz
121
- file_glob: true
122
- overwrite: true
116
+
117
+ - name: Attach to release
118
+ env:
119
+ GITHUB_TOKEN: ${{ secrets.RELEASE_PLEASE_TOKEN }}
120
+ run: |
121
+ gh release upload \
122
+ ${{ needs.release.outputs.tag_name }} shaka-player-*.tgz \
123
+ --clobber
123
124
 
124
125
  appspot:
125
126
  runs-on: ubuntu-latest
126
127
  needs: release
127
128
  if: needs.release.outputs.release_created
128
129
  steps:
129
- - uses: actions/checkout@v3
130
+ - uses: actions/checkout@v4
130
131
  with:
131
132
  fetch-depth: 0
132
133
  persist-credentials: false
133
134
 
134
- - uses: actions/setup-node@v1
135
+ - uses: actions/setup-node@v4
135
136
  with:
136
137
  node-version: 16
137
138
  registry-url: 'https://registry.npmjs.org'
@@ -165,11 +166,11 @@ jobs:
165
166
 
166
167
  - uses: ./.github/workflows/custom-actions/prep-for-appspot
167
168
 
168
- - uses: google-github-actions/auth@v0
169
+ - uses: google-github-actions/auth@v2
169
170
  with:
170
171
  credentials_json: '${{ secrets.APPENGINE_DEPLOY_KEY }}'
171
172
 
172
- - uses: google-github-actions/deploy-appengine@v0
173
+ - uses: google-github-actions/deploy-appengine@v2
173
174
  with:
174
175
  project_id: shaka-player-demo
175
176
  version: ${{ env.APPSPOT_SUBDOMAIN }}
@@ -178,9 +179,9 @@ jobs:
178
179
  auto-branch:
179
180
  runs-on: ubuntu-latest
180
181
  needs: release
181
- if: needs.release.outputs.release_created && endsWith(needs.release.outputs.tag_name, '.0')
182
+ if: needs.release.outputs.release_created && needs.release.outputs.patch == '0'
182
183
  steps:
183
- - uses: actions/checkout@v3
184
+ - uses: actions/checkout@v4
184
185
  with:
185
186
  fetch-depth: 0
186
187
  # Use a special shaka-bot access token for releases.
@@ -15,7 +15,7 @@ jobs:
15
15
 
16
16
  steps:
17
17
  - name: Checkout code
18
- uses: actions/checkout@v3
18
+ uses: actions/checkout@v4
19
19
 
20
20
  - name: Compute incremental code coverage
21
21
  id: compute
@@ -31,9 +31,17 @@ on:
31
31
  required: false
32
32
  type: string
33
33
  ignore_test_status:
34
- description: "If true, ignore test success or failure, never set the commit status, and always upload screenshots."
34
+ description: "If true, ignore test success or failure, and always upload screenshots."
35
35
  required: false
36
36
  type: boolean
37
+ skip_commit_status:
38
+ description: "If true, skip the commit status."
39
+ required: false
40
+ type: boolean
41
+ job_name_prefix:
42
+ description: "A prefix added to the job name when setting commit status, needed to correctly link to each job. Use when skip_commit_status is false, and set to the name of the parent job, plus space-slash-space."
43
+ required: false
44
+ type: string
37
45
  schedule:
38
46
  # Runs every night at 2am PST / 10am UTC, testing against the main branch.
39
47
  - cron: '0 10 * * *'
@@ -71,7 +79,7 @@ jobs:
71
79
  INCLUDE: ${{ steps.configure.outputs.INCLUDE }}
72
80
 
73
81
  steps:
74
- - uses: actions/checkout@v3
82
+ - uses: actions/checkout@v4
75
83
  with:
76
84
  ref: ${{ needs.compute-ref.outputs.REF }}
77
85
 
@@ -133,15 +141,16 @@ jobs:
133
141
  needs: compute-ref
134
142
  runs-on: ubuntu-latest
135
143
  steps:
136
- - uses: actions/checkout@v3
144
+ - uses: actions/checkout@v4
137
145
  with:
138
146
  ref: ${{ needs.compute-ref.outputs.REF }}
139
147
 
140
148
  - name: Set commit status to pending
141
- if: ${{ inputs.ignore_test_status == false }}
149
+ if: ${{ inputs.skip_test_status == false }}
142
150
  uses: ./.github/workflows/custom-actions/set-commit-status
143
151
  with:
144
152
  context: Selenium / Build
153
+ job_name: "${{ inputs.job_name_prefix }}Pre-build Player"
145
154
  state: pending
146
155
  token: ${{ secrets.GITHUB_TOKEN }}
147
156
 
@@ -159,21 +168,21 @@ jobs:
159
168
  --filter ThisFilterMatchesNoTests || true
160
169
 
161
170
  - name: Cache dependencies
162
- uses: actions/cache@v3
171
+ uses: actions/cache@v4
163
172
  id: npm-cache
164
173
  with:
165
174
  path: node_modules/
166
175
  key: node-${{ hashFiles('package-lock.json') }}
167
176
 
168
177
  - name: Cache Babel output
169
- uses: actions/cache@v3
178
+ uses: actions/cache@v4
170
179
  id: babel-cache
171
180
  with:
172
181
  path: .babel-cache
173
182
  key: babel-${{ hashFiles('*.js', 'demo/**.js', 'lib/**.js', 'ui/**.js', 'test/**.js', 'third_party/**.js') }}
174
183
 
175
184
  - name: Store Player build
176
- uses: actions/upload-artifact@v3
185
+ uses: actions/upload-artifact@v4
177
186
  with:
178
187
  name: shaka-player
179
188
  path: dist/
@@ -182,10 +191,11 @@ jobs:
182
191
  - name: Report final commit status
183
192
  # Will run on success or failure, but not if the workflow is cancelled
184
193
  # or if we were asked to ignore the test status.
185
- if: ${{ (success() || failure()) && inputs.ignore_test_status == false }}
194
+ if: ${{ (success() || failure()) && inputs.skip_commit_status == false }}
186
195
  uses: ./.github/workflows/custom-actions/set-commit-status
187
196
  with:
188
197
  context: Selenium / Build
198
+ job_name: "${{ inputs.job_name_prefix }}Pre-build Player"
189
199
  state: ${{ job.status }}
190
200
  token: ${{ secrets.GITHUB_TOKEN }}
191
201
 
@@ -201,31 +211,32 @@ jobs:
201
211
  name: ${{ matrix.browser }}
202
212
 
203
213
  steps:
204
- - uses: actions/checkout@v3
214
+ - uses: actions/checkout@v4
205
215
  with:
206
216
  ref: ${{ needs.compute-ref.outputs.REF }}
207
217
 
208
218
  - name: Set commit status to pending
209
- if: ${{ inputs.ignore_test_status == false }}
219
+ if: ${{ inputs.skip_commit_status == false }}
210
220
  uses: ./.github/workflows/custom-actions/set-commit-status
211
221
  with:
212
222
  context: Selenium / ${{ matrix.browser }}
223
+ job_name: "${{ inputs.job_name_prefix }}${{ matrix.browser }}"
213
224
  state: pending
214
225
  token: ${{ secrets.GITHUB_TOKEN }}
215
226
 
216
- - uses: actions/setup-node@v3
227
+ - uses: actions/setup-node@v4
217
228
  with:
218
229
  node-version: 16
219
230
  registry-url: 'https://registry.npmjs.org'
220
231
 
221
232
  # The Docker image for this self-hosted runner doesn't contain java.
222
- - uses: actions/setup-java@v3
233
+ - uses: actions/setup-java@v4
223
234
  with:
224
235
  distribution: zulu
225
236
  java-version: 11
226
237
 
227
238
  - name: Cache dependencies
228
- uses: actions/cache@v3
239
+ uses: actions/cache@v4
229
240
  id: npm-cache
230
241
  with:
231
242
  path: node_modules/
@@ -234,7 +245,7 @@ jobs:
234
245
  enableCrossOsArchive: true # Share archives from Linux to Windows
235
246
 
236
247
  - name: Cache Babel output
237
- uses: actions/cache@v3
248
+ uses: actions/cache@v4
238
249
  id: babel-cache
239
250
  with:
240
251
  path: .babel-cache
@@ -249,7 +260,7 @@ jobs:
249
260
  # Instead of building Shaka N times, build it once and fetch the build to
250
261
  # each Selenium runner in the matrix.
251
262
  - name: Fetch Player build
252
- uses: actions/download-artifact@v3
263
+ uses: actions/download-artifact@v4
253
264
  with:
254
265
  name: shaka-player
255
266
  path: dist/
@@ -331,7 +342,7 @@ jobs:
331
342
  fi
332
343
 
333
344
  - name: Upload coverage report (Edge only)
334
- uses: actions/upload-artifact@v3
345
+ uses: actions/upload-artifact@v4
335
346
  # If there's a coverage report, upload it, even if a previous step
336
347
  # failed.
337
348
  if: ${{ always() && steps.coverage.outputs.coverage_report }}
@@ -347,7 +358,7 @@ jobs:
347
358
 
348
359
  # Upload new screenshots and diffs on failure; ignore if missing
349
360
  - name: Upload screenshots
350
- uses: actions/upload-artifact@v3
361
+ uses: actions/upload-artifact@v4
351
362
  if: ${{ failure() || inputs.ignore_test_status }}
352
363
  with:
353
364
  # In this workflow, "browser" is the selenium node name, which can
@@ -362,9 +373,10 @@ jobs:
362
373
  - name: Report final commit status
363
374
  # Will run on success or failure, but not if the workflow is cancelled
364
375
  # or if we were asked to ignore the test status.
365
- if: ${{ (success() || failure()) && inputs.ignore_test_status == false }}
376
+ if: ${{ (success() || failure()) && inputs.skip_commit_status == false }}
366
377
  uses: ./.github/workflows/custom-actions/set-commit-status
367
378
  with:
368
379
  context: Selenium / ${{ matrix.browser }}
380
+ job_name: "${{ inputs.job_name_prefix }}${{ matrix.browser }}"
369
381
  state: ${{ job.status }}
370
382
  token: ${{ secrets.GITHUB_TOKEN }}
@@ -64,20 +64,45 @@ function start_workflow() {
64
64
  gh workflow run "$WORKFLOW" -R "$THIS_REPO" "${GH_ARGS[@]}"
65
65
  }
66
66
 
67
+ # Simple alias for converting a stream of text to lowercase.
68
+ function tolower() {
69
+ tr '[:upper:]' '[:lower:]'
70
+ }
71
+
67
72
  # Outputs to global variables SHAKA_BOT_COMMAND and SHAKA_BOT_ARGUMENTS (array).
68
73
  function parse_command() {
69
- # Tokenize the comment by whitespace.
70
- local TOKENS=( $COMMENT_BODY )
71
-
72
- local INDEX
73
- for (( INDEX=0; INDEX < ${#TOKENS[@]}; INDEX++ )); do
74
- if [[ "${TOKENS[i]}" == "@shaka-bot" ]]; then
75
- SHAKA_BOT_COMMAND="${TOKENS[i+1]}"
76
- # A slice of all tokens starting with index i+2.
77
- SHAKA_BOT_ARGUMENTS=( "${TOKENS[@]:i+2}" )
78
- return 0
79
- fi
80
- done
74
+ echo "Parsing comment. Body: \"$COMMENT_BODY\""
75
+
76
+ # Read each line one at a time. Tokens from one line won't affect another.
77
+ local COMMENT_LINE
78
+ while read COMMENT_LINE; do
79
+ echo "Parsing comment. Line: \"$COMMENT_LINE\""
80
+
81
+ # Tokenize the line by whitespace.
82
+ local TOKENS=( $COMMENT_LINE )
83
+
84
+ local INDEX
85
+ for (( INDEX=0; INDEX < ${#TOKENS[@]}; INDEX++ )); do
86
+ if [[ "${TOKENS[INDEX]}" == "@shaka-bot" ]]; then
87
+ # The next word is the command.
88
+ SHAKA_BOT_COMMAND=$(echo "${TOKENS[INDEX+1]}" | tolower)
89
+
90
+ # Unless it's please, then it's the word after that.
91
+ if [[ "$SHAKA_BOT_COMMAND" == "please" ]]; then
92
+ INDEX=$((INDEX + 1))
93
+ SHAKA_BOT_COMMAND=$(echo "${TOKENS[INDEX+1]}" | tolower)
94
+ fi
95
+
96
+ # A slice of all tokens starting with index INDEX+2.
97
+ SHAKA_BOT_ARGUMENTS=( "${TOKENS[@]:INDEX+2}" )
98
+ return 0
99
+ fi
100
+ done
101
+ done < <(echo "$COMMENT_BODY" | tr -d '\r')
102
+ # The line above pipes COMMENT_BODY, without \r characters, into the loop.
103
+ # It is important to maintain the loop in the main shell, not a subshell, so
104
+ # that variables it writes to (SHAKA_BOT_COMMAND and SHAKA_BOT_ARGUMENTS)
105
+ # affect the caller.
81
106
 
82
107
  return 1
83
108
  }
@@ -42,10 +42,12 @@ if [[ "$SHAKA_BOT_COMMAND" == "" ]]; then
42
42
  exit 0
43
43
  fi
44
44
 
45
- echo "PR $PR_NUMBER, detected command $SHAKA_BOT_COMMAND"
45
+ echo "PR $PR_NUMBER"
46
+ echo "Detected command \"$SHAKA_BOT_COMMAND\""
47
+ echo "Detected arguments \"$SHAKA_BOT_ARGUMENTS\""
46
48
 
47
49
  case "$SHAKA_BOT_COMMAND" in
48
50
  help) . command-help.sh ;;
49
51
  test) . command-test.sh ;;
50
- *) echo "Unknown command!" ;;
52
+ *) echo "Unknown command" ;;
51
53
  esac
@@ -18,7 +18,7 @@ jobs:
18
18
  runs-on: ubuntu-latest
19
19
  steps:
20
20
  - name: Checkout code
21
- uses: actions/checkout@v3
21
+ uses: actions/checkout@v4
22
22
  with:
23
23
  repository: shaka-project/shaka-github-tools
24
24
 
@@ -8,6 +8,7 @@ on:
8
8
 
9
9
  jobs:
10
10
  handle_command:
11
+ name: Handle Command
11
12
  # Only runs on PRs that contain '@shaka-bot' comments, but not comments
12
13
  # made by shaka-bot itself, who will sometimes use its own name.
13
14
  # Note that contains() is not case sensitive.
@@ -22,7 +23,7 @@ jobs:
22
23
  COMMENT_BODY: ${{ github.event.comment.body }}
23
24
  steps:
24
25
  - name: Checkout code
25
- uses: actions/checkout@v3
26
+ uses: actions/checkout@v4
26
27
 
27
28
  - name: Handle command
28
29
  shell: bash
@@ -17,7 +17,7 @@ jobs:
17
17
  runs-on: ubuntu-latest
18
18
  steps:
19
19
  - name: Checkout code
20
- uses: actions/checkout@v3
20
+ uses: actions/checkout@v4
21
21
  with:
22
22
  repository: shaka-project/shaka-github-tools
23
23