Repository navigation
1380 lines (1231 loc) · 49.4 KB
/
Copy pathbuild.yml
File metadata and controls
1380 lines (1231 loc) · 49.4 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
name: Test
# Run CI on push, PR, and weekly.
on:
workflow_dispatch:
pull_request:
paths-ignore: # prevent from running if only docs are updated
- '**.md'
- 'docs/**'
- '**/*README*'
- '**.rst'
push:
branches:
- 'master'
schedule:
- cron: "0 0 * * 0 " # weekly
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
# Environment variables
env:
# Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.)
BUILD_TYPE: release
DOCKER_REPO: ${{ secrets.DOCKER_REPO }}
# (Boolean) Setting this value to True, will force linux tet always
IGNORE_DOCKER_TEST: ${{ secrets.IGNORE_DOCKER_TEST }}
REPO_OWNER: ${{ github.repository_owner }}
# Multiple job to tests
jobs:
change_detect:
name: "Detect code changes"
runs-on: ubuntu-latest
outputs:
# this is output as string, see https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions#jobsjob_idoutputs
source_modified: ${{ steps.changes.outputs.status_code == '1' }}
force_upload: false
sha_short: ${{ steps.changes.outputs.sha_short }}
docker_repo: ${{ steps.changes.outputs.docker_repo }}
steps:
- name: Cancel previous
uses: styfle/cancel-workflow-action@0.12.1
with:
access_token: ${{ github.token }}
- name: Checkout OpenFPGA repo
uses: actions/checkout@v6
with:
fetch-depth: 0
- name: Check for source code changes
id: changes
run: |
git diff origin/master HEAD --name-status -- . ':!openfpga_flow' ':!docs'
if git diff origin/master HEAD --name-status --exit-code -- . ':!openfpga_flow' ':!docs'; then
echo "::set-output name=status_code::0"
else
echo "::set-output name=status_code::$?"
fi
if [[ (${GITHUB_REF} == 'refs/heads/master') || -n "${IGNORE_DOCKER_TEST}" ]]; then
echo "Current branch is master forcing source_modified"
echo "::set-output name=status_code::1"
fi
if [[ -n "${DOCKER_REPO}" ]]; then
echo "name=docker_repo::$REPO_OWNER"
echo "::set-output name=docker_repo::$REPO_OWNER"
else
echo "name=docker_repo::lnis-uofu"
echo "::set-output name=docker_repo::lnis-uofu"
fi
echo "::set-output name=sha_short::$(git rev-parse --short HEAD)"
# Test the compilation compatibility
macos_build:
needs: change_detect
if: ${{ fromJSON(needs.change_detect.outputs.source_modified) }}
name: ${{ matrix.config.name }}
runs-on: ${{ matrix.config.os }}
# Note: dependencies are installed in the container. See details about dependency list in docker/Dockerfile.master
# Comment the line out when base image is built again
#container: ghcr.io/${{ needs.change_detect.outputs.docker_repo }}/openfpga-build-${{ matrix.config.cc}}
# Branch on different OS and settings
strategy:
fail-fast: false
matrix:
config:
- name: "Build (Clang, MacOS 15)"
os: macos-15
cc: clang
cxx: clang++
cmake_flags: "-DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache"
- name: "Build (Clang, MacOS 26)"
os: macos-26
cc: clang
cxx: clang++
cmake_flags: "-DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache"
# Define the steps to run the build job
env:
CC: ${{ matrix.config.cc }}
CXX: ${{ matrix.config.cxx }}
steps:
- name: Cancel previous
uses: styfle/cancel-workflow-action@0.9.1
with:
access_token: ${{ github.token }}
- name: Checkout repo
uses: actions/checkout@v6
with:
submodules: recursive
- name: Show build environment
run: |
sw_vers
uname -m
xcodebuild -version
clang --version
clang++ --version
cmake --version
ninja --version
- name: Install dependencies
run: |
./.github/workflows/build_dependency_${{ matrix.config.os}}.sh
python3 -m venv myenv
source myenv/bin/activate
python3 -m pip install --upgrade pip setuptools
python3 -m pip install -r requirements.txt
echo "==== Checking python packages ===="
python -c "import yaml; print('Installed')"
echo "---- Sleep 10 seconds before copy file consider system glitching ----"
sleep 10s
- name: ccache
uses: hendrikmuhs/ccache-action@v1.2
with:
key: ${{ runner.os }}-macos-${{ github.job }}-${{ matrix.config.prefix }}-${{ hashFiles('**/CMakeLists.txt', '**/Makefile') }}
restore-keys: |
${{ runner.os }}-macos-${{ github.job }}-${{ matrix.config.prefix }}-
${{ runner.os }}-macos-${{ github.job }}-
- name: Get number of CPU cores
uses: SimenB/github-actions-cpu-cores@v3
id: cpu-cores
- name: Build
env:
CCACHE_DIR: ${{ github.workspace }}/.ccache
run: |
make all BUILD_TYPE=$BUILD_TYPE CMAKE_FLAGS="${{ matrix.config.cmake_flags }}" -j${{ steps.cpu-cores.outputs.count}}
# Yosys-slang plugin has issues on linking library to Yosys in Msys2. Suspect the root of cause is on the linking path. Disable it for now.
win_msys2_installer:
needs: change_detect
if: ${{ fromJSON(needs.change_detect.outputs.source_modified) }}
name: ${{ matrix.config.name }}
runs-on: windows-latest
# Note: dependencies are installed in the container. See details about dependency list in docker/Dockerfile.master
# Comment the line out when base image is built again
#container: ghcr.io/${{ needs.change_detect.outputs.docker_repo }}/openfpga-build-${{ matrix.config.cc}}
# Branch on different OS and settings
strategy:
fail-fast: false
matrix:
config:
- name: "Installer (GCC, Windows Msys2-UCRT64)"
cc: gcc
cxx: g++
os: UCRT64
prefix: ucrt64
cmake_flags: "-DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache"
defaults:
run:
# This ensures all 'run' steps use the MSYS2 bash shell by default
shell: msys2 {0}
# Define the steps to run the build job
env:
CC: ${{ matrix.config.cc }}
CXX: ${{ matrix.config.cxx }}
steps:
- name: Cancel previous
uses: styfle/cancel-workflow-action@0.9.1
with:
access_token: ${{ github.token }}
- name: Checkout repo
uses: actions/checkout@v6
with:
submodules: recursive
- name: Setup MSYS2
uses: msys2/setup-msys2@v2
with:
msystem: ${{ matrix.config.os }}
update: true
# Optional: Pre-install core tools needed to run your script
install: >-
wget
git
tree
- name: Locate pacman cache
id: pacman-cache
run: echo "dir=$(cygpath -m /var/cache/pacman/pkg)" >> "$GITHUB_OUTPUT"
- name: Cache pacman packages
uses: actions/cache@v4
with:
path: ${{ steps.pacman-cache.outputs.dir }}
key: msys2-pacman-${{ matrix.config.os }}-${{ hashFiles('.github/workflows/build_dependency_win-msys2-*.sh') }}
restore-keys: |
msys2-pacman-${{ matrix.config.os }}-
#In MSYS2, the flex package is an MSYS-native tool, meaning it installs its headers to /usr/include/FlexLexer.h. However, if you are using a MinGW-w64 environment (e.g., UCRT64, MINGW64), the compiler only looks for headers in /mingw64/include or similar toolchain-specific paths. The most common workaround is to copy or link the header from the MSYS directory to your active MinGW-w64 include directory.
# For python build from sources
- name: Install dependencies
run: |
./.github/workflows/build_dependency_win-msys2-${{ matrix.config.os}}.sh
python3 -m venv myenv
source myenv/bin/activate
python3 -m pip install --upgrade pip setuptools
python3 -m pip install -r msys2_requirements.txt
echo "==== Checking python packages ===="
python -c "import yaml; print('Installed')"
echo "---- Sleep 10 seconds before copy file consider system glitching ----"
sleep 10s
cp /usr/include/FlexLexer.h /${{ matrix.config.prefix}}/include/
- name: Dump tool versions
run: |
which cmake
cmake --version
which ${CC}
${CC} --version
which ${CXX}
${CXX} --version
which ld
ld --version
which python3
python3 --version
- name: ccache
uses: hendrikmuhs/ccache-action@v1.2
with:
key: ${{ runner.os }}-msys2-${{ github.job }}-${{ matrix.config.prefix }}-${{ hashFiles('**/CMakeLists.txt', '**/Makefile') }}
restore-keys: |
${{ runner.os }}-msys2-${{ github.job }}-${{ matrix.config.prefix }}-
${{ runner.os }}-msys2-${{ github.job }}-
- name: Get number of CPU cores
uses: SimenB/github-actions-cpu-cores@v3
id: cpu-cores
- name: Create installer
shell: msys2 {0}
env:
CCACHE_DIR: ${{ github.workspace }}/.ccache
run: |
make checkout_build
make prebuild BUILD_TYPE=$BUILD_TYPE INSTALLER_TYPE=IFW INSTALL_DOC=OFF CMAKE_FLAGS="${{ matrix.config.cmake_flags }}" -j${{ steps.cpu-cores.outputs.count}}
make installer BUILD_TYPE=$BUILD_TYPE INSTALLER_TYPE=IFW INSTALL_DOC=OFF CMAKE_FLAGS="${{ matrix.config.cmake_flags }}" -j${{ steps.cpu-cores.outputs.count}}
- name: Upload artifact
uses: actions/upload-artifact@v7
if: ${{ failure() }}
with:
name: failed_msys2_installer_log
retention-days: 1
path: |
_CPack_Packages/win64/IFW/PreinstallOutput.log
- name: Upload artifact installer
uses: actions/upload-artifact@v7
with:
name: win_msys2_installer
retention-days: 1
path: |
OpenFPGA-tool-suites-*-win64.exe
# Test the compilation compatibility
# Yosys-slang plugin has issues on linking library to Yosys in Msys2. Suspect the root of cause is on the linking path. Disable it for now.
win_msys2_build:
needs: change_detect
if: ${{ fromJSON(needs.change_detect.outputs.source_modified) }}
name: ${{ matrix.config.name }}
runs-on: windows-latest
# Note: dependencies are installed in the container. See details about dependency list in docker/Dockerfile.master
# Comment the line out when base image is built again
#container: ghcr.io/${{ needs.change_detect.outputs.docker_repo }}/openfpga-build-${{ matrix.config.cc}}
# Branch on different OS and settings
strategy:
fail-fast: false
matrix:
config:
- name: "Build (GCC, Windows Msys2-UCRT64)"
cc: gcc
cxx: g++
os: UCRT64
prefix: ucrt64
cmake_flags: "-DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache"
defaults:
run:
# This ensures all 'run' steps use the MSYS2 bash shell by default
shell: msys2 {0}
# Define the steps to run the build job
env:
CC: ${{ matrix.config.cc }}
CXX: ${{ matrix.config.cxx }}
steps:
- name: Cancel previous
uses: styfle/cancel-workflow-action@0.9.1
with:
access_token: ${{ github.token }}
- name: Checkout repo
uses: actions/checkout@v6
- name: Setup MSYS2
uses: msys2/setup-msys2@v2
with:
msystem: ${{ matrix.config.os }}
update: true
# Optional: Pre-install core tools needed to run your script
install: >-
wget
git
tree
- name: Locate pacman cache
id: pacman-cache
run: echo "dir=$(cygpath -m /var/cache/pacman/pkg)" >> "$GITHUB_OUTPUT"
- name: Cache pacman packages
uses: actions/cache@v4
with:
path: ${{ steps.pacman-cache.outputs.dir }}
key: msys2-pacman-${{ matrix.config.os }}-${{ hashFiles('.github/workflows/build_dependency_win-msys2-*.sh') }}
restore-keys: |
msys2-pacman-${{ matrix.config.os }}-
#In MSYS2, the flex package is an MSYS-native tool, meaning it installs its headers to /usr/include/FlexLexer.h. However, if you are using a MinGW-w64 environment (e.g., UCRT64, MINGW64), the compiler only looks for headers in /mingw64/include or similar toolchain-specific paths. The most common workaround is to copy or link the header from the MSYS directory to your active MinGW-w64 include directory.
# For python build from sources
- name: Install dependencies
run: |
./.github/workflows/build_dependency_win-msys2-${{ matrix.config.os}}.sh
cp /usr/include/FlexLexer.h /${{ matrix.config.prefix}}/include/
python3 -m venv myenv
source myenv/bin/activate
python3 -m pip install --upgrade pip setuptools
python3 -m pip install -r msys2_requirements.txt
echo "==== Checking python3 packages ===="
python3 -c "import envyaml; import humanize; import coloredlogs; import pyverilog; print('Installed')"
- name: Dump tool versions
run: |
which cmake
cmake --version
which ${CC}
${CC} --version
which ${CXX}
${CXX} --version
which ld
ld --version
echo "==== Checking python3 packages ===="
source myenv/bin/activate
echo "PYTHON_EXEC=$(which python3)" >> $GITHUB_ENV
echo "OPENFPGA_PATH=$(pwd)" >> $GITHUB_ENV
python3 --version
- name: ccache
uses: hendrikmuhs/ccache-action@v1.2
with:
key: ${{ runner.os }}-msys2-${{ github.job }}-${{ matrix.config.prefix }}-${{ hashFiles('**/CMakeLists.txt', '**/Makefile') }}
restore-keys: |
${{ runner.os }}-msys2-${{ github.job }}-${{ matrix.config.prefix }}
${{ runner.os }}-msys2-${{ github.job }}
- name: Get number of CPU cores
uses: SimenB/github-actions-cpu-cores@v3
id: cpu-cores
- name: Build
shell: msys2 {0}
env:
CCACHE_DIR: ${{ github.workspace }}/.ccache
run: |
make all BUILD_TYPE=debug CMAKE_FLAGS="${{ matrix.config.cmake_flags }}" -j${{ steps.cpu-cores.outputs.count}}
- name: Build file tree
shell: msys2 {0}
run: |
tree build
- name: Check DLL linkg
shell: msys2 {0}
run: |
# This will print exactly which DLL file is missing/unresolved
ldd ./build/openfpga/openfpga.exe
- name: checkout reg test submodules
run: |
make checkout_regtest
# Reg test script has issues on handling windows paths. For example,
# Not able to locate default file CAD TOOL PATH under
# D:/a/OpenFPGA/OpenFPGA/openfpga_flow/tasks/compilation_verification/run001/aOpenFPGAOpenFPGA/openfpga_flow/misc/fpgaflow_default_tool_path_msys2_mingw64.conf
- name: Quick Test
shell: msys2 {0}
run: |
echo "==== Activate python3 virtual environment ===="
source myenv/bin/activate
echo "==== Use python3 under ${PYTHON_EXEC} ===="
python3 -c "import envyaml; import humanize; import coloredlogs; import pyverilog; print('Installed')"
echo "==== Resolve default tool path ===="
DEFAULT_TOOL_PATH="$(cygpath -m "$GITHUB_WORKSPACE")/openfpga_flow/misc/fpgaflow_default_tool_path_msys2_mingw64.conf"
echo "DEFAULT_TOOL_PATH=${DEFAULT_TOOL_PATH}"
test -f "${DEFAULT_TOOL_PATH}"
echo "==== Run a quick test ===="
python3 openfpga_flow/scripts/run_fpga_task.py openfpga_flow/tasks/compilation_verification --debug --show_thread_logs --default_tool_path "${DEFAULT_TOOL_PATH}"
- name: Upload artifact
uses: actions/upload-artifact@v7
if: ${{ failure() }}
with:
name: failed_${{matrix.config.name}}_regression_log
retention-days: 1
path: openfpga_flow/**/*.log
# Add an installer creation for MSVC build
win_msvc_installer:
needs: change_detect
name: ${{ matrix.config.name }}
runs-on: windows-2025
# Note: dependencies are installed in the container. See details about dependency list in docker/Dockerfile.master
# Comment the line out when base image is built again
#container: ghcr.io/${{ needs.change_detect.outputs.docker_repo }}/openfpga-build-${{ matrix.config.cc}}
# Branch on different OS and settings
strategy:
fail-fast: false
matrix:
config:
- name: "Installer w/o doc (MsBuild Windows-latest)"
cmake_flags: "-DOPENFPGA_WITH_SWIG=OFF -DWITH_ABC=OFF -DOPENFPGA_WITH_YOSYS=OFF -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache"
steps:
- name: Cancel previous
uses: styfle/cancel-workflow-action@0.12.1
with:
access_token: ${{ github.token }}
- name: Checkout OpenFPGA repo
uses: actions/checkout@v6
- name: vcpkg build
uses: johnwason/vcpkg-action@v7
id: vcpkg
# The vcpkg.exe download can fail transiently; retry once below
continue-on-error: true
with:
# vcpkg will automatically find and use the vcpkg.json in your repo root
token: ${{ secrets.GITHUB_TOKEN }}
manifest-dir: ${{ github.workspace }} # Set to the directory containing your vcpkg.json file
triplet: x64-windows-release # This must be set with a valid vcpkg triplet
- name: Clean up failed vcpkg build
if: steps.vcpkg.outcome == 'failure'
shell: powershell
run: |
Start-Sleep -Seconds 30
if (Test-Path "${{ github.workspace }}\vcpkg") { Remove-Item -Recurse -Force "${{ github.workspace }}\vcpkg" }
- name: vcpkg build (retry)
if: steps.vcpkg.outcome == 'failure'
uses: johnwason/vcpkg-action@v7
id: vcpkg_retry
with:
token: ${{ secrets.GITHUB_TOKEN }}
manifest-dir: ${{ github.workspace }}
triplet: x64-windows-release
- name: Install WinFlexBison
shell: powershell
run: |
choco install winflexbison3 wget eigen
choco install magicsplat-tcl-tk --version=1.16.0
# Make tools visible to CMake
echo "C:\Program Files (x86)\GnuWin32\bin" | Out-File -Append -FilePath $env:GITHUB_PATH
echo "C:\ProgramData\chocolatey\lib\winflexbison3\tools" | Out-File -Append -FilePath $env:GITHUB_PATH
- name: Dump tool versions
shell: powershell
run: |
cmake --version
where curl
win_flex --version
win_bison --version
tclsh --version
- name: Install Qt
uses: jurplel/install-qt-action@v4
with:
tools: 'tools_ifw'
# - name: Verify Installation
# run: binarycreator --version
- name: Checkout all the submodules
shell: powershell
run: |
make checkout_submodule
- name: Ensure curl is available
shell: powershell
run: |
$curlPath = (Get-Command curl.exe -ErrorAction SilentlyContinue).Source
if (-not $curlPath) {
choco install curl
$curlPath = (Get-Command curl.exe).Source
}
echo "CURL_PATH=$curlPath" >> $env:GITHUB_ENV
- name: Setup MSVC
uses: TheMrMilchmann/setup-msvc-dev@v4
with:
arch: x64
- name: Check MSVC Version
run: cl
- name: Setup ccache
uses: hendrikmuhs/ccache-action@v1.2
with:
key: ${{ runner.os }}-msvc-${{ github.sha }}
restore-keys: ${{ runner.os }}-msvc-
- name: Get number of CPU cores
uses: SimenB/github-actions-cpu-cores@v3
id: cpu-cores
# Adapt from https://github.com/tangxifan/yosys/blob/41a4b5a039d1f6e04d9c577d3f186ba85f6f1f01/.github/workflows/extra-builds.yml#L60-L80
- name: Build yosys
shell: powershell
env:
CCACHE_DIR: ${{ github.workspace }}/.ccache
run: |
cd yosys
cmake -S . -B build -G Ninja -DCMAKE_BUILD_TYPE=Release -DYOSYS_COMPILER_LAUNCHER=ccache
cmake --build build --config Release --parallel ${{ steps.cpu-cores.outputs.count }}
cmake --install build --prefix ${{ github.workspace }}/yosys_installed
- name: Build
shell: powershell
env:
CCACHE_DIR: ${{ github.workspace }}/.ccache
run: |
make all VCPKG_PATH="${{ github.workspace }}/vcpkg" INSTALLER_TYPE=IFW INSTALL_DOC=OFF CMAKE_FLAGS="${{ matrix.config.cmake_flags }}" -j${{ steps.cpu-cores.outputs.count}}
- name: Create installer
shell: powershell
env:
CCACHE_DIR: ${{ github.workspace }}/.ccache
run: |
make installer VCPKG_PATH="${{ github.workspace }}/vcpkg" INSTALLER_TYPE=IFW INSTALL_DOC=OFF CMAKE_FLAGS="${{ matrix.config.cmake_flags }}" -j${{ steps.cpu-cores.outputs.count}}
- name: Create Python virtual environment
shell: powershell
run: |
python -m venv myenv
- name: Install Icarus Verilog
shell: powershell
run: |
choco install iverilog
where.exe iverilog
where.exe vvp
- name: Quick Test
shell: powershell
run: |
echo "==== Activate python virtual environment ===="
.\myenv\Scripts\Activate.ps1
echo "==== Set OpenFPGA path ===="
$env:OPENFPGA_PATH = "${{ github.workspace }}"
echo "==== Add DLL directories to PATH ===="
$dllPaths = @(
"${{ github.workspace }}\yosys_installed",
"${{ github.workspace }}\build\openfpga\Release",
"${{ github.workspace }}\build\libs\libopenfpgashell\Release",
"${{ github.workspace }}\build\libs\libpcf\Release",
"${{ github.workspace }}\build\vtr-verilog-to-routing\vpr\Release",
"C:\Program Files\Tcl\bin"
) | Where-Object { $_ -and (Test-Path $_) }
$env:PATH = ($dllPaths -join ";") + ";" + $env:PATH
echo "==== Install Python dependencies ===="
python -m pip install --upgrade pip
python -m pip install "setuptools<81"
python -m pip install -r requirements.txt
echo "==== Show Python path ===="
python -c "import sys; print(sys.executable)"
python -c "import envyaml; import humanize; import coloredlogs; import pyverilog; print('Installed')"
echo "==== Check Icarus Verilog ===="
where.exe iverilog
where.exe vvp
echo "==== Run a quick test ===="
python openfpga_flow\scripts\run_fpga_task.py openfpga_flow\tasks\compilation_verification --debug --show_thread_logs --default_tool_path "${{ github.workspace }}\openfpga_flow\misc\fpgaflow_default_tool_path_win_msvc.conf"
- name: Upload regression logs
uses: actions/upload-artifact@v7
if: ${{ failure() }}
with:
name: failed_win_msvc_installer_regression_log
retention-days: 1
path: |
openfpga_flow/**/*.log
- name: Upload artifact
uses: actions/upload-artifact@v7
if: ${{ failure() }}
with:
name: failed_msys2_installer_log
retention-days: 1
path: |
_CPack_Packages/win64/IFW/PreinstallOutput.log
- name: Upload artifact installer
uses: actions/upload-artifact@v7
with:
name: win_msvc_installer
retention-days: 1
path: |
build/OpenFPGA-tool-suites-*-win64.exe
# Test the compilation compatibility on Linux
linux_build:
needs: change_detect
if: ${{ fromJSON(needs.change_detect.outputs.source_modified) }}
name: ${{ matrix.config.name }}
runs-on: ubuntu-22.04
# Note: dependencies are installed in the container. See details about dependency list in docker/Dockerfile.master
# Comment the line out when base image is built again
#container: ghcr.io/${{ needs.change_detect.outputs.docker_repo }}/openfpga-build-${{ matrix.config.cc}}
# Branch on different OS and settings
strategy:
fail-fast: false
matrix:
config:
- name: "Build: GCC-13 (Ubuntu 22.04)"
cc: gcc-13
cxx: g++-13
- name: "Build: GCC-12 (Ubuntu 22.04)"
cc: gcc-12
cxx: g++-12
# Define the steps to run the build job
env:
CC: ${{ matrix.config.cc }}
CXX: ${{ matrix.config.cxx }}
steps:
- name: Cancel previous
uses: styfle/cancel-workflow-action@0.12.1
with:
access_token: ${{ github.token }}
- name: Checkout OpenFPGA repo
uses: actions/checkout@v6
- name: Install dependencies
run: sudo bash ./.github/workflows/install_dependencies_build_ubuntu.sh
- name: Dump tool versions
run: |
cmake --version
${CC} --version
${CXX} --version
- uses: hendrikmuhs/ccache-action@v1.2
with:
# Generates a unique key based on the specific job and matrix parameters
key: ${{ github.job }}-${{ runner.os }}-${{ matrix.config.cc}}
# Defines the fallback prefix if an exact match is missing
restore-keys: |
${{ github.job }}-${{ runner.os }}-
- name: Get number of CPU cores
uses: SimenB/github-actions-cpu-cores@v3
id: cpu-cores
- name: Build
shell: bash
run: |
export PATH="/usr/lib/ccache:/usr/local/opt/ccache/libexec:$PATH"
make all BUILD_TYPE=$BUILD_TYPE CMAKE_FLAGS="-DOPENFPGA_SWIG_PYTHON=ON -DPython3_EXECUTABLE=/usr/bin/python3" -j${{ steps.cpu-cores.outputs.count}}
- name: Clear error log
if: ${{ failure() }}
shell: bash
run: |
make all BUILD_TYPE=$BUILD_TYPE CMAKE_FLAGS="-DOPENFPGA_SWIG_PYTHON=ON -DPython3_EXECUTABLE=/usr/bin/python3" -j1
- name: checkout reg test submodules
run: |
make checkout_regtest
# Check the cache size and see if it is over the limit
- name: Check ccache size
run: ccache -s
- name: Upload artifact
uses: actions/upload-artifact@v7
if: ${{ matrix.config.cc == 'gcc-12'}}
with:
name: openfpga
path: |
build/vtr-verilog-to-routing/abc/abc
build/vtr-verilog-to-routing/abc/libabc.a
build/vtr-verilog-to-routing/ace2/ace
build/vtr-verilog-to-routing/vpr/libvpr.a
build/vtr-verilog-to-routing/vpr/vpr
build/openfpga/libopenfpga.a
build/openfpga/openfpga_shell.so
build/openfpga/_openfpga.so
build/openfpga/openfpga.py
build/openfpga/openfpga
build/openfpga/share
build/openfpga/yosys-abc
build/yosys/yosys
build/yosys/yosys-abc
build/yosys/yosys-config
build/yosys/libyosys-abc.a
build/yosys/libyosys.so
build/yosys/share
build/yosys-smtbmc
build/yosys-witness
openfpga_flow
openfpga.sh
linux_build_opt:
needs: change_detect
if: ${{ fromJSON(needs.change_detect.outputs.source_modified) }}
name: ${{ matrix.config.name }}
runs-on: ubuntu-22.04
# Note: dependencies are installed in the container. See details about dependency list in docker/Dockerfile.master
# Comment the line out when base image is built again
#container: ghcr.io/${{ needs.change_detect.outputs.docker_repo }}/openfpga-build-${{ matrix.config.cc}}
# Branch on different OS and settings
strategy:
fail-fast: false
matrix:
config:
- name: "Build w/o Yosys (Ubuntu 22.04)"
cc: gcc-12
cxx: g++-12
cmake_flags: "-DOPENFPGA_WITH_YOSYS=OFF"
- name: "Build w/o test (Ubuntu 22.04)"
cc: gcc-12
cxx: g++-12
cmake_flags: "-DOPENFPGA_WITH_TEST=OFF"
- name: "Build w/o version number (Ubuntu 22.04)"
cc: gcc-12
cxx: g++-12
cmake_flags: "-DOPENFPGA_WITH_VERSION=OFF"
- name: "Build w/o SWIG support (Ubuntu 22.04)"
cc: gcc-12
cxx: g++-12
cmake_flags: "-DOPENFPGA_WITH_SWIG=OFF"
- name: "Build with capnproto update (Ubuntu 22.04)"
cc: gcc-12
cxx: g++-12
cmake_flags: "-DOPENFPGA_UPDATE_UNIQUE_BLOCK_CAPN=ON"
- name: "Build with libedit (Ubuntu 22.04)"
cc: gcc-12
cxx: g++-12
cmake_flags: "-DOPENFPGA_READLINE_MODE=libedit"
- name: "Build with std::getline (Ubuntu 22.04)"
cc: gcc-12
cxx: g++-12
cmake_flags: "-DOPENFPGA_READLINE_MODE=standard"
# Define the steps to run the build job
env:
CC: ${{ matrix.config.cc }}
CXX: ${{ matrix.config.cxx }}
steps:
- name: Cancel previous
uses: styfle/cancel-workflow-action@0.12.1
with:
access_token: ${{ github.token }}
- name: Checkout OpenFPGA repo
uses: actions/checkout@v6
- name: Install dependencies
run: sudo bash ./.github/workflows/install_dependencies_build_ubuntu.sh
- name: Dump tool versions
run: |
cmake --version
${CC} --version
${CXX} --version
- uses: hendrikmuhs/ccache-action@v1.2
with:
# Generates a unique key based on the specific job and matrix parameters
key: ${{ github.job }}-${{ runner.os }}-${{ matrix.config.cc}}-${{ matrix.config.cmake_flags}}
# Defines the fallback prefix if an exact match is missing
restore-keys: |
${{ github.job }}-${{ runner.os }}-${{ matrix.config.cc}}-
- name: Get number of CPU cores
uses: SimenB/github-actions-cpu-cores@v3
id: cpu-cores
- name: Build
shell: bash
run: |
export PATH="/usr/lib/ccache:/usr/local/opt/ccache/libexec:$PATH"
make all BUILD_TYPE=$BUILD_TYPE CMAKE_FLAGS="${{ matrix.config.cmake_flags }}" -j${{ steps.cpu-cores.outputs.count}}
alma_support:
needs: change_detect
if: ${{ fromJSON(needs.change_detect.outputs.source_modified) }}
name: ${{ matrix.config.name }}
runs-on: ubuntu-latest
container:
image: almalinux:8
strategy:
fail-fast: false
matrix:
config:
- name: "Build (GCC on Alma-8)"
cc: gcc
cxx: g++
dependency_version: "alma8"
# Define the steps to run the build job
env:
CC: ${{ matrix.config.cc }}
CXX: ${{ matrix.config.cxx }}
steps:
- name: Check OS version
run: |
cat /etc/os-release
echo "===== Repositories ====="
dnf repolist --all
echo "===== PowerTools ====="
dnf repolist --all | grep -i power
echo "===== Install Git as the default one is too old ===="
dnf install -y git
echo "===== Git version ====="
git --version
- name: Checkout OpenFPGA repo
uses: actions/checkout@v6
- name: Install dependencies
run: |
# Alma8 container does not allow sudo
bash ./.github/workflows/build_dependency_${{ matrix.config.dependency_version }}.sh
# To use gcc-12 in the current step and export paths for subsequent steps:
echo "CC=/opt/rh/gcc-toolset-12/root/usr/bin/gcc" >> $GITHUB_ENV
echo "CXX=/opt/rh/gcc-toolset-12/root/usr/bin/g++" >> $GITHUB_ENV
- name: Install CMake
uses: lukka/get-cmake@latest
with:
cmakeVersion: 4.0.0
- name: Dump tool versions
run: |
cmake --version
${CC} --version
${CXX} --version
- uses: hendrikmuhs/ccache-action@v1.2
with:
# Generates a unique key based on the specific job and matrix parameters
key: ${{ github.job }}-${{ runner.os }}-${{ matrix.config.cc}}-${{ matrix.config.dependency_version}}
# Defines the fallback prefix if an exact match is missing
restore-keys: |
${{ github.job }}-${{ runner.os }}-${{ matrix.config.cc}}-
- name: Get number of CPU cores
uses: SimenB/github-actions-cpu-cores@v3
id: cpu-cores
- name: Build
working-directory: ${{ github.workspace }}
shell: bash
run: |
source /opt/rh/gcc-toolset-12/enable
export PATH="/usr/lib/ccache:/usr/local/opt/ccache/libexec:$PATH"
echo "PWD: $PWD"
echo "WORKSPACE: $GITHUB_WORKSPACE"
# Check if the workspace has a git control
ls -la .git
git config --global --add safe.directory '*'
git status
make all BUILD_TYPE=$BUILD_TYPE -j${{ steps.cpu-cores.outputs.count}}
centos_support:
needs: change_detect
if: ${{ fromJSON(needs.change_detect.outputs.source_modified) }}
name: ${{ matrix.config.name }}
runs-on: ubuntu-22.04
container: ${{ matrix.config.docker_image }}
strategy:
fail-fast: false
matrix:
config:
- name: "Build (GCC on CentOS 9)"
cc: gcc
cxx: g++
dependency_version: "centos9"
docker_image: "ghcr.io/easybuilders/centosstream-9:2025-03-03-13626131526.124"
# Define the steps to run the build job
env:
CC: ${{ matrix.config.cc }}
CXX: ${{ matrix.config.cxx }}
steps:
- name: Checkout OpenFPGA repo
uses: actions/checkout@v6
- name: Install dependencies
run: |
sudo bash ./.github/workflows/install_dependencies_build_${{ matrix.config.dependency_version }}.sh
# To use gcc-12 in the current step and export paths for subsequent steps:
echo "CC=/opt/rh/gcc-toolset-12/root/usr/bin/gcc" >> $GITHUB_ENV
echo "CXX=/opt/rh/gcc-toolset-12/root/usr/bin/g++" >> $GITHUB_ENV
- name: Dump tool versions
run: |
cmake --version
${CC} --version
${CXX} --version
- uses: hendrikmuhs/ccache-action@v1.2
with:
# Generates a unique key based on the specific job and matrix parameters
key: ${{ github.job }}-${{ runner.os }}-${{ matrix.config.cc}}-${{ matrix.config.dependency_version}}
# Defines the fallback prefix if an exact match is missing
restore-keys: |
${{ github.job }}-${{ runner.os }}-${{ matrix.config.cc}}-
- name: Get number of CPU cores
uses: SimenB/github-actions-cpu-cores@v3
id: cpu-cores
- name: Build
shell: bash
run: |
source /opt/rh/gcc-toolset-12/enable
export PATH="/usr/lib/ccache:/usr/local/opt/ccache/libexec:$PATH"
git config --global --add safe.directory '*'
make all BUILD_TYPE=$BUILD_TYPE -j${{ steps.cpu-cores.outputs.count}}
# Support 24.04
ubuntu_support:
needs: change_detect
if: ${{ fromJSON(needs.change_detect.outputs.source_modified) }}
name: ${{ matrix.config.name }}
runs-on: ${{ matrix.config.os }}
strategy:
fail-fast: false
matrix:
config:
- name: "Build (GCC on Ubuntu 24.04)"
cc: gcc-13
cxx: g++-13
os: ubuntu-24.04
- name: "Build (GCC on Ubuntu 26.04)"
cc: gcc-15
cxx: g++-15
os: ubuntu-26.04
# Define the steps to run the build job
env:
CC: ${{ matrix.config.cc }}
CXX: ${{ matrix.config.cxx }}
steps:
- name: Cancel previous
uses: styfle/cancel-workflow-action@0.12.1
with:
access_token: ${{ github.token }}
- name: Checkout OpenFPGA repo
uses: actions/checkout@v6
- name: Install dependencies
run: |
sudo bash ./.github/workflows/install_dependencies_build_ubuntu.sh
sudo bash ./.github/workflows/install_dependencies_run_ubuntu.sh