Skip to content

Commit 8bbad41

Browse files
chore: add pre-commit
1 parent 411f3b9 commit 8bbad41

File tree

3 files changed

+23
-14
lines changed

3 files changed

+23
-14
lines changed

.github/workflows/on-pull-request.yaml

Lines changed: 9 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -6,20 +6,19 @@ on:
66
- main
77

88
jobs:
9-
verify_flows:
9+
pre-commit:
1010
runs-on: ubuntu-latest
11-
11+
env:
12+
SKIP: "scarb-toml-url-lock"
1213
steps:
1314
- uses: actions/checkout@v4
14-
15-
- name: Set up Python
16-
uses: actions/setup-python@v5
15+
- uses: foundry-rs/setup-snfoundry@v3
1716
with:
18-
python-version: '3.x'
19-
20-
- name: Check all flows have tests
21-
run: |
22-
python scripts/check_all_flows_have_test.py --allow-duplicate-tests
17+
starknet-foundry-version: "0.49.0"
18+
- uses: software-mansion/setup-scarb@v1
19+
with:
20+
scarb-version: "2.12.2"
21+
- uses: pre-commit/[email protected]
2322

2423
test:
2524
runs-on: ubuntu-latest
@@ -45,7 +44,3 @@ jobs:
4544
token: ${{ secrets.CODECOV_TOKEN }}
4645
files: coverage/coverage.lcov
4746
fail_ci_if_error: true
48-
49-
- name: Check formatting
50-
run: |
51-
scarb fmt -w --check

.pre-commit-config.yaml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,15 @@ repos:
88
pass_filenames: false
99
files: ^Scarb\.toml$
1010
stages: [commit]
11+
- id: ensure-flow-struct-tests
12+
name: ensure flow structs have tests
13+
entry: scripts/check_all_flows_have_test.py --allow-duplicate-tests
14+
language: system
15+
pass_filenames: false
16+
stages: [commit]
17+
- id: cairo-scarb-fmt
18+
name: check cairo code is formatted
19+
entry: scarb fmt -w --check
20+
language: system
21+
pass_filenames: false
22+
stages: [commit]

scripts/check_all_flows_have_test.py

100644100755
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
#! /usr/bin/env python3
2+
13
from io import BufferedReader
24
from re import search
35
from argparse import ArgumentParser, Namespace

0 commit comments

Comments
 (0)