Skip to content

Commit 6772f0c

Browse files
Make global.json global again (#4166)
# Description of Changes We have had several `global.json` files introduced that aren't symlinks to the root `global.json`. This PR fixes that drift, and adds a CI check. # API and ABI breaking changes None. # Expected complexity level and risk 2 # Testing - [x] `cargo ci global-json-policy` succeeds - [x] `cargo ci global-json-policy` fails if you add a new `global.json` file somewhere - [x] Rest of CI passes, confirming that templates are still working properly --------- Signed-off-by: Zeke Foppa <196249+bfops@users.noreply.github.com> Co-authored-by: Zeke Foppa <bfops@users.noreply.github.com> Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
1 parent 143295f commit 6772f0c

8 files changed

Lines changed: 113 additions & 31 deletions

File tree

.github/workflows/ci.yml

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -908,3 +908,38 @@ jobs:
908908
repo: targetRepo,
909909
run_id: runId,
910910
});
911+
912+
global_json_policy:
913+
name: Verify global.json files are symlinks
914+
runs-on: ubuntu-latest
915+
permissions:
916+
contents: read
917+
steps:
918+
- name: Find Git ref
919+
env:
920+
PR_NUMBER: ${{ github.event.inputs.pr_number }}
921+
run: |
922+
if [ -n "$PR_NUMBER" ]; then
923+
GIT_REF="refs/pull/$PR_NUMBER/merge"
924+
else
925+
GIT_REF="${{ github.ref }}"
926+
fi
927+
echo "GIT_REF=${GIT_REF}" >>"$GITHUB_ENV"
928+
929+
- name: Checkout sources
930+
uses: actions/checkout@v4
931+
with:
932+
ref: ${{ env.GIT_REF }}
933+
934+
- uses: dsherret/rust-toolchain-file@v1
935+
936+
- name: Cache Rust dependencies
937+
uses: Swatinem/rust-cache@v2
938+
with:
939+
workspaces: ${{ github.workspace }}
940+
shared-key: spacetimedb
941+
save-if: false
942+
prefix-key: v1
943+
944+
- name: Check global.json policy
945+
run: cargo ci global-json-policy

sdks/csharp/examples~/regression-tests/republishing/server-initial/global.json

Lines changed: 0 additions & 6 deletions
This file was deleted.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../../../../../../global.json

sdks/csharp/examples~/regression-tests/republishing/server-republish/global.json

Lines changed: 0 additions & 6 deletions
This file was deleted.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../../../../../../global.json

templates/basic-cs/spacetimedb/global.json

Lines changed: 0 additions & 6 deletions
This file was deleted.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../../../global.json

templates/chat-console-cs/spacetimedb/global.json

Lines changed: 0 additions & 6 deletions
This file was deleted.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../../../global.json

tools/ci/README.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,17 @@ Usage: self-docs [OPTIONS]
142142
- `--check`: Only check for changes, do not generate the docs
143143
- `--help`: Print help (see a summary with '-h')
144144

145+
### `global-json-policy`
146+
147+
**Usage:**
148+
```bash
149+
Usage: global-json-policy
150+
```
151+
152+
**Options:**
153+
154+
- `--help`:
155+
145156
### `help`
146157

147158
**Usage:**

0 commit comments

Comments
 (0)