File tree Expand file tree Collapse file tree 5 files changed +803
-0
lines changed
Expand file tree Collapse file tree 5 files changed +803
-0
lines changed Original file line number Diff line number Diff line change 1+ name : Contract Semver Check
2+
3+ on :
4+ pull_request :
5+ branches :
6+ - main
7+ - master
8+ - develop
9+ paths :
10+ - ' src/**/*.sol'
11+ - ' semver-lock.json'
12+ - ' scripts/sol-semver.mjs'
13+
14+ jobs :
15+ check-semver :
16+ name : Verify contract semantic version bumps
17+ runs-on : general
18+ container :
19+ image : ${{ vars.GCP_DOCKER_IMAGE_REGISTRY }}/node-extended:f4f41461
20+ credentials :
21+ username : _json_key_base64
22+ password : ${{ secrets.GCP_DOCKER_IMAGES_REGISTRY_SERVICE_ACCOUNT }}
23+ steps :
24+ - name : Checkout
25+ uses : actions/checkout@v4
26+ with :
27+ fetch-depth : 0
28+
29+ - name : Init env
30+ run : |
31+ yarn install
32+ forge soldeer install
33+
34+ - name : Check semantic version bumps in changed contracts
35+ env :
36+ BASE_REF : ${{ github.event.pull_request.base.sha }}
37+ HEAD_REF : ${{ github.event.pull_request.head.sha }}
38+ run : |
39+ node scripts/sol-semver.mjs check \
40+ --old-ref "$BASE_REF" \
41+ --new-ref "$HEAD_REF" \
42+ --lock-file semver-lock.json
Original file line number Diff line number Diff line change @@ -230,3 +230,16 @@ BaseStrategy (Abstract)
2302303 . Add strategy-specific tests in ` test/unit/core/ ` or ` test/unit/zodiac-core/ `
2312314 . Create factory in ` src/factories/ ` if permissionless deployment needed
2322325 . Update documentation with strategy-specific details
233+
234+ ** Contract semantic versioning checks** :
235+ 1 . Keep ` API_VERSION ` (or ` VERSION ` ) in sync with contract interface/storage changes.
236+ 2 . Update ` semver-lock.json ` when a tracked contract version changes.
237+ 3 . Semver classification uses a single built-in mode based on storage, ABI, and bytecode layers.
238+ 4 . If a changed contract has no version constant, semver check fails and requires adding one in ` X.Y.Z ` format.
239+ 5 . Run local checks:
240+
241+ ``` bash
242+ yarn semver:diff --old-ref origin/develop --new-ref HEAD --contract src/core/MultistrategyVault.sol:MultistrategyVault
243+ yarn semver:check --old-ref origin/develop --new-ref HEAD
244+ node scripts/sol-semver.mjs check --old-ref origin/develop --new-ref HEAD --lock-file semver-lock.json
245+ ```
Original file line number Diff line number Diff line change 3939 "slither:setup" : " python3 -m venv .venv && .venv/bin/pip3 install slither-analyzer" ,
4040 "slither" : " .venv/bin/slither . --print human-summary" ,
4141 "slither:ci" : " slither . --print human-summary --disable-color 2> reports/slither.txt; slither ." ,
42+ "semver:diff" : " node scripts/sol-semver.mjs diff" ,
43+ "semver:check" : " node scripts/sol-semver.mjs check --lock-file semver-lock.json" ,
4244 "storage:generate" : " ./script/storage.sh generate" ,
4345 "storage:check" : " ./script/storage.sh check" ,
4446 "init" : " husky && shx chmod +x .husky/*" ,
You can’t perform that action at this time.
0 commit comments