11name : Build and run tests
22
3- on : [push, pull_request]
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 :
412
513jobs :
614 pre_job :
@@ -11,11 +19,12 @@ jobs:
1119 - id : skip_check
1220 uses : fkirc/skip-duplicate-actions@v5
1321 with :
22+ # don't run on documentation changes
1423 paths_ignore : ' ["**/README.md", "docs/**", "guidelines/**"]'
1524 # cancel previous builds if a new commit is pushed
16- cancel_others : ' true '
17- # only run on push *or* pull_request, not both
18- concurrent_skipping : ' same_content_newer '
25+ # but never cancel main
26+ cancel_others : ${{ github.ref != 'refs/heads/main' }}
27+
1928 pre_docs_job :
2029 runs-on : ubuntu-latest
2130 outputs :
@@ -24,23 +33,23 @@ jobs:
2433 - id : skip_check
2534 uses : fkirc/skip-duplicate-actions@v5
2635 with :
36+ # don't run on readme changes
2737 paths_ignore : ' ["**/README.md"]'
2838 # cancel previous builds if a new commit is pushed
29- cancel_others : ' true'
30- # only run on push *or* pull_request, not both
31- concurrent_skipping : ' same_content_newer'
39+ # but never cancel main
40+ cancel_others : ${{ github.ref != 'refs/heads/main' }}
3241
3342 build-yosys :
3443 name : Reusable build
3544 runs-on : ${{ matrix.os }}
45+ # pre_job is a subset of pre_docs_job, so we can always build for pre_docs_job
3646 needs : pre_docs_job
3747 if : needs.pre_docs_job.outputs.should_skip != 'true'
3848 env :
3949 CC : clang
4050 strategy :
4151 matrix :
4252 os : [ubuntu-latest, macos-latest]
43- sanitizer : [undefined, address]
4453 fail-fast : false
4554 steps :
4655 - name : Checkout Yosys
5867 mkdir build
5968 cd build
6069 make -f ../Makefile config-$CC
61- echo 'SANITIZER = ${{ matrix.sanitizer }}' >> Makefile.conf
6270 make -f ../Makefile -j$procs ENABLE_LTO=1
6371
6472 - name : Log yosys-config output
7482 - name : Store build artifact
7583 uses : actions/upload-artifact@v4
7684 with :
77- name : build-${{ matrix.os }}-${{ matrix.sanitizer }}
85+ name : build-${{ matrix.os }}
7886 path : build.tar
7987 retention-days : 1
8088
8593 if : needs.pre_job.outputs.should_skip != 'true'
8694 env :
8795 CC : clang
88- ASAN_OPTIONS : halt_on_error=1
89- UBSAN_OPTIONS : halt_on_error=1
9096 strategy :
9197 matrix :
9298 os : [ubuntu-latest, macos-latest]
93- sanitizer : [undefined, address]
9499 fail-fast : false
95100 steps :
96101 - name : Checkout Yosys
@@ -102,11 +107,12 @@ jobs:
102107 uses : ./.github/actions/setup-build-env
103108
104109 - name : Get iverilog
110+ id : get-iverilog
105111 shell : bash
106112 run : |
107113 git clone https://github.com/steveicarus/iverilog.git
108114 cd iverilog
109- echo "IVERILOG_GIT=$(git rev-parse HEAD)" >> $GITHUB_ENV
115+ echo "IVERILOG_GIT=$(git rev-parse HEAD)" >> $GITHUB_OUTPUT
110116
111117 - name : Get vcd2fst
112118 shell : bash
@@ -123,7 +129,7 @@ jobs:
123129 uses : actions/cache@v4
124130 with :
125131 path : .local/
126- key : ${{ matrix.os }}-${IVERILOG_GIT}
132+ key : ${{ matrix.os }}-${{ steps.get-iverilog.outputs. IVERILOG_GIT } }
127133
128134 - name : Build iverilog
129135 if : steps.cache-iverilog.outputs.cache-hit != 'true'
@@ -139,7 +145,7 @@ jobs:
139145 - name : Download build artifact
140146 uses : actions/download-artifact@v4
141147 with :
142- name : build-${{ matrix.os }}-${{ matrix.sanitizer }}
148+ name : build-${{ matrix.os }}
143149
144150 - name : Uncompress build
145151 shell : bash
@@ -171,7 +177,6 @@ jobs:
171177 strategy :
172178 matrix :
173179 os : [ubuntu-latest]
174- sanitizer : [undefined]
175180 steps :
176181 - name : Checkout Yosys
177182 uses : actions/checkout@v4
@@ -184,7 +189,7 @@ jobs:
184189 - name : Download build artifact
185190 uses : actions/download-artifact@v4
186191 with :
187- name : build-${{ matrix.os }}-${{ matrix.sanitizer }}
192+ name : build-${{ matrix.os }}
188193
189194 - name : Uncompress build
190195 shell : bash
@@ -209,7 +214,6 @@ jobs:
209214 strategy :
210215 matrix :
211216 os : [ubuntu-latest]
212- sanitizer : [undefined, address]
213217 fail-fast : false
214218 steps :
215219 - name : Checkout Yosys
@@ -223,7 +227,7 @@ jobs:
223227 - name : Download build artifact
224228 uses : actions/download-artifact@v4
225229 with :
226- name : build-${{ matrix.os }}-${{ matrix.sanitizer }}
230+ name : build-${{ matrix.os }}
227231
228232 - name : Uncompress build
229233 shell : bash
0 commit comments