Skip to content

Commit 1682e44

Browse files
ci: restructure github workflows
1 parent fc48614 commit 1682e44

File tree

3 files changed

+66
-41
lines changed

3 files changed

+66
-41
lines changed
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
name: Check Formatting
2+
3+
on:
4+
workflow_call:
5+
6+
jobs:
7+
check_formatting:
8+
runs-on: ubuntu-latest
9+
10+
steps:
11+
- uses: actions/checkout@v4
12+
- uses: software-mansion/setup-scarb@v1
13+
with:
14+
scarb-version: "2.12.2"
15+
16+
- name: Check formatting
17+
run: |
18+
scarb fmt -w --check

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

Lines changed: 3 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -6,46 +6,8 @@ on:
66
- main
77

88
jobs:
9-
verify_flows:
10-
runs-on: ubuntu-latest
11-
12-
steps:
13-
- uses: actions/checkout@v4
14-
15-
- name: Set up Python
16-
uses: actions/setup-python@v5
17-
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
23-
249
test:
25-
runs-on: ubuntu-latest
26-
27-
steps:
28-
- uses: actions/checkout@v4
29-
- uses: foundry-rs/setup-snfoundry@v3
30-
with:
31-
starknet-foundry-version: "0.49.0"
32-
- uses: software-mansion/setup-scarb@v1
33-
with:
34-
scarb-version: "2.12.2"
35-
36-
- name: Install cairo-coverage
37-
run: |
38-
curl -L https://raw.githubusercontent.com/software-mansion/cairo-coverage/main/scripts/install.sh | sh
39-
40-
- name: Run test and coverage
41-
run: scarb test -w --coverage
42-
43-
- uses: codecov/[email protected]
44-
with:
45-
token: ${{ secrets.CODECOV_TOKEN }}
46-
files: workspace/apps/staking/contracts/coverage/coverage.lcov
47-
fail_ci_if_error: true
10+
uses: ./.github/workflows/test.yaml
4811

49-
- name: Check formatting
50-
run: |
51-
scarb fmt -w --check
12+
check_formatting:
13+
uses: ./.github/workflows/check_formatting.yaml

.github/workflows/test.yaml

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
name: Test
2+
3+
on:
4+
workflow_call:
5+
6+
jobs:
7+
verify_flows:
8+
runs-on: ubuntu-latest
9+
10+
steps:
11+
- uses: actions/checkout@v4
12+
13+
- name: Set up Python
14+
uses: actions/setup-python@v5
15+
with:
16+
python-version: '3.x'
17+
18+
- name: Check all flows have tests
19+
run: |
20+
python scripts/check_all_flows_have_test.py --allow-duplicate-tests
21+
22+
test:
23+
runs-on: ubuntu-latest
24+
25+
steps:
26+
- uses: actions/checkout@v4
27+
- uses: foundry-rs/setup-snfoundry@v3
28+
with:
29+
starknet-foundry-version: "0.49.0"
30+
- uses: software-mansion/setup-scarb@v1
31+
with:
32+
scarb-version: "2.12.2"
33+
34+
- name: Install cairo-coverage
35+
run: |
36+
curl -L https://raw.githubusercontent.com/software-mansion/cairo-coverage/main/scripts/install.sh | sh
37+
38+
- name: Run test and coverage
39+
run: scarb test -w --coverage
40+
41+
- uses: codecov/[email protected]
42+
with:
43+
token: ${{ secrets.CODECOV_TOKEN }}
44+
files: workspace/apps/staking/contracts/coverage/coverage.lcov
45+
fail_ci_if_error: true

0 commit comments

Comments
 (0)