Commit Graph

84 Commits

Author SHA1 Message Date
Joey Parrish 7c2bfaa978 ci: Fix incremental coverage reports (#5552) 2023-08-29 10:19:35 -07:00
Joey Parrish 8f867cdec9 ci: Fix Chrome tests on Windows in GitHub Actions (#5548)
GitHub started installing "Chrome for Testing" builds on Windows and
Mac. Unfortunately, these builds don't have support for H264 and AAC
codecs, which we need in our tests.

This fixes the issue by explicitly installing an official build of
Chrome on Windows, to overwrite the "Chrome for Testing" build.
2023-08-28 11:15:29 -07:00
Joey Parrish 92edb7b1ef test: Cache Babel output (#5539)
This caches Babel's transpiler output for reuse, and should speed up all
test runs in theory, but the effect is most noticeable on local test
runs.

This uses a fork of karma-babel-preprocessor, which contains
https://github.com/babel/karma-babel-preprocessor/pull/77. If/when that
PR is merged, we can move back to the upstream module.

Local runs will start faster because only modified source files will be
re-processed through Babel when the tests start up.

In the Selenium workflow, Babel output and node_modules will both be
computed by the singular build-shaka job, stored, and then reused by all
the Selenium lab matrix jobs.

On my workstation (3.3 GHz cores, 32GB RAM, spinning platter disk), I
see tests start about ~60 seconds faster. In the lab (2.1-4.7 GHz cores,
64GB RAM, solid-state disk), I see tests start about ~10 seconds faster.
2023-08-28 08:59:02 +02:00
Joey Parrish 081cd9645f ci: Update environment variable name for runner port (#5523)
As I was building packages for shaka-lab services in the shaka-project/shaka-lab repo, it occurred to me that this KARMA_PORT variable was too specific to the shaka-player project.  Instead, the new shaka-lab package for self-hosted runners will have a more generic ALLOCATED_PORT variable.  This updates the CI workflow to use that new name.
2023-08-22 11:20:15 -07:00
Álvaro Velad Galván a23524845a chore: Use Edge Windows for coverage report (#5517) 2023-08-21 13:32:02 -07:00
Joey Parrish a3d5dc54ff ci: Fix Chrome failures on Mac VMs (#5509) 2023-08-19 09:47:53 +02:00
Joey Parrish 6f2f8c2468 test: Drop --lets-encrypt-folder from test.py (#5455)
When we first deployed certificates from letsencrypt, we did not know
about the "live" folder, which contains helpful symlinks to the latest
certificate. Instead, we were copying the entire "archive" folder, which
contains even old certs, then searching that folder for the latest
version. We should be using the "live" folder instead, letting certbot
maintain the symlinks. This means there is no need for
--lets-encrypt-folder in test.py.
2023-08-07 09:11:43 -07:00
Joey Parrish ace3e37241 ci: Refactor and update Shaka lab definitions (#5449)
- In karma.conf.js, give ourselves the ability to merge Selenium configs together without clobbering argument lists, for better deduplication in shaka-lab.yaml.  This is based on https://github.com/shaka-project/karma-local-wd-launcher/pull/50
 - Refactor shaka-lab.yaml to take advantage of this new ability.  This removes a bunch of duplicate command line arguments for various versions of Chrome.
 - Remove a TODO about a bug that Chrome decided they would never fix.
 - Sort the list of devices and platforms, with comments to mark out the sections.
 - Remove IE11, which we are well past supporting or testing.

This should be cherry-picked to all active branches.
2023-07-31 11:02:23 -07:00
Shaka Bot d6d5b155ff chore: Sync common workflows (#5434)
This is an automated sync of common workflows for this organization.
The upstream source is:
https://github.com/shaka-project/shaka-github-tools/commit/208556c5ea86a1329f7d1f36fdcf6ed6abbb907b

Co-authored-by: Shaka Bot <shaka-bot@users.noreply.github.com>
2023-07-24 17:18:11 -07:00
Joey Parrish 4df82540c2 ci: Add one-off workflow for appspot deployment (#5337)
This is a much simplified version of the appspot job from the release
workflow, but with control given to the human caller instead of computed
from release details. It can be used to correct deployment issues.
2023-06-20 19:40:13 -07:00
Joey Parrish c1369de55d ci: main branch only - fix bad release PR (#5334)
This fixes a bad release PR caused by too many commits between main
branach releases. This should not be cherry-picked to any other branch.
2023-06-20 13:12:39 -07:00
Joey Parrish 866ddb0c11 ci: Make version index aware of deployments (#5203)
Due to limits in the number of versions you can have deployed at once on
App Engine, we can no longer keep every version of the Shaka Player Demo
deployed. So the version index needs to be aware of which versions are
deployed, and only link to versions that are still available.

This makes the index generator aware of App Engine deployments.
2023-04-29 08:54:31 -07:00
Joey Parrish 4337dbfb4c ci: Add browser filter to lab workflow (#5064)
This allows us to run the lab tests on a subset of browsers/platforms
for a given PR.
2023-03-07 09:38:25 -08:00
Joey Parrish 25fc81e7a9 ci: Fix workflow to update screenshots (#4993)
The initial commit was untested, but having the workflow in the main
branch allowed me to iterate on the workflow and test it in a branch.

The following changes were made:
- Standardize how workflow inputs are read (using inputs, which works
for all triggers, instead of github.event.inputs, which only works for
some triggers)
 - Improve the description of test_filter in selenium-lab-tests.
- Add missing fields in the workflow_call trigger of
selenium-lab-tests.yaml. (Unfortunately, the two triggers need to have
the inputs defined separately, and with slightly different fields.)
 - Log the chosen ref in selenium-lab-tests, to help debug inputs.
- Fix variable expansion in selenium-lab-tests so that test_filter can
contain spaces.
- Fix ignore_test_status, which did not work at all and broken the
nightly tests last night.
 - Fix dependencies between jobs in update-screenshots.
- Do not set status for the subordinate selenium-lab-tests job if
started from update-screenshots.
- Always upload screenshots from selenium-lab-tests if started from
update-screenshots (normally only uploaded on failure).
 - Set the PR status from upload-screenshots.
 - Fix unpacking of screenshots from artifacts in upload-screenshots.
 - Fix updating of changed screenshots.
 - Fix handling of a lack of screenshot changes.
 - Split up the jobs for easier debugging in upload-screenshots.

Still to do:
 - Fix setting of final PR status
- Use a personal access token so that tests can be triggered from the PR
push
2023-02-23 11:26:40 -08:00
Joey Parrish a8c2491047 ci: Experimental workflow to update screenshots in a PR (#4991)
Untested. A workflow must exist in the main branch before a version of
it from any branch can be triggered.
2023-02-09 15:08:37 -08:00
Joey Parrish ee77d35244 ci: Update the version index nightly (#4990)
The release trigger does not work yet, so compensate with a nightly
schedule.

Closes #4361
2023-02-09 11:45:13 -08:00
Joey Parrish f45631834d fix(WebVTT): Fix horizontal positioning with cue box size (#4949)
When the VTT size setting is used, the horizontal positioning was wrong
in both native and UI display.

The native display is wrong on Chrome and Edge because of a layout bug
in Chrome, where the shadow DOM for the cue box has conflicting
(redundant) styles. For example, these VTT settings:

`line: 85% position: 50% size: 63%`

result in these styles in the shadow DOM:

`top: 85%; left: 18.5%; transform: translate(-18.5%, -85%)`.

The `translate` style is what breaks the positioning. Unfortunately,
there is no way to fix that in JavaScript.

The UI display, however, was buggy for different reasons and is fixable.
The styles `left: 0; top: 0;` were applied by default, and then `top:
85%;` and `width: 63%;` were set based on the cue settings. The default
of `left: 0` was what broke the positioning. Removing this leaves `left`
set implicitly to `auto`, which is correct.

No other test cases were broken (or fixed) by this change.

This also adds a filter parameter to the lab workflow to run a subset of
tests for quicker results. This is useful for updating screenshots.

Closes b/259121343
2023-01-30 16:01:25 -08:00
Joey Parrish eeb647cec5 ci: Upload screenshots on test failures (#4917)
This will upload screenshots when the Selenium lab tests fail. This can
be used to get screenshot changes either for examination or for updating
the test expectations.
2023-01-19 13:49:01 -08:00
Joey Parrish da0b818321 ci: Force update to Edge 108 (#4826)
Since Edge 107 on Linux has an outdated CDM causing test failures, we
have to force update to Edge 108 in GitHub Actions.

Closes #4825
2022-12-13 06:56:49 +01:00
Joey Parrish 28b73b921d fix(hls): Fix type error in lazy-loading (#4687)
There was a potential type error in an edge case in lib/player.js. It
would have been caught by the latest compiler, so this upgrades the
compiler and fixes another type error in one other place, as well.
2022-11-11 07:07:58 -08:00
Joey Parrish 7772099029 build: Fix Docker-based builds (#4633)
This removes the overly-complex docker-compose system and rewrites the
Dockerfile. It also changes the docker commands to those that specify a
user ID, so that build outputs are written as the current user.

Closes #4387 (failed docker build not detected in CI)
Issue #4619 (failed to build w/ docker)
2022-10-28 15:43:16 -07:00
Shaka Bot ebc81d0f3a chore: Sync common workflows (#4628)
This is an automated sync of common workflows for this organization.
The upstream source is:

https://github.com/shaka-project/shaka-github-tools/commit/8bfe75f0d28b0b824e37b192623abb528bd275b0

Co-authored-by: Shaka Bot <shaka-bot@users.noreply.github.com>
2022-10-27 11:53:09 -07:00
Joey Parrish 0601e5d9c0 ci: Update actions/checkout version (#4603)
v2 uses a deprecated node version (12), and v3 uses a current version
(16).
2022-10-26 07:17:44 +02:00
Joey Parrish 3c2d3c8ffc ci: Fix incremental coverage reports (#4602)
Broken in 062aa07e71 (#4588)
2022-10-19 16:02:41 -07:00
Joey Parrish 0209ba701c ci: Re-run PR tests when leaving draft mode (#4594)
Because our release PRs are created with the default GitHub token, they
do not trigger test runs. This is a feature of GitHub that prevents
recursive loops of workflows.

This change makes it so that marking a PR "ready for review" will
trigger the tests to run again. This gives us an easy way to trigger
test runs on a release PR, by marking it a draft, then marking it
"ready" again.
2022-10-18 16:53:49 -07:00
Joey Parrish 062aa07e71 ci: Update workflow syntax (#4588)
GitHub is deprecating the set-output syntax and moving to writing
outputs to a file. This updates our workflows to match.

See
https://github.blog/changelog/2022-10-11-github-actions-deprecating-save-state-and-set-output-commands/
2022-10-17 19:27:42 -07:00
Álvaro Velad Galván 4914201f86 feat: Allow customization of HLS Live behavior (#4578) 2022-10-16 00:32:10 -07:00
Joey Parrish df3e131392 ci: Fix reporting status from lab tests to PRs (#4541)
We were misreading the computed ref for tests (missing "outputs" in the
variable name), which led us to check out and test main instead of the
PR's head. This also led us to set status on the latest commit in main,
instead of on the PR.

Once the variable was read correctly and the correct ref was checked
out, I found that the ref argument to set-commit-status was actually not
usable, since "git rev-parse refs/pull/4528/head" would fail. But now
that we are checking out the correct commit, the ref argument turns out
to be unnecessary. Whatever we checked out is what we should report
status on.
2022-10-04 12:00:39 -07:00
Joey Parrish 945ad90fa8 ci: Revert "Fix reporting status from lab tests to PRs" (#4540)
Reverts shaka-project/shaka-player#4539

This doesn't actually fix the problem. I was too hasty in putting it up
for review.
2022-10-03 13:36:16 -07:00
Joey Parrish b7e9d4f8bd ci: Fix reporting status from lab tests to PRs (#4539)
The status reports were targetting main instead of the PR's HEAD.
2022-10-03 22:03:53 +02:00
Joey Parrish c12912d8bc ci: Fix missing coverage data from integration tests (#4534)
Player integration tests use the compiled bundle by default. This
prevents us from getting coverage data in these tests, since the
instrumentation was added to the uncompiled library only.

By collecting coverage data in uncompiled mode, we can fix this.
2022-09-29 16:00:08 -07:00
Joey Parrish 80e6124aa0 ci: Test on Safari 16 and 15 (#4531)
Since Safari 16 became the default on macos-11 images in GitHub, we are
updating our homedir installation of Safari 14 to Safari 15 instead.
This also renames that entry in the matrix from Safari-14 to Safari-old,
in recognition of the fact that we will probably have to continue
updating this.
2022-09-29 14:45:00 -07:00
Joey Parrish 9b039f33cb ci: Upload screenshot assets on failure (#4530)
This should make it possible (if not easy) to download screenshots and
diagnose layout test failures locally.
2022-09-29 14:38:48 -07:00
Joey Parrish c5a758846a ci: Add missing token for deflake workflow (#4480) 2022-09-12 11:05:24 -07:00
Joey Parrish 4d48930621 ci: Auto-deflake nightly selenium tests (#4472)
This workflow will trigger after the nightly Selenium tests.  If those tests failed, this "deflake" workflow will automatically re-run the failed jobs up to 3 times (total, including the original scheduled run).

This should help cut down on noise and help highlight actual platform-specific failures.  The flakiness of our tests and infrastructure will be tracked separately and addressed at a somewhat lower priority than test greenness.
2022-09-12 09:19:05 -07:00
Joey Parrish d8c09647f4 test: Split Selenium grid tests into multiple jobs (#4454)
This requires multiple self-hosted runners to be set up, but will
allow us to more easily read results and to re-run individual failed
jobs per browser.

This change also includes several optimizations that were motivated by
the split:
 - stop installing the GitHub CLI (now installed on newer self-hosted
   images, saves ~20 seconds)
 - cache node_modules (saves about ~1 minute if package-lock.json
   hasn't changed)
 - pre-build Shaka once in a GitHub VM instead of in parallel on
   multiple runner containers hosted on the same machine (saves ~45
   minutes w/ 12 runners in parallel)
2022-08-30 13:25:36 -07:00
Joey Parrish 324dcb8082 test: Fix incremental coverage stats (#4415)
The initial implementation had a bug where a class declaration
"statement" would be seen as covering all the lines of all the methods
in that class.  This change fixes that case, so that the lines of
methods and inner statements are not "part" of their outer containers.
2022-08-16 15:18:39 -07:00
Joey Parrish 460fadd12f test: Generate incremental code coverage data (#4406)
This generates a more detailed JSON coverage file containing maps of
exactly what statements were executed by tests.  This also extracts
the data from this file and updates the PR with a comment showing how
much of the changed code is covered by tests.
2022-08-16 11:19:40 -07:00
Joey Parrish 94b14dcc85 test: Upload coverage report for PR and nightly tests (#4390)
This will attach a code coverage report to PRs and to nightly tests,
both specifically from Chrome on Linux.  Reports will be attached to  
workflow runs whether or not the tests pass.
2022-08-12 10:56:16 -07:00
Joey Parrish bca2c9e3f1 ci: Fix Safari 14 tests (#4373)
The available package versions of Safari have changed.  This updates
to what is currently available.  This also updates to expect the
current format of the packages (pkg inside zip).
2022-07-25 11:15:12 -07:00
Joey Parrish 84fe995471 ci: Fix player version update on release (#4239)
The v3.2.7 and v3.3.5 releases went out without updating the version
number in lib/player.js.  This fixes the workflow to match the
release-please branch name, and changes the workflow to fail if the
branch name changes again in the future.
2022-05-17 17:52:33 -07:00
Joey Parrish c2f1fb52d4 ci: Drop release-please config (#4180)
This is no longer needed after the first release from the main branch
(v4.0.0).
2022-05-02 20:01:19 -07:00
Joey Parrish 4efe853042 ci: Do not create a -main tag if the release is from main (#4181)
Having both v4.0.0 and v4.0.0-main tags refer to the same commit
confuses some of our build scripts because git describe can produce
either tag.  So we should only create -main tags when the release is
from a branch.
2022-05-02 19:59:54 -07:00
Joey Parrish 0d95aeab0b test: Run DRM tests by default (#4174)
This changes the default behavior of the test runner.  Now tests that
require access to license servers will run by default.  To disable DRM
tests (for example, if there is no connection to the outside
internet), use --no-drm.
2022-04-29 16:11:39 -07:00
Joey Parrish 71b6de8bbd ci: Fix -main tags on release (#4154)
These tags should be attached to the head of the main branch, so that
is what we should check out during the tagging job.

In v3.1.7, v3.2.5, and v3.3.3, we accidentally tagged the heads of the
release branches.  The `-main` tags for those releases had to be
corrected manually.
2022-04-25 15:50:58 -07:00
Joey Parrish 0304f92d3c ci: Fix appspot subdomain computation (#4153)
We should replace all dots with dashes, not just the first one.
2022-04-25 13:29:03 -07:00
Joey Parrish a540fec627 ci: Fix typo in demo index workflow (#4130)
Closes #4074
2022-04-15 08:40:56 -07:00
Joey Parrish 783db97778 ci: Cancel old test runs when a PR is updated (#4127)
If another instance of the build-and-test workflow is started for the
same PR, cancel the old one.  If a PR is updated and a new test run is
started, the old test run will be cancelled automatically to conserve
resources.
2022-04-14 10:08:10 -07:00
Joey Parrish b11bec0e2d ci: Fix generation of demo index by fetching all history (#4126)
The demo index generation is now based on the git tags.  So when
checking out the repo to generate the index, the entire history is
needed.

Closes #4074
2022-04-14 10:01:18 -07:00
Joey Parrish d8b3341720 test: Run tests on a custom Selenium grid (#4117)
Includes a YAML config file for our lab, and documentation on how to
create a custom config for another Selenium grid.

A workflow will run tests nightly in the Shaka lab, using a
self-hosted runner with access to our private grid.

The workflow can also be triggered manually by maintainers to test a
PR in the lab.  This will report status back to the PR.
2022-04-12 11:32:59 -07:00