Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 9 additions & 5 deletions .github/workflows/upload.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,9 @@ permissions:
contents: read

concurrency:
group: cos-upload-${{ github.repository }}-${{ github.event_name == 'pull_request' && github.run_id || 'production' }}
group: cos-upload-${{ github.repository }}-${{ github.event_name == 'pull_request' && format('pr-{0}', github.event.pull_request.number) || 'production' }}
cancel-in-progress: false
queue: max

jobs:
test:
Expand Down Expand Up @@ -42,6 +43,7 @@ jobs:
set -euo pipefail
caps --ci --strict
yarn install --immutable
caps verify --toolchain

- name: Validate Calcit snapshot
run: |
Expand All @@ -53,6 +55,9 @@ jobs:
calcit calcit.cirru edit format
git diff --exit-code -- calcit.cirru
calcit calcit.cirru --check-only
calcit calcit.cirru analyze check-public \
--ns app.comp.container --ns app.config --ns app.main \
--ns app.schema --ns app.updater --summary-only --format json

- name: Build client with CDN asset URLs
id: asset-path
Expand All @@ -62,21 +67,20 @@ jobs:
run: |
set -euo pipefail
if [[ "$GITHUB_EVENT_NAME" == "pull_request" ]]; then
asset_prefix="${GITHUB_REPOSITORY}/pr/${PR_NUMBER}/${GITHUB_RUN_ID}/"
asset_prefix="${GITHUB_REPOSITORY}/pr/${PR_NUMBER}/${GITHUB_RUN_ID}/${GITHUB_RUN_ATTEMPT}/"
else
asset_prefix="${GITHUB_REPOSITORY}/"
fi
export VITE_BASE_URL="${CDN_ORIGIN}/${asset_prefix}"
echo "VITE_BASE_URL=${VITE_BASE_URL}" >> "$GITHUB_ENV"
echo "prefix=${asset_prefix}" >> "$GITHUB_OUTPUT"
echo "base-url=${VITE_BASE_URL}" >> "$GITHUB_OUTPUT"
calcit calcit.cirru js
yarn build
node --test scripts/upgrade.test.mjs
yarn vite build --base="$VITE_BASE_URL"

- name: Upload static assets to COS
if: github.event_name == 'push' || github.event.pull_request.head.repo.full_name == github.repository
uses: worktools/cos-upload-action@17e6d213fe9f6772a6090a13c8ba044cd6cbcb09 # v1.1.1
uses: worktools/cos-upload-action@06d6027dcca6413c5936e04a9b6e9f0d5ef71ba0 # v1.2.0
with:
source-dir: dist
bucket: ${{ secrets.COS_BUCKET }}
Expand Down
12 changes: 9 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,17 @@ Use Calcit 0.27.0 and the canonical `calcit.cirru` / `deps.cirru` files.
Retired `compact.cirru` and `package.cirru` snapshots are ignored and rejected
by CI. Dependencies are resolved with `caps --ci --strict`.

The COS action verifies uploaded resources with its built-in verify settings;
Released COS action v1.2.0 validates HTML references and verifies public uploads;
no extra CDN checker is needed. Existing external fonts and server paths remain
unchanged.
Each PR run uses its own preview prefix (`pr/<number>/<run-id>/`) and concurrency
group. The six runtime checks do not claim to validate generated CDN URLs.
Each PR run uses its own preview prefix (`pr/<number>/<run-id>/<attempt>/`).
Runs queue per PR and separately for production, without cancelling uploads.
The six existing runtime checks cover diff behavior, not CDN verification.

`yarn build` compiles the default JS browser entry and builds once, using
`VITE_BASE_URL` when set. `yarn dev` compiles initially and starts Vite; run
`calcit calcit.cirru -w` in another terminal for live edits. CI keeps canonical,
entry/all-public checks, toolchain verification and the existing business tests.

### Workflow

Expand Down
5 changes: 5 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,11 @@
"author": "jiyinyiyong",
"license": "MIT",
"packageManager": "yarn@4.18.0",
"scripts": {
"compile": "calcit calcit.cirru",
"build": "yarn compile && vite build",
"dev": "yarn compile && vite"
},
"devDependencies": {
"bottom-tip": "^0.1.5",
"vite": "8.3.1"
Expand Down
3 changes: 3 additions & 0 deletions vite.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export default {
base: process.env.VITE_BASE_URL ?? "./",
};