-
Notifications
You must be signed in to change notification settings - Fork 70
98 lines (80 loc) · 2.78 KB
/
contract_checks.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
name: CI
on:
pull_request:
branches:
- dev
push:
branches:
- dev
- main
jobs:
determine-changes:
runs-on: ubuntu-latest
outputs:
contracts_dir: ${{ steps.changes.outputs.contracts_dir }}
steps:
- uses: actions/checkout@v2
- name: Check for changes
uses: dorny/paths-filter@v3
id: changes
with:
filters: |
contracts_dir:
- 'contracts/src/**'
check-lint:
runs-on: ubuntu-latest
needs: determine-changes
steps:
- uses: actions/checkout@v2
- name: Setup Scarb
uses: software-mansion/setup-scarb@v1
if: needs.determine-changes.outputs.contracts_dir == 'true'
with:
scarb-version: "2.6.5"
- name: Run Scarb formatting
if: needs.determine-changes.outputs.contracts_dir == 'true'
working-directory: contracts
run: scarb fmt
- name: No changes detected in contracts directory
if: needs.determine-changes.outputs.contracts_dir == 'false'
run: echo "No linting perfomed since no changes have been detected in the contracts directory."
check-contracts-changes:
runs-on: ubuntu-latest
needs: determine-changes
steps:
- uses: actions/checkout@v2
- name: Install scarb
uses: software-mansion/setup-scarb@v1
if: needs.determine-changes.outputs.contracts_dir == 'true'
with:
scarb-version: "2.6.5"
- name: Run Scarb check
if: needs.determine-changes.outputs.contracts_dir == 'true'
working-directory: contracts
run: scarb check
- name: No changes detected in contracts directory
if: needs.determine-changes.outputs.contracts_dir == 'false'
run: echo "No contracts checks done since no changes have been detected in the contracts directory."
run-tests:
runs-on: ubuntu-latest
needs: determine-changes
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Install Scarb
uses: software-mansion/setup-scarb@v1
if: needs.determine-changes.outputs.contracts_dir == 'true'
with:
scarb-version: "2.6.5"
- name: Install snfoundry
uses: foundry-rs/setup-snfoundry@v3
if: needs.determine-changes.outputs.contracts_dir == 'true'
with:
starknet-foundry-version: "0.27.0"
- name: Run Cairo tests
if: needs.determine-changes.outputs.contracts_dir == 'true'
id: cairo_tests
run: bash scripts/run_tests.sh
- name: No changes detected in contracts directory
if: needs.determine-changes.outputs.contracts_dir == 'false'
run: echo "No tests were run since no changes have been detected in the contracts directory."