44 branches : ["main"]
55 pull_request :
66 branches : ["**"]
7- paths :
8- - " crates/l2/**"
9- - " fixtures/**"
10- - " crates/blockchain/dev/**"
11- - " crates/vm/levm/**"
12- - " .github/workflows/pr-main_l2.yaml"
13- - " cmd/ethrex/l2/**"
147
158permissions :
169 contents : read
2417 DOCKER_ETHREX_WORKDIR : /usr/local/bin
2518
2619jobs :
20+ detect-changes :
21+ runs-on : ubuntu-latest
22+ outputs :
23+ run_tests : ${{ steps.finish.outputs.run_tests }}
24+ steps :
25+ - uses : actions/checkout@v4
26+ - uses : dorny/paths-filter@v3
27+ id : filter
28+ with :
29+ filters : |
30+ run_tests:
31+ - "crates/l2/**"
32+ - "fixtures/**"
33+ - "crates/blockchain/dev/**"
34+ - "crates/vm/levm/**"
35+ - ".github/workflows/pr-main_l2.yaml"
36+ - "cmd/ethrex/l2/**"
37+ - name : finish
38+ id : finish
39+ run : |
40+ if [[ "${GITHUB_EVENT_NAME}" != "pull_request" ]]; then
41+ echo "run_tests=true" >> "$GITHUB_OUTPUT"
42+ else
43+ echo "run_tests=${{ steps.filter.outputs.run_tests }}" >> "$GITHUB_OUTPUT"
44+ fi
45+ - name : Print result
46+ run : echo "run_tests=${{ steps.finish.outputs.run_tests }}"
47+
2748 lint :
28- # "Lint" is a required check, don't change the name
29- name : Lint
49+ # "Lint L2 " is a required check, don't change the name
50+ name : Lint L2
3051 runs-on : ubuntu-latest
52+ needs : detect-changes
53+ if : ${{ needs.detect-changes.outputs.run_tests == 'true' }}
3154 steps :
3255 - name : Checkout sources
3356 uses : actions/checkout@v4
6992 build-docker :
7093 name : Build docker image
7194 runs-on : ubuntu-latest
95+ needs : detect-changes
96+ if : ${{ needs.detect-changes.outputs.run_tests == 'true' }}
7297 steps :
7398 - name : Checkout sources
7499 uses : actions/checkout@v4
94119 build-docker-l2 :
95120 name : Build docker image L2
96121 runs-on : ubuntu-latest
122+ needs : detect-changes
123+ if : ${{ needs.detect-changes.outputs.run_tests == 'true' }}
97124 steps :
98125 - name : Checkout sources
99126 uses : actions/checkout@v4
@@ -119,7 +146,8 @@ jobs:
119146 integration-test :
120147 name : Integration Test - ${{ matrix.name }}
121148 runs-on : ubuntu-latest
122- needs : [build-docker, build-docker-l2]
149+ needs : [detect-changes, build-docker, build-docker-l2]
150+ if : ${{ needs.detect-changes.outputs.run_tests == 'true' }}
123151 strategy :
124152 matrix :
125153 include :
@@ -309,7 +337,8 @@ jobs:
309337 integration-test-tdx :
310338 name : Integration Test - TDX
311339 runs-on : ubuntu-latest
312- needs : [build-docker, build-docker-l2]
340+ needs : [detect-changes, build-docker, build-docker-l2]
341+ if : ${{ needs.detect-changes.outputs.run_tests == 'true' }}
313342 steps :
314343 - name : Checkout sources
315344 uses : actions/checkout@v4
@@ -416,7 +445,8 @@ jobs:
416445 state-diff-test :
417446 name : State Reconstruction Tests
418447 runs-on : ubuntu-latest
419- needs : [build-docker, build-docker-l2]
448+ needs : [detect-changes, build-docker, build-docker-l2]
449+ if : ${{ needs.detect-changes.outputs.run_tests == 'true' }}
420450 steps :
421451 - name : Checkout sources
422452 uses : actions/checkout@v4
@@ -477,6 +507,8 @@ jobs:
477507 integration-test-l2-dev :
478508 name : Integration Test - L2 Dev
479509 runs-on : ubuntu-latest
510+ needs : detect-changes
511+ if : ${{ needs.detect-changes.outputs.run_tests == 'true' }}
480512 steps :
481513 - name : Checkout sources
482514 uses : actions/checkout@v4
@@ -531,18 +563,19 @@ jobs:
531563
532564 # The purpose of this job is to add it as a required check in GitHub so that we don't have to add every individual job as a required check
533565 all-tests :
534- # "Integration Test" is a required check, don't change the name
535- name : Integration Test
566+ # "Integration Test L2 " is a required check, don't change the name
567+ name : Integration Test L2
536568 runs-on : ubuntu-latest
537569 needs :
538570 [
571+ detect-changes,
539572 integration-test,
540573 state-diff-test,
541574 integration-test-tdx,
542575 integration-test-l2-dev,
543576 ]
544577 # Make sure this job runs even if the previous jobs failed or were skipped
545- if : ${{ always() && needs.integration-test.result != 'skipped' && needs.state-diff-test.result != 'skipped' && needs.integration-test-tdx.result != 'skipped' && needs.integration-test-l2-dev.result != 'skipped' }}
578+ if : ${{ needs.detect-changes.outputs.run_tests == 'true' && always() && needs.integration-test.result != 'skipped' && needs.state-diff-test.result != 'skipped' && needs.integration-test-tdx.result != 'skipped' && needs.integration-test-l2-dev.result != 'skipped' }}
546579 steps :
547580 - name : Check if any job failed
548581 run : |
0 commit comments