Skip to content

Commit 18552cf

Browse files
authored
Prevent retired Calcit snapshots from returning (#44)
* ci: prevent retired Calcit snapshots from returning * fix: honor frontend CDN base in normal builds * Remove extra CDN checks and rely on COS Action verify * Keep snapshot guards while simplifying validation
1 parent 7e066bf commit 18552cf

6 files changed

Lines changed: 33 additions & 14 deletions

File tree

‎.github/workflows/upload.yaml‎

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,10 @@ on:
99
- main
1010
pull_request: {}
1111

12+
concurrency:
13+
group: cos-upload-${{ github.repository }}-${{ github.event_name == 'pull_request' && 'pr' || 'production' }}
14+
cancel-in-progress: false
15+
1216
jobs:
1317
test:
1418
runs-on: ubuntu-latest
@@ -39,37 +43,34 @@ jobs:
3943
run: |
4044
caps --ci
4145
yarn install --immutable
42-
caps verify --toolchain
4346
4447
- name: Validate Calcit snapshot and types
4548
run: |
46-
calcit calcit.cirru fix --workflow strict --verify --format edn
49+
set -euo pipefail
50+
test ! -e compact.cirru
51+
test ! -e package.cirru
4752
calcit calcit.cirru edit format
4853
git diff --exit-code -- calcit.cirru
4954
calcit calcit.cirru --check-only
50-
calcit calcit.cirru analyze deprecated --summary-only --format json
51-
calcit calcit.cirru analyze dynamic-methods --summary-only --format json | jq -e '.data.summary.findings == 0'
52-
calcit calcit.cirru analyze quality --baseline config/calcit-quality.cirru
5355
5456
- name: Build client with CDN asset URLs
5557
id: asset-path
5658
env:
5759
CDN_ORIGIN: https://cos-sh.tiye.me
60+
PR_NUMBER: ${{ github.event.pull_request.number }}
5861
run: |
62+
set -euo pipefail
5963
if [[ "$GITHUB_EVENT_NAME" == "pull_request" ]]; then
60-
asset_prefix="${GITHUB_REPOSITORY}/pr/"
61-
elif [[ "$GITHUB_REF" == "refs/heads/main" ]]; then
62-
asset_prefix="${GITHUB_REPOSITORY}/"
64+
asset_prefix="${GITHUB_REPOSITORY}/pr/${PR_NUMBER}/"
6365
else
64-
asset_prefix="${GITHUB_REPOSITORY}/branches/${GITHUB_REF_NAME}/"
66+
asset_prefix="${GITHUB_REPOSITORY}/"
6567
fi
6668
export VITE_BASE_URL="${CDN_ORIGIN}/${asset_prefix}"
6769
echo "VITE_BASE_URL=${VITE_BASE_URL}" >> "$GITHUB_ENV"
6870
echo "prefix=${asset_prefix}" >> "$GITHUB_OUTPUT"
6971
echo "base-url=${VITE_BASE_URL}" >> "$GITHUB_OUTPUT"
70-
calcit calcit.cirru js
72+
yarn build
7173
node --test scripts/upgrade.test.mjs
72-
yarn vite build --base="$VITE_BASE_URL"
7374
7475
- name: Upload static assets to COS
7576
if: github.event_name == 'push' || github.event.pull_request.head.repo.full_name == github.repository

‎.gitignore‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11

22
.compact-inc.cirru
33
.calcit-error.cirru
4+
compact.cirru
5+
package.cirru
46

57
js-out/
68
node_modules/

‎README.md‎

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,16 @@ Text diff
66
77
### Workflow
88

9+
Calcit 0.27.0 uses `calcit.cirru` and `deps.cirru` as the canonical project files. Do not restore or commit the retired `compact.cirru` or `package.cirru`; CI rejects either file, even when ignored by Git.
10+
11+
`yarn build` generates JavaScript explicitly and uses `VITE_BASE_URL` for frontend assets (relative URLs when unset). CI builds with the COS prefix:
12+
13+
```bash
14+
VITE_BASE_URL=https://cos-sh.tiye.me/mvc-works/text-diff/pr/ yarn build
15+
```
16+
17+
Public upload verification uses `worktools/cos-upload-action`'s built-in verify settings, without an extra CDN checker. Existing server deployment paths and shared fonts/icons are unchanged.
18+
919
Workflow https://github.com/mvc-works/calcit-workflow
1020

1121
### License

‎calcit.cirru‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,9 @@
175175
'text-diff.schema $ %{} 'FileEntry
176176
:defs $ {}
177177
'Store $ %{} 'CodeEntry (:doc |)
178-
:code $ quote $ defstruct Store (:states 'Dynamic) (:content 'String)
178+
:code $ quote $ defstruct Store
179+
:states $ :: 'Map 'Tag 'Dynamic
180+
:content 'String
179181
:examples $ []
180182
:schema $ :: 'StructDef
181183
'store $ %{} 'CodeEntry (:doc |)

‎package.json‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55
"main": "index.js",
66
"packageManager": "yarn@4.18.0",
77
"scripts": {
8-
"compile": "calcit calcit.cirru",
9-
"build": "calcit calcit.cirru && yarn vite build --base=./",
8+
"compile": "calcit calcit.cirru js",
9+
"build": "yarn compile && yarn vite build",
1010
"dev": "yarn vite"
1111
},
1212
"repository": {

‎vite.config.mjs‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
import { defineConfig } from 'vite';
2+
3+
// Keep local builds relative; production/PR builds receive their exact COS URL.
4+
export default defineConfig({ base: process.env.VITE_BASE_URL || './' });

0 commit comments

Comments
 (0)