-
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
base: main
Are you sure you want to change the base?
Changes from all commits
6780a16
cb1a73a
d771cf0
1ccaa77
ef2875d
9a459e9
185c5a5
7a060c9
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
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" |
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})" |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
BRANCH=${GITHUB_REF_NAME} | ||
COMMIT_SHA=${GITHUB_SHA} |
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@v5 | ||
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 }} |
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -2,7 +2,7 @@ name: deploy | |||||
on: | ||||||
push: | ||||||
branches-ignore: | ||||||
- 'cesium.com' | ||||||
- "cesium.com" | ||||||
- production | ||||||
concurrency: | ||||||
group: deploy-${{ github.ref }} | ||||||
|
@@ -14,26 +14,31 @@ jobs: | |||||
statuses: write | ||||||
contents: read | ||||||
env: | ||||||
BUILD_VERSION: ${{ github.ref_name }}.${{ github.run_number }} | ||||||
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 | ||||||
BRANCH: ${{ github.ref_name }} | ||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||||||
GITHUB_REPO: ${{ github.repository }} | ||||||
GITHUB_SHA: ${{ github.sha }} | ||||||
BASE_URL: /cesium/${{ github.ref_name }}/ | ||||||
DEPLOYED_URL: https://ci-builds.cesium.com/cesium/${{ github.ref_name }}/ | ||||||
steps: | ||||||
- uses: actions/checkout@v5 | ||||||
- name: install node 22 | ||||||
uses: actions/setup-node@v5 | ||||||
with: | ||||||
node-version: '22' | ||||||
node-version: "22" | ||||||
- name: npm install | ||||||
run: npm install | ||||||
- name: set the version in package.json | ||||||
run: npm run deploy-set-version -- --buildVersion $BUILD_VERSION | ||||||
- name: set version in package.json | ||||||
run: | | ||||||
npx @dotenvx/dotenvx run -f ./.github/workflows/.env.push \ | ||||||
-- sh -c \ | ||||||
'npm version prerelease --preid $BRANCH --ws --include-workspace-root --no-git-tag-version' | ||||||
- name: set status pending | ||||||
if: ${{ env.AWS_ACCESS_KEY_ID != '' }} | ||||||
run: | | ||||||
npx @dotenvx/dotenvx run -f ./.github/workflows/.env.push -- \ | ||||||
node ./scripts/setCommitStatus.js zip pending && \ | ||||||
node ./scripts/setCommitStatus.js npm pending && \ | ||||||
node ./scripts/setCommitStatus.js index pending | ||||||
- name: create release zip | ||||||
run: npm run make-zip | ||||||
- name: package cesium module | ||||||
|
@@ -48,7 +53,9 @@ jobs: | |||||
- name: deploy to s3 | ||||||
if: ${{ env.AWS_ACCESS_KEY_ID != '' }} | ||||||
run: | | ||||||
aws s3 sync . s3://cesium-public-builds/cesium/$BRANCH/ \ | ||||||
npx @dotenvx/dotenvx run -f ./.github/workflows/.env.push -f .env \ | ||||||
-- sh -c \ | ||||||
'aws s3 sync . $BUILD_ARTIFACT_BUCKET \ | ||||||
--cache-control "no-cache" \ | ||||||
--exclude ".git/*" \ | ||||||
--exclude ".github/*" \ | ||||||
|
@@ -61,7 +68,11 @@ jobs: | |||||
--exclude "node_modules/*" \ | ||||||
--exclude "scripts/*" \ | ||||||
--exclude "Tools/*" \ | ||||||
--delete | ||||||
- name: set status | ||||||
--delete' | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
(I believe this is extra/a typo?) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't think so—This should be the closing single quote paired with line 58. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ah I see now... that's deceptively hard to see 🕵️ A consequence of needing to use |
||||||
- name: set status success | ||||||
if: ${{ env.AWS_ACCESS_KEY_ID != '' }} | ||||||
run: npm run deploy-status -- --status success --message Deployed | ||||||
run: | | ||||||
npx @dotenvx/dotenvx run -f ./.github/workflows/.env.push -- \ | ||||||
node ./scripts/setCommitStatus.js zip ${{ job.status }} && \ | ||||||
node ./scripts/setCommitStatus.js npm ${{ job.status }} && \ | ||||||
node ./scripts/setCommitStatus.js index ${{ job.status }} |
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
dotenvx
fromnpx
instead of using it directly in the script files? is it just so we can specify the extra.env.pull_request
files?Also as an aside for my curiosity, what is the reason you went with
dotenvx
instead 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
dotenvx
specifically because it supports variable expansion and command substitution, which I don't believe "regular"dotenv
supports.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
.env
is 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!