-
Notifications
You must be signed in to change notification settings - Fork 3.7k
Fix coverage link, streamline env vars in CI #12971
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
ggetz
wants to merge
10
commits into
main
Choose a base branch
from
coverage-link
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+259
−140
Open
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
6780a16
Fix coverage link in CI
ggetz cb1a73a
Merge branch 'main' into coverage-link
ggetz d771cf0
Centralize env vars in env; Refactor deployment checks
ggetz 1ccaa77
Use correct workflow name
ggetz ef2875d
Merge branch 'main' into coverage-link
ggetz 9a459e9
Seperate .env per environment, docs
ggetz 185c5a5
Merge branch 'main' into coverage-link
ggetz 7a060c9
Update .env
ggetz ba274be
Merge branch 'main' into coverage-link
ggetz 8f14cb7
Merge branch 'main' into coverage-link
ggetz File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,17 @@ | ||
| # These variables are overridden in CI with GitHub Action variables if triggered from pull-request or push; | ||
| # Locally, fallback to the current local git status | ||
| BRANCH="$(git branch --show-current)" | ||
| COMMIT_SHA="$(git rev-parse HEAD)" | ||
|
|
||
| # Read the CesiumJS version from package.json | ||
| CESIUM_VERSION=$(npm pkg get version | tr -d '"') | ||
|
|
||
| # Build artifact configuration | ||
| BUILD_ARTIFACT_PATH="cesium/${BRANCH}" | ||
| BUILD_ARTIFACT_BUCKET="s3://cesium-public-builds/${BUILD_ARTIFACT_PATH}" | ||
| BUILD_ARTIFACT_URL="https://ci-builds.cesium.com/${BUILD_ARTIFACT_PATH}" | ||
|
|
||
| INDEX_URL="${BUILD_ARTIFACT_URL}/index.html" | ||
| ZIP_URL="${BUILD_ARTIFACT_URL}/Cesium-${CESIUM_VERSION}.zip" | ||
| NPM_URL="${BUILD_ARTIFACT_URL}/cesium-${CESIUM_VERSION}.tgz" | ||
| COVERAGE_URL="${BUILD_ARTIFACT_URL}/Build/Coverage/index.html" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| BRANCH="$(jq -r .pull_request.head.ref ${GITHUB_EVENT_PATH})" | ||
| COMMIT_SHA="$(jq -r .pull_request.head.sha ${GITHUB_EVENT_PATH})" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| BRANCH=${GITHUB_REF_NAME} | ||
| COMMIT_SHA=${GITHUB_SHA} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,45 @@ | ||
| name: coverage | ||
| on: | ||
| pull_request: | ||
| concurrency: | ||
| group: coverage-${{ github.ref }} | ||
| cancel-in-progress: true | ||
| jobs: | ||
| coverage: | ||
| runs-on: ubuntu-latest | ||
| env: | ||
| AWS_ACCESS_KEY_ID: ${{ secrets.DEV_AWS_ACCESS_KEY_ID }} | ||
| AWS_SECRET_ACCESS_KEY: ${{ secrets.DEV_AWS_SECRET_ACCESS_KEY }} | ||
| AWS_REGION: us-east-1 | ||
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
| permissions: | ||
| statuses: write | ||
| contents: read | ||
| steps: | ||
| - uses: actions/checkout@v5 | ||
| - name: install node 22 | ||
| uses: actions/setup-node@v6 | ||
| with: | ||
| node-version: "22" | ||
| - name: npm install | ||
| run: npm install | ||
| - name: set status pending | ||
| if: ${{ env.AWS_ACCESS_KEY_ID != '' }} | ||
| run: | | ||
| npx @dotenvx/dotenvx run -f ./.github/workflows/.env.pull_request -- \ | ||
| node ./scripts/setCommitStatus.js coverage pending | ||
| - name: build | ||
| run: npm run build | ||
| - name: coverage (firefox) | ||
| run: npm run coverage -- --browsers FirefoxHeadless --webgl-stub --failTaskOnError --suppressPassed | ||
| - name: upload coverage artifacts | ||
| if: ${{ env.AWS_ACCESS_KEY_ID != '' }} | ||
| run: | | ||
| npx @dotenvx/dotenvx run -f ./.github/workflows/.env.pull_request -f .env \ | ||
| -- sh -c \ | ||
| 'aws s3 sync ./Build/Coverage $BUILD_ARTIFACT_BUCKET/Build/Coverage --delete' | ||
| - name: set status success | ||
| if: ${{ env.AWS_ACCESS_KEY_ID != '' }} | ||
| run: | | ||
| npx @dotenvx/dotenvx run -f ./.github/workflows/.env.pull_request -- \ | ||
| node ./scripts/setCommitStatus.js coverage ${{ job.status }} | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why are we calling
dotenvxfromnpxinstead of using it directly in the script files? is it just so we can specify the extra.env.pull_requestfiles?Also as an aside for my curiosity, what is the reason you went with
dotenvxinstead of justdotenv? a quick search seems that the motivation would be to encrypt the env files with secrets but we aren't doing that. Is this future proofing?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I chose
dotenvxspecifically because it supports variable expansion and command substitution, which I don't believe "regular"dotenvsupports.Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes. The default
.envis being loaded from the script itself, but this command is what allows us to override with the CI-specific values in.env.pull_request. If there's an alternative syntax you know of, please tell!