@@ -57,17 +57,19 @@ jobs:
5757
5858 contracts-lint :
5959 needs : contracts-detect-changes
60- if : |
61- github.event_name == 'push'
62- || needs.contracts-detect-changes.outputs.path-filter == 'true'
6360 runs-on : ubuntu-latest
6461 defaults :
6562 run :
6663 working-directory : ./solidity/random-beacon
6764 steps :
6865 - uses : actions/checkout@v3
6966
67+ - name : Skip if no contract changes
68+ if : github.event_name == 'pull_request' && needs.contracts-detect-changes.outputs.path-filter != 'true'
69+ run : echo "No contract changes detected, skipping lint"
70+
7071 - uses : actions/setup-node@v3
72+ if : github.event_name != 'pull_request' || needs.contracts-detect-changes.outputs.path-filter == 'true'
7173 with :
7274 # Using fixed version, because 18.16 was sometimes causing issues with
7375 # artifacts generation during `hardhat compile` - see
@@ -77,27 +79,32 @@ jobs:
7779 cache-dependency-path : solidity/random-beacon/yarn.lock
7880
7981 - name : Install dependencies
82+ if : github.event_name != 'pull_request' || needs.contracts-detect-changes.outputs.path-filter == 'true'
8083 run : yarn install --network-concurrency 1
8184
8285 - name : Build
86+ if : github.event_name != 'pull_request' || needs.contracts-detect-changes.outputs.path-filter == 'true'
8387 run : yarn build
8488
8589 - name : Lint
90+ if : github.event_name != 'pull_request' || needs.contracts-detect-changes.outputs.path-filter == 'true'
8691 run : yarn lint
8792
8893 contracts-slither :
8994 needs : contracts-detect-changes
90- if : |
91- github.event_name == 'push'
92- || needs.contracts-detect-changes.outputs.path-filter == 'true'
9395 runs-on : ubuntu-latest
9496 defaults :
9597 run :
9698 working-directory : ./solidity/random-beacon
9799 steps :
98100 - uses : actions/checkout@v3
99101
102+ - name : Skip if no contract changes
103+ if : github.event_name == 'pull_request' && needs.contracts-detect-changes.outputs.path-filter != 'true'
104+ run : echo "No contract changes detected, skipping slither"
105+
100106 - uses : actions/setup-node@v3
107+ if : github.event_name != 'pull_request' || needs.contracts-detect-changes.outputs.path-filter == 'true'
101108 with :
102109 # Using fixed version, because 18.16 was sometimes causing issues with
103110 # artifacts generation during `hardhat compile` - see
@@ -107,10 +114,12 @@ jobs:
107114 cache-dependency-path : solidity/random-beacon/yarn.lock
108115
109116 - uses : actions/setup-python@v4
117+ if : github.event_name != 'pull_request' || needs.contracts-detect-changes.outputs.path-filter == 'true'
110118 with :
111119 python-version : 3.10.8
112120
113121 - name : Install Solidity
122+ if : github.event_name != 'pull_request' || needs.contracts-detect-changes.outputs.path-filter == 'true'
114123 env :
115124 SOLC_VERSION : 0.8.9 # according to solidity.version in hardhat.config.js
116125 run : |
@@ -119,29 +128,34 @@ jobs:
119128 solc-select use $SOLC_VERSION
120129
121130 - name : Install Slither
131+ if : github.event_name != 'pull_request' || needs.contracts-detect-changes.outputs.path-filter == 'true'
122132 env :
123133 SLITHER_VERSION : 0.8.3
124134 run : pip3 install slither-analyzer==$SLITHER_VERSION
125135
126136 - name : Install dependencies
137+ if : github.event_name != 'pull_request' || needs.contracts-detect-changes.outputs.path-filter == 'true'
127138 run : yarn install --network-concurrency 1
128139
129140 - name : Run Slither
141+ if : github.event_name != 'pull_request' || needs.contracts-detect-changes.outputs.path-filter == 'true'
130142 run : slither .
131143
132144 contracts-build-and-test :
133145 needs : contracts-detect-changes
134- if : |
135- github.event_name != 'pull_request'
136- || needs.contracts-detect-changes.outputs.path-filter == 'true'
137146 runs-on : ubuntu-latest
138147 defaults :
139148 run :
140149 working-directory : ./solidity/random-beacon
141150 steps :
142151 - uses : actions/checkout@v3
143152
153+ - name : Skip if no contract changes
154+ if : github.event_name == 'pull_request' && needs.contracts-detect-changes.outputs.path-filter != 'true'
155+ run : echo "No contract changes detected, skipping tests"
156+
144157 - uses : actions/setup-node@v3
158+ if : github.event_name != 'pull_request' || needs.contracts-detect-changes.outputs.path-filter == 'true'
145159 with :
146160 # Using fixed version, because 18.16 was sometimes causing issues with
147161 # artifacts generation during `hardhat compile` - see
@@ -151,28 +165,32 @@ jobs:
151165 cache-dependency-path : solidity/random-beacon/yarn.lock
152166
153167 - name : Install dependencies
168+ if : github.event_name != 'pull_request' || needs.contracts-detect-changes.outputs.path-filter == 'true'
154169 run : yarn install --network-concurrency 1
155170
156171 - name : Build solidity contracts
172+ if : github.event_name != 'pull_request' || needs.contracts-detect-changes.outputs.path-filter == 'true'
157173 run : yarn build
158174
159175 - name : Run tests
160- if : github.ref != 'refs/heads/dapp-development'
176+ if : (github.event_name != 'pull_request' || needs.contracts-detect-changes.outputs.path-filter == 'true') && github.ref != 'refs/heads/dapp-development'
161177 run : yarn test
162178
163179 contracts-deployment-dry-run :
164180 needs : contracts-detect-changes
165- if : |
166- github.event_name != 'pull_request'
167- || needs.contracts-detect-changes.outputs.path-filter == 'true'
168181 runs-on : ubuntu-latest
169182 defaults :
170183 run :
171184 working-directory : ./solidity/random-beacon
172185 steps :
173186 - uses : actions/checkout@v3
174187
188+ - name : Skip if no contract changes
189+ if : github.event_name == 'pull_request' && needs.contracts-detect-changes.outputs.path-filter != 'true'
190+ run : echo "No contract changes detected, skipping deployment dry run"
191+
175192 - uses : actions/setup-node@v3
193+ if : github.event_name != 'pull_request' || needs.contracts-detect-changes.outputs.path-filter == 'true'
176194 with :
177195 # Using fixed version, because 18.16 was sometimes causing issues with
178196 # artifacts generation during `hardhat compile` - see
@@ -182,12 +200,15 @@ jobs:
182200 cache-dependency-path : solidity/random-beacon/yarn.lock
183201
184202 - name : Install dependencies
203+ if : github.event_name != 'pull_request' || needs.contracts-detect-changes.outputs.path-filter == 'true'
185204 run : yarn install --network-concurrency 1 --frozen-lockfile
186205
187206 - name : Deploy contracts
207+ if : github.event_name != 'pull_request' || needs.contracts-detect-changes.outputs.path-filter == 'true'
188208 run : yarn deploy:test
189209
190210 - name : Build Docker Image
211+ if : github.event_name != 'pull_request' || needs.contracts-detect-changes.outputs.path-filter == 'true'
191212 uses : ./.github/actions/docker-build-push
192213 with :
193214 imageName : keep-random-beacon-hardhat
0 commit comments