@@ -37,37 +37,39 @@ jobs:
37
37
changed-files :
38
38
runs-on : ubuntu-latest
39
39
outputs :
40
- any_changed : ${{ steps.changed-files.outputs.any_changed }}
41
- modified_files : ${{ steps.changed-files.outputs.modified_files }}
40
+ any_sol_changed : ${{ steps.changed-files.outputs.any_changed }}
41
+ changed_files : ${{ steps.changed-files.outputs.all_changed_and_modified_files }}
42
42
steps :
43
43
- uses : actions/checkout@v4
44
44
- name : Get changed files
45
45
id : changed-files
46
46
uses : tj-actions/changed-files@v44
47
47
with :
48
- files : packages/**/*.{ sol,json,ts}
48
+ files : packages/**/*.sol
49
49
50
50
compile :
51
- if : needs.changed-files.outputs.any_changed == 'true'
51
+ if : needs.changed-files.outputs.any_sol_changed == 'true'
52
52
needs : [changed-files, deps]
53
53
runs-on : ubuntu-latest
54
54
steps :
55
55
- uses : actions/checkout@v4
56
56
- uses : actions/setup-node@v4
57
57
with :
58
58
node-version : 20
59
+ # forge needs some deps coming from node_modules, so we need to restore it
59
60
- uses : actions/cache/restore@v4
60
61
with :
61
62
path : node_modules
62
63
key : ${{ needs.deps.outputs.cache-key }}
63
-
64
- - run : yarn compile
65
-
64
+ - uses : foundry-rs/foundry-toolchain@v1
65
+ with :
66
+ version : nightly
67
+ - run : forge compile
66
68
- name : Upload compilation results
67
69
uses : actions/upload-artifact@v4
68
70
with :
69
- name : all-artifacts
70
- path : packages/**/artifacts /**
71
+ name : out
72
+ path : out /**
71
73
72
74
style :
73
75
needs : deps
@@ -77,50 +79,45 @@ jobs:
77
79
- uses : actions/setup-node@v4
78
80
with :
79
81
node-version : 20
82
+ - uses : foundry-rs/foundry-toolchain@v1
83
+ with :
84
+ version : nightly
80
85
- uses : actions/cache/restore@v4
81
86
with :
82
87
path : node_modules
83
88
key : ${{ needs.deps.outputs.cache-key }}
84
89
85
90
- run : yarn format
86
91
tests :
87
- if : needs.changed-files.outputs.any_changed == 'true'
88
- needs : [changed-files, set-matrix, deps, compile]
92
+ if : needs.changed-files.outputs.any_sol_changed == 'true'
93
+ needs : [changed-files, deps, compile]
89
94
runs-on : ubuntu-latest
90
- strategy :
91
- matrix :
92
- dir : ${{ fromJson(needs.set-matrix.outputs.matrix) }}
93
-
94
95
steps :
95
96
- uses : actions/checkout@v4
96
- - uses : actions/setup-node @v4
97
+ - uses : actions/download-artifact @v4
97
98
with :
98
- node-version : 20
99
+ name : out
100
+ path : out/
101
+ # forge needs some deps coming from node_modules, so we need to restore it
99
102
- uses : actions/cache/restore@v4
100
103
with :
101
104
path : node_modules
102
105
key : ${{ needs.deps.outputs.cache-key }}
103
- - uses : actions/download-artifact@v4
106
+ - uses : foundry-rs/foundry-toolchain@v1
104
107
with :
105
- name : all-artifacts
106
- path : packages/
108
+ version : nightly
107
109
108
- - if : contains(needs.changed-files.outputs.modified_files, matrix.dir)
109
- name : Test
110
- run : |
111
- workspace=$(jq -r '.name' packages/${{ matrix.dir }}/package.json)
112
- yarn workspace "$workspace" run test:coverage
110
+ - run : forge coverage --report lcov
113
111
114
- - if : contains(needs.changed-files.outputs.modified_files, matrix.dir) && github.event_name == 'push ' && github.ref == 'refs/heads/main'
112
+ - if : github.event_name == 'pull_request ' && github.ref == 'refs/pull/32/merge' # TODO: switch back to push & refs/ heads/main checks
115
113
name : Coveralls
116
114
uses : coverallsapp/github-action@v2
117
115
with :
118
116
github-token : ${{ secrets.GITHUB_TOKEN }}
119
- parallel : true
120
- flag-name : run ${{ join(matrix.*, '-') }}
117
+ file : lcov.info
121
118
122
119
set-matrix :
123
- if : needs.changed-files.outputs.any_changed == 'true'
120
+ if : needs.changed-files.outputs.any_sol_changed == 'true'
124
121
needs : changed-files
125
122
runs-on : ubuntu-latest
126
123
outputs :
@@ -134,8 +131,8 @@ jobs:
134
131
echo "matrix=$matrix" >> $GITHUB_OUTPUT
135
132
136
133
slither :
137
- if : needs.changed-files.outputs.any_changed == 'true'
138
- needs : [changed-files, set-matrix, deps ]
134
+ if : needs.changed-files.outputs.any_sol_changed == 'true'
135
+ needs : [changed-files, compile, set-matrix]
139
136
runs-on : ubuntu-latest
140
137
permissions :
141
138
contents : read
@@ -145,27 +142,12 @@ jobs:
145
142
dir : ${{ fromJson(needs.set-matrix.outputs.matrix) }}
146
143
steps :
147
144
- uses : actions/checkout@v4
148
-
149
- # FIXME this does not work as a way to restore compilation results for slither job but it does for the compile job ??
150
- # - uses: actions/download-artifact@v4
151
- # with:
152
- # name: all-artifacts
153
- # path: packages/
154
-
155
- - uses : actions/setup-node@v4
156
- with :
157
- node-version : 20
158
- - uses : actions/cache/restore@v4
145
+ - uses : actions/download-artifact@v4
159
146
with :
160
- path : node_modules
161
- key : ${{ needs.deps.outputs.cache-key }}
162
- - if : contains(needs.changed-files.outputs.modified_files, matrix.dir)
163
- name : Compile contracts
164
- run : |
165
- workspace=$(jq -r '.name' packages/${{ matrix.dir }}/package.json)
166
- yarn workspace "$workspace" run compile
147
+ name : out
148
+ path : out/
167
149
168
- - if : contains(needs.changed-files.outputs.modified_files , matrix.dir)
150
+ - if : contains(needs.changed-files.outputs.changed_files , matrix.dir)
169
151
name : Run slither
170
152
171
153
id : slither
@@ -177,7 +159,7 @@ jobs:
177
159
slither-args : --filter-paths "test" --exclude-dependencies --markdown-root ${{ github.server_url }}/${{ github.repository }}/blob/${{ github.sha }}/
178
160
target : packages/${{ matrix.dir }}
179
161
180
- - if : contains(needs.changed-files.outputs.modified_files , matrix.dir)
162
+ - if : contains(needs.changed-files.outputs.changed_files , matrix.dir)
181
163
name : Upload SARIF files
182
164
uses : github/codeql-action/upload-sarif@v3
183
165
with :
0 commit comments