Fix coverage link, streamline env vars in CI
Description
TLDR; This PR should fix the link to coverage results in GitHub PRs, but more broadly, does some housekeeping of our deploy and status scripts.
Mismatched environment variables
Between incremental updates and migrating between various services and tools, our build and deploy scripts have become quite sprawling. Some things also fall through the cracks, like the broken test coverage link in the CI checks, but we're also dragging along patterns that are no longer serving us. This PR does not fix everything, but attempts to consolidate and cleanup some of these CI/CD related things.
I noticed when reviewing https://github.com/CesiumGS/cesium/pull/12957 that there are several misconfigured environment variables in the dev workflow as opposed to the deploy workflow where most other build artifacts are uploaded. Mis-matches across the workflows were ultimately resulting in broken links.
- When using the
pull_requesthook, the GitHubref_nameis different than the branch name. This ended up using different versions of "DEPLOYED_URL" leading to a broken link. - A similar issue arises when trying to use the commit SHA for operations like setting statuses. In
pull_requesttriggers, the value ofCOMMIT_SHAwill the merge commit.
Change summary
-
Does not change the production or dedicated sandcastle deployment workflows beyond removing redundant
envproperties. - Cleaned up some (quite old) deploy scripts:
- Moved the
setDeployStatusscript out ofgulpfile.jsas it is unrelated to the build processes—It is now a standalone node script with command line help docs. - Replaced with
setCommitStatus. For flexibility, the command itself is more granular so it can be run per-artifact and per-status update. This allows check updates to run separately in different tasks or workflows as needed. - Removed the
deploySetVersionscript out ofgulpfile.jsin favor of thenpm versioncli command which we use for our release processes. - Since they are generally only the concerns of the maintainers, these script have been removed from
package.jsonand the corresponding build guide.
- Moved the
- Moved the coverage job to it's own workflow, having it only run on pull requests triggers. This simplifies the job a lot and, to my knowledge, the check itself isn't super helpful until a PR is opened.
- Created
.envfiles in which can configure common environment variables as described in the updated docs ofContinuousIntegration/README.md- This adds a dependency on
dotenvxas it allows us to variable expansion and simple command substitution. - Defines values accounting for variations in environments:
- In CI, the trigger can be either
pushorpull_request. Sincepull_requestdoes not run in the context of the branch itself, we need to account for the available GitHub context to grab branch names and commit SHA's. - Locally, fall back to git commands to allow for development testing.
- In CI, the trigger can be either
- Create a new env var,
CESIUM_VERSION, that detects the current package version making it more convenient to access across various contexts.
- This adds a dependency on
Issue number and link
Fixes https://github.com/CesiumGS/cesium/issues/11827
Testing plan
-
When CI runs, all expected jobs should start:
-
CI artifacts should then show up as pending:
-
CI artifacts should all transition to success and each link should work: a. "coverage results" should navigate to the coverage results index b. "cesium-.tgz" should download the packed npm package c. "Cesium-.zip" should download the release zip d. "index.html` should navigate to the deployed static build
Author checklist
- [x] I have submitted a Contributor License Agreement
- [x] I have added my name to
CONTRIBUTORS.md - [ ] ~I have updated
CHANGES.mdwith a short summary of my change~ - [ ] ~I have added or updated unit tests to ensure consistent code coverage~
- [x] I have updated the inline documentation, and included code examples where relevant
- [x] I have performed a self-review of my code
Thank you for the pull request, @ggetz!
:white_check_mark: We can confirm we have a CLA on file for you.
Wait to review; This needs an additional change.
This is ready for review and the PR description is up-to-date.
CI seems to be passing and working as expected. I assume there's not really any way to test this locally?
No, not end-to-end. You could test some commands locally, but if CI is working as expected I think that's unnecessary.