11name : Build and run tests
22
3- on :
4- # always test main
5- push :
6- branches :
7- - main
8- # test PRs
9- pull_request :
10- # allow triggering tests, ignores skip check
11- workflow_dispatch :
3+ on : [push, pull_request]
124
135jobs :
146 pre_job :
@@ -19,12 +11,11 @@ jobs:
1911 - id : skip_check
2012 uses : fkirc/skip-duplicate-actions@v5
2113 with :
22- # don't run on documentation changes
2314 paths_ignore : ' ["**/README.md", "docs/**", "guidelines/**"]'
2415 # cancel previous builds if a new commit is pushed
25- # but never cancel main
26- cancel_others : ${{ github.ref != 'refs/heads/main' }}
27-
16+ cancel_others : ' true '
17+ # only run on push *or* pull_request, not both
18+ concurrent_skipping : ' same_content_newer '
2819 pre_docs_job :
2920 runs-on : ubuntu-latest
3021 outputs :
@@ -33,23 +24,23 @@ jobs:
3324 - id : skip_check
3425 uses : fkirc/skip-duplicate-actions@v5
3526 with :
36- # don't run on readme changes
3727 paths_ignore : ' ["**/README.md"]'
3828 # cancel previous builds if a new commit is pushed
39- # but never cancel main
40- cancel_others : ${{ github.ref != 'refs/heads/main' }}
29+ cancel_others : ' true'
30+ # only run on push *or* pull_request, not both
31+ concurrent_skipping : ' same_content_newer'
4132
4233 build-yosys :
4334 name : Reusable build
4435 runs-on : ${{ matrix.os }}
45- # pre_job is a subset of pre_docs_job, so we can always build for pre_docs_job
4636 needs : pre_docs_job
4737 if : needs.pre_docs_job.outputs.should_skip != 'true'
4838 env :
4939 CC : clang
5040 strategy :
5141 matrix :
5242 os : [ubuntu-latest, macos-latest]
43+ sanitizer : [undefined, address]
5344 fail-fast : false
5445 steps :
5546 - name : Checkout Yosys
6758 mkdir build
6859 cd build
6960 make -f ../Makefile config-$CC
61+ echo 'SANITIZER = ${{ matrix.sanitizer }}' >> Makefile.conf
7062 make -f ../Makefile -j$procs ENABLE_LTO=1
7163
7264 - name : Log yosys-config output
8274 - name : Store build artifact
8375 uses : actions/upload-artifact@v4
8476 with :
85- name : build-${{ matrix.os }}
77+ name : build-${{ matrix.os }}-${{ matrix.sanitizer }}
8678 path : build.tar
8779 retention-days : 1
8880
9385 if : needs.pre_job.outputs.should_skip != 'true'
9486 env :
9587 CC : clang
88+ ASAN_OPTIONS : halt_on_error=1
89+ UBSAN_OPTIONS : halt_on_error=1
9690 strategy :
9791 matrix :
9892 os : [ubuntu-latest, macos-latest]
93+ sanitizer : [undefined, address]
9994 fail-fast : false
10095 steps :
10196 - name : Checkout Yosys
@@ -107,12 +102,11 @@ jobs:
107102 uses : ./.github/actions/setup-build-env
108103
109104 - name : Get iverilog
110- id : get-iverilog
111105 shell : bash
112106 run : |
113107 git clone https://github.com/steveicarus/iverilog.git
114108 cd iverilog
115- echo "IVERILOG_GIT=$(git rev-parse HEAD)" >> $GITHUB_OUTPUT
109+ echo "IVERILOG_GIT=$(git rev-parse HEAD)" >> $GITHUB_ENV
116110
117111 - name : Get vcd2fst
118112 shell : bash
@@ -129,7 +123,7 @@ jobs:
129123 uses : actions/cache@v4
130124 with :
131125 path : .local/
132- key : ${{ matrix.os }}-${{ steps.get-iverilog.outputs. IVERILOG_GIT } }
126+ key : ${{ matrix.os }}-${IVERILOG_GIT}
133127
134128 - name : Build iverilog
135129 if : steps.cache-iverilog.outputs.cache-hit != 'true'
@@ -145,7 +139,7 @@ jobs:
145139 - name : Download build artifact
146140 uses : actions/download-artifact@v4
147141 with :
148- name : build-${{ matrix.os }}
142+ name : build-${{ matrix.os }}-${{ matrix.sanitizer }}
149143
150144 - name : Uncompress build
151145 shell : bash
@@ -177,6 +171,7 @@ jobs:
177171 strategy :
178172 matrix :
179173 os : [ubuntu-latest]
174+ sanitizer : [undefined]
180175 steps :
181176 - name : Checkout Yosys
182177 uses : actions/checkout@v4
@@ -189,7 +184,7 @@ jobs:
189184 - name : Download build artifact
190185 uses : actions/download-artifact@v4
191186 with :
192- name : build-${{ matrix.os }}
187+ name : build-${{ matrix.os }}-${{ matrix.sanitizer }}
193188
194189 - name : Uncompress build
195190 shell : bash
@@ -214,6 +209,7 @@ jobs:
214209 strategy :
215210 matrix :
216211 os : [ubuntu-latest]
212+ sanitizer : [undefined, address]
217213 fail-fast : false
218214 steps :
219215 - name : Checkout Yosys
@@ -227,7 +223,7 @@ jobs:
227223 - name : Download build artifact
228224 uses : actions/download-artifact@v4
229225 with :
230- name : build-${{ matrix.os }}
226+ name : build-${{ matrix.os }}-${{ matrix.sanitizer }}
231227
232228 - name : Uncompress build
233229 shell : bash
0 commit comments