88 branches :
99 - main
1010 tags :
11- - ' v* '
11+ - " v* "
1212
1313concurrency :
1414 group : ${{ github.workflow }}-${{ github.ref }}
@@ -30,13 +30,203 @@ permissions:
3030 statuses : write
3131
3232jobs :
33- ci :
34- name : CI
35- uses : settlemint/smart-contracts-actions/.github/workflows/solidity.yml@main
36- secrets :
37- TOKEN : ${{ secrets.GITHUB_TOKEN }}
38- with :
39- docker-image-name : solidity-token-erc721a
40- runs-on : solidity-token-erc721a
41- ignition-module : ' ignition/modules/ExampleERC721a.ts'
42- subgraph-contract-address-key : ' ExampleERC721aModule#ExampleERC721a'
33+ codescanning :
34+ name : Code Scanning
35+ runs-on : ubuntu-latest
36+ container :
37+ image : returntocorp/semgrep
38+ steps :
39+ - name : Checkout
40+ uses : actions/checkout@v4
41+ with :
42+ submodules : recursive
43+
44+ - name : Install canvas dependencies
45+ run : |
46+ apk update
47+ apk add --no-cache cairo-dev jpeg-dev pango-dev giflib-dev build-base g++ pkgconfig
48+
49+ - name : Fetch semgrep rules
50+ uses : actions/checkout@v4
51+ with :
52+ repository : decurity/semgrep-smart-contracts
53+ path : rules
54+
55+ - run : semgrep ci --sarif --output=semgrep.sarif || true
56+ env :
57+ SEMGREP_RULES : rules/solidity/security rules/solidity/performance
58+
59+ - uses : crytic/slither-action@v0.4.0
60+ id : slither
61+ with :
62+ sarif : slither.sarif
63+ slither-args : --filter-paths "lib/" --filter-paths "node_modules/"
64+ solc-version : 0.8.24
65+ fail-on : none
66+
67+ - name : Upload findings to GitHub Advanced Security Dashboard
68+ uses : github/codeql-action/upload-sarif@v3
69+ with :
70+ sarif_file : semgrep.sarif
71+ if : always()
72+
73+ - name : Upload findings to GitHub Advanced Security Dashboard
74+ uses : github/codeql-action/upload-sarif@v3
75+ with :
76+ sarif_file : ${{ steps.slither.outputs.sarif }}
77+ if : always()
78+
79+ test :
80+ services :
81+ foundry :
82+ image : ghcr.io/settlemint/btp-anvil-test-node:latest
83+ ports :
84+ - ' 8545:8545'
85+ name : Test
86+ runs-on : ubuntu-latest
87+ steps :
88+ - name : Checkout
89+ uses : actions/checkout@v4
90+ with :
91+ submodules : recursive
92+
93+ - name : Install Foundry
94+ uses : foundry-rs/foundry-toolchain@v1
95+ with :
96+ version : nightly
97+
98+ - uses : actions/setup-node@v4
99+ with :
100+ node-version : 20
101+
102+ - name : Install Node dependencies
103+ run : npm install
104+
105+ - name : Run Forge build
106+ run : |
107+ forge --version
108+ forge build --sizes
109+
110+ - name : Run Hardhat build
111+ run : |
112+ npx hardhat compile
113+
114+ - name : Run Forge tests
115+ run : |
116+ forge test -vvv
117+
118+ - name : Run Hardhat test
119+ run : |
120+ npx hardhat test
121+
122+ - name : Setup LCOV
123+ if : github.ref_name != 'main'
124+ uses : hrishikesh-kadam/setup-lcov@v1
125+
126+ - name : Run Forge Coverage
127+ if : github.ref_name != 'main'
128+ run : |
129+ forge coverage --report lcov --report summary
130+ id : coverage
131+
132+ - name : Deploy to the local node
133+ run : |
134+ npx hardhat ignition deploy --network localhost ignition/modules/main.ts
135+
136+ - name : Install YQ
137+ uses : alexellis/arkade-get@master
138+ with :
139+ print-summary : false
140+ yq : latest
141+
142+ - name : Build the subgraph
143+ run : |
144+ if [ ! -d "subgraph" ] || [ -z "$(ls -A subgraph)" ]; then
145+ echo "Subgraph directory is missing or empty"
146+ exit 0
147+ fi
148+ npx graph-compiler --config subgraph/subgraph.config.json --include node_modules/@openzeppelin/subgraphs/src/datasources subgraph/datasources --export-schema --export-subgraph
149+ yq -i e '.specVersion = "1.2.0"' generated/scs.subgraph.yaml
150+ yq -i e '.features = ["nonFatalErrors", "fullTextSearch", "ipfsOnEthereumContracts"]' generated/scs.subgraph.yaml
151+ yq -i e '.dataSources[].mapping.apiVersion = "0.0.7"' generated/scs.subgraph.yaml
152+ yq -i e '.dataSources[].network = "localhost"' generated/scs.subgraph.yaml
153+ yq -i e '.templates[].mapping.apiVersion = "0.0.7"' generated/scs.subgraph.yaml
154+ yq -i e '.templates[].network = "localhost"' generated/scs.subgraph.yaml
155+ npx graph codegen generated/scs.subgraph.yaml
156+ npx graph build generated/scs.subgraph.yaml
157+
158+ - name : Report code coverage
159+ if : github.ref_name != 'main'
160+ uses : zgosalvez/github-actions-report-lcov@v4.1.10
161+ with :
162+ coverage-files : lcov.info
163+ minimum-coverage : 90
164+ github-token : ${{ secrets.GITHUB_TOKEN }}
165+ update-comment : true
166+
167+ docker :
168+ needs :
169+ - test
170+ name : Docker
171+ runs-on : ubuntu-latest
172+ steps :
173+ - name : Checkout
174+ uses : actions/checkout@v4
175+ with :
176+ submodules : recursive
177+
178+ - name : Set up QEMU
179+ uses : docker/setup-qemu-action@v3
180+
181+ - name : Set up Docker Buildx
182+ uses : docker/setup-buildx-action@v3
183+
184+ - name : Install Cosign
185+ uses : sigstore/cosign-installer@v3
186+
187+ - name : Login to GitHub Container Registry
188+ uses : docker/login-action@v3
189+ with :
190+ registry : ghcr.io
191+ username : ${{ github.repository_owner }}
192+ password : ${{ secrets.GITHUB_TOKEN }}
193+
194+ - name : Docker meta
195+ id : docker_meta
196+ uses : docker/metadata-action@v5
197+ with :
198+ images : |
199+ ghcr.io/${{ github.repository }}
200+ tags : |
201+ type=schedule
202+ type=ref,event=branch
203+ type=ref,event=pr
204+ type=semver,pattern={{version}}
205+ type=semver,pattern={{major}}.{{minor}}
206+ type=semver,pattern={{major}}
207+ type=sha
208+
209+ - name : Build and push
210+ uses : docker/build-push-action@v5
211+ id : build-and-push
212+ with :
213+ platforms : linux/amd64,linux/arm64
214+ provenance : true
215+ sbom : true
216+ push : true
217+ load : false
218+ tags : ${{ steps.docker_meta.outputs.tags }}
219+ labels : ${{ steps.docker_meta.outputs.labels }}
220+ no-cache : true
221+
222+
223+ - name : Sign the images with GitHub OIDC Token
224+ env :
225+ DIGEST : ${{ steps.build-and-push.outputs.digest }}
226+ TAGS : ${{ steps.docker_meta.outputs.tags }}
227+ run : |
228+ images=""
229+ for tag in ${TAGS}; do
230+ images+="${tag}@${DIGEST} "
231+ done
232+ cosign sign --yes ${images}
0 commit comments