From 69eb39582b36101f005ca6c73eb908ca708f3417 Mon Sep 17 00:00:00 2001 From: Krystine Sherwin <93062060+KrystalDelusion@users.noreply.github.com> Date: Mon, 5 Feb 2024 21:48:25 +1300 Subject: [PATCH 01/38] ci: Introduce artifacts Separates `test-linux` into `build-linux` and `test-linux`, wherein `build-` builds out of tree, and uploading the build for the `test-` job. Tar compression is done to retain execution permissions when downloading build artifact. When calling `make test`, override `TARGETS` and `EXTRA_TARGETS` to prevent rebuild. --- .github/workflows/test-linux.yml | 66 ++++++++++++++++++++++++++------ .github/workflows/test-macos.yml | 9 ++++- 2 files changed, 61 insertions(+), 14 deletions(-) diff --git a/.github/workflows/test-linux.yml b/.github/workflows/test-linux.yml index 911b3b66e4d..c4098edbeff 100644 --- a/.github/workflows/test-linux.yml +++ b/.github/workflows/test-linux.yml @@ -1,6 +1,12 @@ name: Build and run tests (Linux) -on: [push, pull_request] +on: + pull_request: + branches: + - master + push: + branches: + - master jobs: pre_job: @@ -17,7 +23,7 @@ jobs: # only run on push *or* pull_request, not both concurrent_skipping: 'same_content_newer' - test-linux: + build-linux: needs: pre_job if: needs.pre_job.outputs.should_skip != 'true' runs-on: ${{ matrix.os.id }} @@ -123,25 +129,61 @@ jobs: make -j${{ env.procs }} make install - - name: Build yosys + - name: Build yosys out-of-tree + shell: bash + run: | + mkdir build + cd build + make -f ../Makefile config-${CC%%-*} + make -f ../Makefile -j${{ env.procs }} CXXSTD=${{ matrix.cpp_std }} CC=$CC CXX=$CC LD=$CC + + - name: Log yosys-config output + run: | + ./yosys-config || true + + - name: Compress build shell: bash run: | - make config-${CC%%-*} - make -j${{ env.procs }} CXXSTD=${{ matrix.cpp_std }} CC=$CC CXX=$CC LD=$CC + cd build + tar -cvf ../build.tar Makefile.conf share/ yosys yosys-* - name: Store build artifact if: (matrix.cpp_std == 'c++11') && (matrix.compiler == 'gcc-11') uses: actions/upload-artifact@v4 with: - name: compiled-yosys - path: yosys + name: build-artifact + path: build.tar + retention-days: 1 - - name: Run tests - if: (matrix.cpp_std == 'c++11') && (matrix.compiler == 'gcc-11') + test-linux: + name: Run tests + needs: build-linux + runs-on: ubuntu-latest + steps: + - name: Install Dependencies + shell: bash + run: | + sudo apt-get update + sudo apt-get install gperf build-essential bison flex libreadline-dev gawk tcl-dev libffi-dev git graphviz xdot pkg-config python3 libboost-system-dev libboost-python-dev libboost-filesystem-dev zlib1g-dev + + - name: Runtime environment shell: bash + env: + WORKSPACE: ${{ github.workspace }} run: | - make -j${{ env.procs }} test CXXSTD=${{ matrix.cpp_std }} CC=$CC CXX=$CC LD=$CC + echo "procs=$(nproc)" >> $GITHUB_ENV - - name: Log yosys-config output + - name: Download build artifact + uses: actions/download-artifact@v4 + with: + name: build-artifact + + - name: Uncompress build + shell: bash + run: + tar -xvf build.tar + + - name: Run tests + shell: bash run: | - ./yosys-config || true + make -j${{ env.procs }} test TARGETS= EXTRA_TARGETS= diff --git a/.github/workflows/test-macos.yml b/.github/workflows/test-macos.yml index cbba8adbd66..ed63c8f35b7 100644 --- a/.github/workflows/test-macos.yml +++ b/.github/workflows/test-macos.yml @@ -1,6 +1,12 @@ name: Build and run tests (macOS) -on: [push, pull_request] +on: + pull_request: + branches: + - master + push: + branches: + - master jobs: pre_job: @@ -27,7 +33,6 @@ jobs: - { id: macos-13, name: 'Ventura' } cpp_std: - 'c++11' - - 'c++17' fail-fast: false steps: - name: Install Dependencies From 7873fe791eb60436ba48104b6b6443754097459c Mon Sep 17 00:00:00 2001 From: Krystine Sherwin <93062060+KrystalDelusion@users.noreply.github.com> Date: Mon, 5 Feb 2024 21:50:41 +1300 Subject: [PATCH 02/38] Makefile: ignore missing docs e.g. when calling `make clean` out-of-tree --- Makefile | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 507d46f230d..f359ab76749 100644 --- a/Makefile +++ b/Makefile @@ -1022,7 +1022,9 @@ clean: rm -rf vloghtb/Makefile vloghtb/refdat vloghtb/rtl vloghtb/scripts vloghtb/spec vloghtb/check_yosys vloghtb/vloghammer_tb.tar.bz2 vloghtb/temp vloghtb/log_test_* rm -f tests/svinterfaces/*.log_stdout tests/svinterfaces/*.log_stderr tests/svinterfaces/dut_result.txt tests/svinterfaces/reference_result.txt tests/svinterfaces/a.out tests/svinterfaces/*_syn.v tests/svinterfaces/*.diff rm -f tests/tools/cmp_tbdata - $(MAKE) -C docs clean + -$(MAKE) -C docs clean + -$(MAKE) -C docs/images clean + rm -rf docs/source/cmd docs/util/__pycache__ clean-abc: $(MAKE) -C abc DEP= clean From 8e2dae21ad21e5cc87d7ecc8fc07871ce694aa92 Mon Sep 17 00:00:00 2001 From: Krystine Sherwin <93062060+KrystalDelusion@users.noreply.github.com> Date: Tue, 6 Feb 2024 10:30:37 +1300 Subject: [PATCH 03/38] ci: Checkout Yosys --- .github/workflows/test-linux.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/test-linux.yml b/.github/workflows/test-linux.yml index c4098edbeff..752d69a0694 100644 --- a/.github/workflows/test-linux.yml +++ b/.github/workflows/test-linux.yml @@ -173,6 +173,9 @@ jobs: run: | echo "procs=$(nproc)" >> $GITHUB_ENV + - name: Checkout Yosys + uses: actions/checkout@v4 + - name: Download build artifact uses: actions/download-artifact@v4 with: From 2bec6e3e0af83b0bdc5e4fa31f1bc7980a57e0db Mon Sep 17 00:00:00 2001 From: Krystine Sherwin <93062060+KrystalDelusion@users.noreply.github.com> Date: Tue, 6 Feb 2024 10:56:20 +1300 Subject: [PATCH 04/38] ci: Move iverilog from build to test --- .github/workflows/test-linux.yml | 58 ++++++++++++++++++-------------- 1 file changed, 33 insertions(+), 25 deletions(-) diff --git a/.github/workflows/test-linux.yml b/.github/workflows/test-linux.yml index 752d69a0694..e488c2f6c34 100644 --- a/.github/workflows/test-linux.yml +++ b/.github/workflows/test-linux.yml @@ -104,30 +104,6 @@ jobs: uses: actions/checkout@v4 with: submodules: true - - name: Get iverilog - shell: bash - run: | - git clone https://github.com/steveicarus/iverilog.git - cd iverilog - echo "IVERILOG_GIT=$(git rev-parse HEAD)" >> $GITHUB_ENV - - - name: Cache iverilog - id: cache-iverilog - uses: actions/cache@v4 - with: - path: .local/ - key: ${{ matrix.os.id }}-${{ env.IVERILOG_GIT }} - - - name: Build iverilog - if: steps.cache-iverilog.outputs.cache-hit != 'true' - shell: bash - run: | - mkdir -p $GITHUB_WORKSPACE/.local/ - cd iverilog - autoconf - CC=gcc CXX=g++ ./configure --prefix=$GITHUB_WORKSPACE/.local - make -j${{ env.procs }} - make install - name: Build yosys out-of-tree shell: bash @@ -158,7 +134,11 @@ jobs: test-linux: name: Run tests needs: build-linux - runs-on: ubuntu-latest + runs-on: ${{ matrix.os.id }} + strategy: + matrix: + os: + - { id: ubuntu-20.04, name: focal } steps: - name: Install Dependencies shell: bash @@ -171,11 +151,39 @@ jobs: env: WORKSPACE: ${{ github.workspace }} run: | + echo "GITHUB_WORKSPACE=`pwd`" >> $GITHUB_ENV + echo "$GITHUB_WORKSPACE/.local/bin" >> $GITHUB_PATH echo "procs=$(nproc)" >> $GITHUB_ENV - name: Checkout Yosys uses: actions/checkout@v4 + - name: Get iverilog + shell: bash + run: | + git clone https://github.com/steveicarus/iverilog.git + cd iverilog + git checkout 192b6aec96fde982e6ddcb28b346d5893aa8e874 + echo "IVERILOG_GIT=$(git rev-parse HEAD)" >> $GITHUB_ENV + + - name: Cache iverilog + id: cache-iverilog + uses: actions/cache@v4 + with: + path: .local/ + key: ${{ matrix.os.id }}-${{ env.IVERILOG_GIT }} + + - name: Build iverilog + if: steps.cache-iverilog.outputs.cache-hit != 'true' + shell: bash + run: | + mkdir -p $GITHUB_WORKSPACE/.local/ + cd iverilog + autoconf + CC=gcc CXX=g++ ./configure --prefix=$GITHUB_WORKSPACE/.local + make -j${{ env.procs }} + make install + - name: Download build artifact uses: actions/download-artifact@v4 with: From 1ef21efe3ff2cd6ead409803556c813c3f97d580 Mon Sep 17 00:00:00 2001 From: Krystine Sherwin <93062060+KrystalDelusion@users.noreply.github.com> Date: Tue, 6 Feb 2024 11:48:38 +1300 Subject: [PATCH 05/38] ci: working on test setup --- .github/workflows/test-linux.yml | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/.github/workflows/test-linux.yml b/.github/workflows/test-linux.yml index e488c2f6c34..fd875d4ae87 100644 --- a/.github/workflows/test-linux.yml +++ b/.github/workflows/test-linux.yml @@ -121,7 +121,7 @@ jobs: shell: bash run: | cd build - tar -cvf ../build.tar Makefile.conf share/ yosys yosys-* + tar -cvf ../build.tar share/ yosys yosys-* - name: Store build artifact if: (matrix.cpp_std == 'c++11') && (matrix.compiler == 'gcc-11') @@ -134,11 +134,12 @@ jobs: test-linux: name: Run tests needs: build-linux - runs-on: ${{ matrix.os.id }} + runs-on: ${{ matrix.os }} + env: + CC: clang strategy: matrix: - os: - - { id: ubuntu-20.04, name: focal } + os: [ubuntu-20.04] steps: - name: Install Dependencies shell: bash @@ -171,7 +172,7 @@ jobs: uses: actions/cache@v4 with: path: .local/ - key: ${{ matrix.os.id }}-${{ env.IVERILOG_GIT }} + key: ${{ matrix.os }}-${{ env.IVERILOG_GIT }} - name: Build iverilog if: steps.cache-iverilog.outputs.cache-hit != 'true' @@ -197,4 +198,4 @@ jobs: - name: Run tests shell: bash run: | - make -j${{ env.procs }} test TARGETS= EXTRA_TARGETS= + make -j$procs test TARGETS= EXTRA_TARGETS= CONFIG=$CC From 93bee0fc3b89f692a866d4bdf22dc98f6e9f1aba Mon Sep 17 00:00:00 2001 From: Krystine Sherwin <93062060+KrystalDelusion@users.noreply.github.com> Date: Tue, 6 Feb 2024 12:18:52 +1300 Subject: [PATCH 06/38] ci: more context var use Also reduce `${{}}` expansion in `run` blocks. --- .github/workflows/test-linux.yml | 27 +++++++++------------------ 1 file changed, 9 insertions(+), 18 deletions(-) diff --git a/.github/workflows/test-linux.yml b/.github/workflows/test-linux.yml index fd875d4ae87..17aa050558d 100644 --- a/.github/workflows/test-linux.yml +++ b/.github/workflows/test-linux.yml @@ -27,6 +27,9 @@ jobs: needs: pre_job if: needs.pre_job.outputs.should_skip != 'true' runs-on: ${{ matrix.os.id }} + env: + CC: ${{ matrix.compiler }} + CXXSTD: ${{ matrix.cpp_std }} strategy: matrix: os: @@ -63,11 +66,8 @@ jobs: sudo apt-add-repository ppa:ubuntu-toolchain-r/test sudo apt-get update sudo apt-get install $CC $CXX - echo "CC=$CC" >> $GITHUB_ENV echo "CXX=$CXX" >> $GITHUB_ENV echo "CXXFLAGS=-Wp,-D_GLIBCXX_ASSERTIONS" >> $GITHUB_ENV - env: - CC: ${{ matrix.compiler }} - name: Setup Clang if: startsWith(matrix.compiler, 'clang') @@ -80,18 +80,12 @@ jobs: sudo apt-get update CXX=${CC/#clang/clang++} sudo apt-get install $CC $CXX - echo "CC=$CC" >> $GITHUB_ENV echo "CXX=$CXX" >> $GITHUB_ENV - env: - CC: ${{ matrix.compiler }} - name: Runtime environment shell: bash - env: - WORKSPACE: ${{ github.workspace }} run: | - echo "GITHUB_WORKSPACE=`pwd`" >> $GITHUB_ENV - echo "$GITHUB_WORKSPACE/.local/bin" >> $GITHUB_PATH + echo "${{ github.workspace }}/.local/bin" >> $GITHUB_PATH echo "procs=$(nproc)" >> $GITHUB_ENV - name: Tool versions @@ -111,7 +105,7 @@ jobs: mkdir build cd build make -f ../Makefile config-${CC%%-*} - make -f ../Makefile -j${{ env.procs }} CXXSTD=${{ matrix.cpp_std }} CC=$CC CXX=$CC LD=$CC + make -f ../Makefile -j$procs CXXSTD=$CXXSTD CC=$CC CXX=$CC LD=$CC - name: Log yosys-config output run: | @@ -149,11 +143,8 @@ jobs: - name: Runtime environment shell: bash - env: - WORKSPACE: ${{ github.workspace }} run: | - echo "GITHUB_WORKSPACE=`pwd`" >> $GITHUB_ENV - echo "$GITHUB_WORKSPACE/.local/bin" >> $GITHUB_PATH + echo "${{ github.workspace }}/.local/bin" >> $GITHUB_PATH echo "procs=$(nproc)" >> $GITHUB_ENV - name: Checkout Yosys @@ -178,11 +169,11 @@ jobs: if: steps.cache-iverilog.outputs.cache-hit != 'true' shell: bash run: | - mkdir -p $GITHUB_WORKSPACE/.local/ + mkdir -p ${{ github.workspace }}/.local/ cd iverilog autoconf - CC=gcc CXX=g++ ./configure --prefix=$GITHUB_WORKSPACE/.local - make -j${{ env.procs }} + CC=gcc CXX=g++ ./configure --prefix=${{ github.workspace }}/.local + make -j$procs make install - name: Download build artifact From 5ceafea0eca31301f962f572c757f97674e968fb Mon Sep 17 00:00:00 2001 From: Krystine Sherwin <93062060+KrystalDelusion@users.noreply.github.com> Date: Tue, 6 Feb 2024 17:25:25 +1300 Subject: [PATCH 07/38] ci: Default clang build Switch build artifact to a default clang build. Testing with the build artifact locally, `make test` is failing with `/lib/x86_64-linux-gnu/libstdc++.so.6: version 'GLIBCXX_3.4.29' not found`. Using the gcc-11 build (might be?) installing GLIBCXX_3.4.29 but not linking it into the build. Rather than trying to get it to link, just use the pre-installed `clang` instead. --- .github/workflows/test-linux.yml | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/.github/workflows/test-linux.yml b/.github/workflows/test-linux.yml index 17aa050558d..489995615a3 100644 --- a/.github/workflows/test-linux.yml +++ b/.github/workflows/test-linux.yml @@ -29,12 +29,14 @@ jobs: runs-on: ${{ matrix.os.id }} env: CC: ${{ matrix.compiler }} + CXX: ${{ matrix.compiler }} CXXSTD: ${{ matrix.cpp_std }} strategy: matrix: os: - { id: ubuntu-20.04, name: focal } compiler: + - 'clang' - 'clang-12' - 'gcc-11' cpp_std: @@ -70,7 +72,7 @@ jobs: echo "CXXFLAGS=-Wp,-D_GLIBCXX_ASSERTIONS" >> $GITHUB_ENV - name: Setup Clang - if: startsWith(matrix.compiler, 'clang') + if: startsWith(matrix.compiler, 'clang') && (matrix.compiler != 'clang') shell: bash run: | wget https://apt.llvm.org/llvm-snapshot.gpg.key @@ -105,7 +107,7 @@ jobs: mkdir build cd build make -f ../Makefile config-${CC%%-*} - make -f ../Makefile -j$procs CXXSTD=$CXXSTD CC=$CC CXX=$CC LD=$CC + make -f ../Makefile -j$procs CXXSTD=$CXXSTD CC=$CC CXX=$CXX LD=$CC - name: Log yosys-config output run: | @@ -118,7 +120,7 @@ jobs: tar -cvf ../build.tar share/ yosys yosys-* - name: Store build artifact - if: (matrix.cpp_std == 'c++11') && (matrix.compiler == 'gcc-11') + if: (matrix.cpp_std == 'c++11') && (matrix.compiler == 'clang') uses: actions/upload-artifact@v4 with: name: build-artifact From e3f77ff11fc7b9cee3b9fad081c9312b89cdf4a5 Mon Sep 17 00:00:00 2001 From: Krystine Sherwin <93062060+KrystalDelusion@users.noreply.github.com> Date: Tue, 6 Feb 2024 17:56:15 +1300 Subject: [PATCH 08/38] ci: Add error reporting --- .github/workflows/test-linux.yml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.github/workflows/test-linux.yml b/.github/workflows/test-linux.yml index 489995615a3..c6088fd09f8 100644 --- a/.github/workflows/test-linux.yml +++ b/.github/workflows/test-linux.yml @@ -192,3 +192,9 @@ jobs: shell: bash run: | make -j$procs test TARGETS= EXTRA_TARGETS= CONFIG=$CC + + - name: Report errors + if: ${{ failure() }} + shell: bash + run: | + find tests/**/*.err -print -exec cat {} \; From aa470ccb4745452e45cb290ff5590f2f09424c5f Mon Sep 17 00:00:00 2001 From: Krystine Sherwin <93062060+KrystalDelusion@users.noreply.github.com> Date: Tue, 6 Feb 2024 18:31:53 +1300 Subject: [PATCH 09/38] ci: Unify test-*.yml Also rename `build-artifact` to use `matrix.os` for compatibility with testing across OS. --- .../{test-linux.yml => test-build.yml} | 53 +++++++--- .github/workflows/test-macos.yml | 97 ------------------- 2 files changed, 38 insertions(+), 112 deletions(-) rename .github/workflows/{test-linux.yml => test-build.yml} (80%) delete mode 100644 .github/workflows/test-macos.yml diff --git a/.github/workflows/test-linux.yml b/.github/workflows/test-build.yml similarity index 80% rename from .github/workflows/test-linux.yml rename to .github/workflows/test-build.yml index c6088fd09f8..ec132e7c192 100644 --- a/.github/workflows/test-linux.yml +++ b/.github/workflows/test-build.yml @@ -1,4 +1,4 @@ -name: Build and run tests (Linux) +name: Build and run tests on: pull_request: @@ -23,10 +23,10 @@ jobs: # only run on push *or* pull_request, not both concurrent_skipping: 'same_content_newer' - build-linux: + build-yosys: needs: pre_job if: needs.pre_job.outputs.should_skip != 'true' - runs-on: ${{ matrix.os.id }} + runs-on: ${{ matrix.os }} env: CC: ${{ matrix.compiler }} CXX: ${{ matrix.compiler }} @@ -34,9 +34,9 @@ jobs: strategy: matrix: os: - - { id: ubuntu-20.04, name: focal } + - ubuntu-20.04 + - macos-13 compiler: - - 'clang' - 'clang-12' - 'gcc-11' cpp_std: @@ -45,21 +45,34 @@ jobs: - 'c++17' - 'c++20' include: - # Limit the older compilers to C++11 mode - - os: { id: ubuntu-20.04, name: focal } + # Build for testing + - os: ubuntu-20.04 + compiler: 'clang' + cpp_std: 'c++11' + # Limited testing for older compilers + - os: ubuntu-20.04 compiler: 'clang-11' cpp_std: 'c++11' - - os: { id: ubuntu-20.04, name: focal } + - os: ubuntu-20.04 compiler: 'gcc-10' cpp_std: 'c++11' + # Add os_name + - os: ubuntu-20.04 + os_name: focal fail-fast: false steps: - - name: Install Dependencies + - name: Install Linux Dependencies + if: runner.os == 'Linux' shell: bash run: | sudo apt-get update sudo apt-get install gperf build-essential bison flex libreadline-dev gawk tcl-dev libffi-dev git graphviz xdot pkg-config python python3 libboost-system-dev libboost-python-dev libboost-filesystem-dev zlib1g-dev + - name: Install macOS Dependencies + if: runner.os == 'macOS' + run: | + brew install bison flex gawk libffi pkg-config bash + - name: Setup GCC if: startsWith(matrix.compiler, 'gcc') shell: bash @@ -78,18 +91,28 @@ jobs: wget https://apt.llvm.org/llvm-snapshot.gpg.key sudo apt-key add llvm-snapshot.gpg.key rm llvm-snapshot.gpg.key - sudo apt-add-repository "deb https://apt.llvm.org/${{ matrix.os.name }}/ llvm-toolchain-${{ matrix.os.name }} main" + sudo apt-add-repository "deb https://apt.llvm.org/${{ matrix.os_name }}/ llvm-toolchain-${{ matrix.os_name }} main" sudo apt-get update CXX=${CC/#clang/clang++} sudo apt-get install $CC $CXX echo "CXX=$CXX" >> $GITHUB_ENV - - name: Runtime environment + - name: Linux runtime environment + if: runner.os == 'Linux' shell: bash run: | echo "${{ github.workspace }}/.local/bin" >> $GITHUB_PATH echo "procs=$(nproc)" >> $GITHUB_ENV + - name: macOS runtime environment + if: runner.os == 'macOS' + shell: bash + run: | + echo "${{ github.workspace }}/.local/bin" >> $GITHUB_PATH + echo "$(brew --prefix bison)/bin" >> $GITHUB_PATH + echo "$(brew --prefix flex)/bin" >> $GITHUB_PATH + echo "procs=$(sysctl -n hw.ncpu)" >> $GITHUB_ENV + - name: Tool versions shell: bash run: | @@ -123,13 +146,13 @@ jobs: if: (matrix.cpp_std == 'c++11') && (matrix.compiler == 'clang') uses: actions/upload-artifact@v4 with: - name: build-artifact + name: build-${{ matrix.os }} path: build.tar retention-days: 1 - test-linux: + test-yosys: name: Run tests - needs: build-linux + needs: build-yosys runs-on: ${{ matrix.os }} env: CC: clang @@ -181,7 +204,7 @@ jobs: - name: Download build artifact uses: actions/download-artifact@v4 with: - name: build-artifact + name: build-${{ matrix.os }} - name: Uncompress build shell: bash diff --git a/.github/workflows/test-macos.yml b/.github/workflows/test-macos.yml deleted file mode 100644 index ed63c8f35b7..00000000000 --- a/.github/workflows/test-macos.yml +++ /dev/null @@ -1,97 +0,0 @@ -name: Build and run tests (macOS) - -on: - pull_request: - branches: - - master - push: - branches: - - master - -jobs: - pre_job: - runs-on: ubuntu-latest - outputs: - should_skip: ${{ steps.skip_check.outputs.should_skip }} - steps: - - id: skip_check - uses: fkirc/skip-duplicate-actions@v5 - with: - paths_ignore: '["**/README.md", "docs/**", "guidelines/**"]' - # cancel previous builds if a new commit is pushed - cancel_others: 'true' - # only run on push *or* pull_request, not both - concurrent_skipping: 'same_content_newer' - - test-macos: - needs: pre_job - if: needs.pre_job.outputs.should_skip != 'true' - runs-on: ${{ matrix.os.id }} - strategy: - matrix: - os: - - { id: macos-13, name: 'Ventura' } - cpp_std: - - 'c++11' - fail-fast: false - steps: - - name: Install Dependencies - run: | - HOMEBREW_NO_INSTALLED_DEPENDENTS_CHECK=1 brew install bison flex gawk libffi pkg-config bash - - - name: Runtime environment - shell: bash - env: - WORKSPACE: ${{ github.workspace }} - run: | - echo "GITHUB_WORKSPACE=`pwd`" >> $GITHUB_ENV - echo "$GITHUB_WORKSPACE/.local/bin" >> $GITHUB_PATH - echo "$(brew --prefix bison)/bin" >> $GITHUB_PATH - echo "$(brew --prefix flex)/bin" >> $GITHUB_PATH - echo "procs=$(sysctl -n hw.ncpu)" >> $GITHUB_ENV - - - name: Tool versions - shell: bash - run: | - cc --version - - - name: Checkout Yosys - uses: actions/checkout@v4 - with: - submodules: true - - name: Get iverilog - shell: bash - run: | - git clone https://github.com/steveicarus/iverilog.git - cd iverilog - echo "IVERILOG_GIT=$(git rev-parse HEAD)" >> $GITHUB_ENV - - - name: Cache iverilog - id: cache-iverilog - uses: actions/cache@v4 - with: - path: .local/ - key: ${{ matrix.os.id }}-${{ env.IVERILOG_GIT }} - - - name: Build iverilog - if: steps.cache-iverilog.outputs.cache-hit != 'true' - shell: bash - run: | - mkdir -p $GITHUB_WORKSPACE/.local/ - cd iverilog - autoconf - CC=gcc CXX=g++ ./configure --prefix=$GITHUB_WORKSPACE/.local/ - make -j${{ env.procs }} - make install - - - name: Build yosys - shell: bash - run: | - make config-clang - make -j${{ env.procs }} CXXSTD=${{ matrix.cpp_std }} CC=cc CXX=cc LD=cc - - - name: Run tests - if: matrix.cpp_std == 'c++11' - shell: bash - run: | - make -j${{ env.procs }} test CXXSTD=${{ matrix.cpp_std }} CC=cc CXX=cc LD=cc From f408b4de05775c5735742114641d302f87bcb989 Mon Sep 17 00:00:00 2001 From: Krystine Sherwin <93062060+KrystalDelusion@users.noreply.github.com> Date: Tue, 6 Feb 2024 18:56:11 +1300 Subject: [PATCH 10/38] ci: fix compiler setup `os_name` in include section needs to be explicit (putting it at the end doesn't apply to the extra jobs). Move macOS test to extra job instead of doing all gcc/clang (which isn't setup for mac anyway). Also adds name to build-yosys task. --- .github/workflows/test-build.yml | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/.github/workflows/test-build.yml b/.github/workflows/test-build.yml index ec132e7c192..20417479522 100644 --- a/.github/workflows/test-build.yml +++ b/.github/workflows/test-build.yml @@ -24,9 +24,10 @@ jobs: concurrent_skipping: 'same_content_newer' build-yosys: + name: Build Yosys + runs-on: ${{ matrix.os }} needs: pre_job if: needs.pre_job.outputs.should_skip != 'true' - runs-on: ${{ matrix.os }} env: CC: ${{ matrix.compiler }} CXX: ${{ matrix.compiler }} @@ -35,7 +36,6 @@ jobs: matrix: os: - ubuntu-20.04 - - macos-13 compiler: - 'clang-12' - 'gcc-11' @@ -45,20 +45,27 @@ jobs: - 'c++17' - 'c++20' include: + # Add os_name + - os: ubuntu-20.04 + os_name: focal # Build for testing - os: ubuntu-20.04 + os_name: focal + compiler: 'clang' + cpp_std: 'c++11' + # macOS build + - os: macos-13 compiler: 'clang' cpp_std: 'c++11' # Limited testing for older compilers - os: ubuntu-20.04 + os_name: focal compiler: 'clang-11' cpp_std: 'c++11' - os: ubuntu-20.04 + os_name: focal compiler: 'gcc-10' cpp_std: 'c++11' - # Add os_name - - os: ubuntu-20.04 - os_name: focal fail-fast: false steps: - name: Install Linux Dependencies From 8bc206928f9c1b269de4b0416fb8a0ee14235f37 Mon Sep 17 00:00:00 2001 From: Krystine Sherwin <93062060+KrystalDelusion@users.noreply.github.com> Date: Fri, 9 Feb 2024 05:43:10 +1300 Subject: [PATCH 11/38] ci: split test build from matrix Allow test suite to run if, for example, the C++20 builds are failing but C++11 are fine. --- .github/workflows/test-build.yml | 75 ++++++++++++++++++++++++++++---- 1 file changed, 67 insertions(+), 8 deletions(-) diff --git a/.github/workflows/test-build.yml b/.github/workflows/test-build.yml index 20417479522..853a2b12b46 100644 --- a/.github/workflows/test-build.yml +++ b/.github/workflows/test-build.yml @@ -23,8 +23,8 @@ jobs: # only run on push *or* pull_request, not both concurrent_skipping: 'same_content_newer' - build-yosys: - name: Build Yosys + test-builds: + name: Compiler testing runs-on: ${{ matrix.os }} needs: pre_job if: needs.pre_job.outputs.should_skip != 'true' @@ -48,11 +48,6 @@ jobs: # Add os_name - os: ubuntu-20.04 os_name: focal - # Build for testing - - os: ubuntu-20.04 - os_name: focal - compiler: 'clang' - cpp_std: 'c++11' # macOS build - os: macos-13 compiler: 'clang' @@ -131,7 +126,71 @@ jobs: with: submodules: true - - name: Build yosys out-of-tree + - name: Build + shell: bash + run: | + make config-${CC%%-*} + make -j$procs CXXSTD=$CXXSTD CC=$CC CXX=$CXX LD=$CC + + build-yosys: + name: Reusable Yosys build + runs-on: ${{ matrix.os }} + env: + CC: ${{ matrix.compiler }} + CXX: ${{ matrix.compiler }} + CXXSTD: ${{ matrix.cpp_std }} + strategy: + matrix: + os: + - ubuntu-20.04 + compiler: + - 'clang' + cpp_std: + - 'c++11' + include: + # Add os_name + - os: ubuntu-20.04 + os_name: focal + fail-fast: false + steps: + - name: Install Linux Dependencies + if: runner.os == 'Linux' + shell: bash + run: | + sudo apt-get update + sudo apt-get install gperf build-essential bison flex libreadline-dev gawk tcl-dev libffi-dev git graphviz xdot pkg-config python python3 libboost-system-dev libboost-python-dev libboost-filesystem-dev zlib1g-dev + + - name: Install macOS Dependencies + if: runner.os == 'macOS' + run: | + brew install bison flex gawk libffi pkg-config bash + + - name: Linux runtime environment + if: runner.os == 'Linux' + shell: bash + run: | + echo "${{ github.workspace }}/.local/bin" >> $GITHUB_PATH + echo "procs=$(nproc)" >> $GITHUB_ENV + + - name: macOS runtime environment + if: runner.os == 'macOS' + shell: bash + run: | + echo "${{ github.workspace }}/.local/bin" >> $GITHUB_PATH + echo "$(brew --prefix bison)/bin" >> $GITHUB_PATH + echo "$(brew --prefix flex)/bin" >> $GITHUB_PATH + echo "procs=$(sysctl -n hw.ncpu)" >> $GITHUB_ENV + + - name: Tool versions + shell: bash + run: | + $CC --version + $CXX --version + + - name: Checkout Yosys + uses: actions/checkout@v4 + + - name: Build shell: bash run: | mkdir build From 934822115417c7323c72f9b4b0d992dcd691c354 Mon Sep 17 00:00:00 2001 From: Krystine Sherwin <93062060+KrystalDelusion@users.noreply.github.com> Date: Sat, 10 Feb 2024 12:34:07 +1300 Subject: [PATCH 12/38] ci: simplify tests a bit Remove compiler and cpp_std from `build-yosys` matrix. Using `config-$CC` will instead fall back to default values. Drop `Tool versions` step and introduce `yosys-config` output instead. Rename `test-builds` to `test-compile`. --- .github/workflows/test-build.yml | 34 ++++++++++---------------------- 1 file changed, 10 insertions(+), 24 deletions(-) diff --git a/.github/workflows/test-build.yml b/.github/workflows/test-build.yml index 853a2b12b46..b27a37a8719 100644 --- a/.github/workflows/test-build.yml +++ b/.github/workflows/test-build.yml @@ -23,7 +23,7 @@ jobs: # only run on push *or* pull_request, not both concurrent_skipping: 'same_content_newer' - test-builds: + test-compile: name: Compiler testing runs-on: ${{ matrix.os }} needs: pre_job @@ -133,24 +133,13 @@ jobs: make -j$procs CXXSTD=$CXXSTD CC=$CC CXX=$CXX LD=$CC build-yosys: - name: Reusable Yosys build + name: Reusable build runs-on: ${{ matrix.os }} env: - CC: ${{ matrix.compiler }} - CXX: ${{ matrix.compiler }} - CXXSTD: ${{ matrix.cpp_std }} + CC: clang strategy: matrix: - os: - - ubuntu-20.04 - compiler: - - 'clang' - cpp_std: - - 'c++11' - include: - # Add os_name - - os: ubuntu-20.04 - os_name: focal + os: [ubuntu-20.04] fail-fast: false steps: - name: Install Linux Dependencies @@ -181,12 +170,6 @@ jobs: echo "$(brew --prefix flex)/bin" >> $GITHUB_PATH echo "procs=$(sysctl -n hw.ncpu)" >> $GITHUB_ENV - - name: Tool versions - shell: bash - run: | - $CC --version - $CXX --version - - name: Checkout Yosys uses: actions/checkout@v4 @@ -195,8 +178,12 @@ jobs: run: | mkdir build cd build - make -f ../Makefile config-${CC%%-*} - make -f ../Makefile -j$procs CXXSTD=$CXXSTD CC=$CC CXX=$CXX LD=$CC + make -f ../Makefile config-$CC + make -f ../Makefile -j$procs + + - name: Log yosys-config output + run: | + ./yosys-config || true - name: Log yosys-config output run: | @@ -209,7 +196,6 @@ jobs: tar -cvf ../build.tar share/ yosys yosys-* - name: Store build artifact - if: (matrix.cpp_std == 'c++11') && (matrix.compiler == 'clang') uses: actions/upload-artifact@v4 with: name: build-${{ matrix.os }} From c9c6b96ba92a50ae32515e1ffb76f1f18a7c78fe Mon Sep 17 00:00:00 2001 From: Krystine Sherwin <93062060+KrystalDelusion@users.noreply.github.com> Date: Thu, 15 Feb 2024 09:49:02 +1300 Subject: [PATCH 13/38] ci: add missing macOS build `test-macos.yml` included c++17 which was missing in `test-build.yml`. --- .github/workflows/test-build.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/workflows/test-build.yml b/.github/workflows/test-build.yml index b27a37a8719..7f581af277e 100644 --- a/.github/workflows/test-build.yml +++ b/.github/workflows/test-build.yml @@ -48,10 +48,13 @@ jobs: # Add os_name - os: ubuntu-20.04 os_name: focal - # macOS build + # macOS builds - os: macos-13 compiler: 'clang' cpp_std: 'c++11' + - os: macos-13 + compiler: 'clang' + cpp_std: 'c++17' # Limited testing for older compilers - os: ubuntu-20.04 os_name: focal From 154464e7ce79f46f5647b0e06e7cb226c756fec5 Mon Sep 17 00:00:00 2001 From: Krystine Sherwin <93062060+KrystalDelusion@users.noreply.github.com> Date: Thu, 15 Feb 2024 10:00:22 +1300 Subject: [PATCH 14/38] ci: add macos test build --- .github/workflows/test-build.yml | 26 +++++++++++++++++++++----- 1 file changed, 21 insertions(+), 5 deletions(-) diff --git a/.github/workflows/test-build.yml b/.github/workflows/test-build.yml index 7f581af277e..f223bde24d1 100644 --- a/.github/workflows/test-build.yml +++ b/.github/workflows/test-build.yml @@ -142,7 +142,7 @@ jobs: CC: clang strategy: matrix: - os: [ubuntu-20.04] + os: [ubuntu-20.04, macos-13] fail-fast: false steps: - name: Install Linux Dependencies @@ -213,20 +213,36 @@ jobs: CC: clang strategy: matrix: - os: [ubuntu-20.04] + os: [ubuntu-20.04, macos-13] steps: - - name: Install Dependencies + - name: Install Linux Dependencies + if: runner.os == 'Linux' shell: bash run: | sudo apt-get update - sudo apt-get install gperf build-essential bison flex libreadline-dev gawk tcl-dev libffi-dev git graphviz xdot pkg-config python3 libboost-system-dev libboost-python-dev libboost-filesystem-dev zlib1g-dev + sudo apt-get install gperf build-essential bison flex libreadline-dev gawk tcl-dev libffi-dev git graphviz xdot pkg-config python python3 libboost-system-dev libboost-python-dev libboost-filesystem-dev zlib1g-dev + + - name: Install macOS Dependencies + if: runner.os == 'macOS' + run: | + brew install bison flex gawk libffi pkg-config bash - - name: Runtime environment + - name: Linux runtime environment + if: runner.os == 'Linux' shell: bash run: | echo "${{ github.workspace }}/.local/bin" >> $GITHUB_PATH echo "procs=$(nproc)" >> $GITHUB_ENV + - name: macOS runtime environment + if: runner.os == 'macOS' + shell: bash + run: | + echo "${{ github.workspace }}/.local/bin" >> $GITHUB_PATH + echo "$(brew --prefix bison)/bin" >> $GITHUB_PATH + echo "$(brew --prefix flex)/bin" >> $GITHUB_PATH + echo "procs=$(sysctl -n hw.ncpu)" >> $GITHUB_ENV + - name: Checkout Yosys uses: actions/checkout@v4 From 326d802220acaf8102d967b49247d95153396d55 Mon Sep 17 00:00:00 2001 From: Krystine Sherwin <93062060+KrystalDelusion@users.noreply.github.com> Date: Thu, 15 Feb 2024 10:00:58 +1300 Subject: [PATCH 15/38] ci: split test-compile from test-build --- .github/workflows/test-build.yml | 114 +----------------------- .github/workflows/test-compile.yml | 137 +++++++++++++++++++++++++++++ 2 files changed, 139 insertions(+), 112 deletions(-) create mode 100644 .github/workflows/test-compile.yml diff --git a/.github/workflows/test-build.yml b/.github/workflows/test-build.yml index f223bde24d1..8ad44f0b550 100644 --- a/.github/workflows/test-build.yml +++ b/.github/workflows/test-build.yml @@ -23,121 +23,11 @@ jobs: # only run on push *or* pull_request, not both concurrent_skipping: 'same_content_newer' - test-compile: - name: Compiler testing - runs-on: ${{ matrix.os }} - needs: pre_job - if: needs.pre_job.outputs.should_skip != 'true' - env: - CC: ${{ matrix.compiler }} - CXX: ${{ matrix.compiler }} - CXXSTD: ${{ matrix.cpp_std }} - strategy: - matrix: - os: - - ubuntu-20.04 - compiler: - - 'clang-12' - - 'gcc-11' - cpp_std: - - 'c++11' - - 'c++14' - - 'c++17' - - 'c++20' - include: - # Add os_name - - os: ubuntu-20.04 - os_name: focal - # macOS builds - - os: macos-13 - compiler: 'clang' - cpp_std: 'c++11' - - os: macos-13 - compiler: 'clang' - cpp_std: 'c++17' - # Limited testing for older compilers - - os: ubuntu-20.04 - os_name: focal - compiler: 'clang-11' - cpp_std: 'c++11' - - os: ubuntu-20.04 - os_name: focal - compiler: 'gcc-10' - cpp_std: 'c++11' - fail-fast: false - steps: - - name: Install Linux Dependencies - if: runner.os == 'Linux' - shell: bash - run: | - sudo apt-get update - sudo apt-get install gperf build-essential bison flex libreadline-dev gawk tcl-dev libffi-dev git graphviz xdot pkg-config python python3 libboost-system-dev libboost-python-dev libboost-filesystem-dev zlib1g-dev - - - name: Install macOS Dependencies - if: runner.os == 'macOS' - run: | - brew install bison flex gawk libffi pkg-config bash - - - name: Setup GCC - if: startsWith(matrix.compiler, 'gcc') - shell: bash - run: | - CXX=${CC/#gcc/g++} - sudo apt-add-repository ppa:ubuntu-toolchain-r/test - sudo apt-get update - sudo apt-get install $CC $CXX - echo "CXX=$CXX" >> $GITHUB_ENV - echo "CXXFLAGS=-Wp,-D_GLIBCXX_ASSERTIONS" >> $GITHUB_ENV - - - name: Setup Clang - if: startsWith(matrix.compiler, 'clang') && (matrix.compiler != 'clang') - shell: bash - run: | - wget https://apt.llvm.org/llvm-snapshot.gpg.key - sudo apt-key add llvm-snapshot.gpg.key - rm llvm-snapshot.gpg.key - sudo apt-add-repository "deb https://apt.llvm.org/${{ matrix.os_name }}/ llvm-toolchain-${{ matrix.os_name }} main" - sudo apt-get update - CXX=${CC/#clang/clang++} - sudo apt-get install $CC $CXX - echo "CXX=$CXX" >> $GITHUB_ENV - - - name: Linux runtime environment - if: runner.os == 'Linux' - shell: bash - run: | - echo "${{ github.workspace }}/.local/bin" >> $GITHUB_PATH - echo "procs=$(nproc)" >> $GITHUB_ENV - - - name: macOS runtime environment - if: runner.os == 'macOS' - shell: bash - run: | - echo "${{ github.workspace }}/.local/bin" >> $GITHUB_PATH - echo "$(brew --prefix bison)/bin" >> $GITHUB_PATH - echo "$(brew --prefix flex)/bin" >> $GITHUB_PATH - echo "procs=$(sysctl -n hw.ncpu)" >> $GITHUB_ENV - - - name: Tool versions - shell: bash - run: | - $CC --version - $CXX --version - - - name: Checkout Yosys - uses: actions/checkout@v4 - with: - submodules: true - - - name: Build - shell: bash - run: | - make config-${CC%%-*} - make -j$procs CXXSTD=$CXXSTD CC=$CC CXX=$CXX LD=$CC - build-yosys: name: Reusable build runs-on: ${{ matrix.os }} + needs: pre_job + if: needs.pre_job.outputs.should_skip != 'true' env: CC: clang strategy: diff --git a/.github/workflows/test-compile.yml b/.github/workflows/test-compile.yml new file mode 100644 index 00000000000..5d1c0aca94b --- /dev/null +++ b/.github/workflows/test-compile.yml @@ -0,0 +1,137 @@ +name: Compiler testing + +on: + pull_request: + branches: + - master + push: + branches: + - master + +jobs: + pre_job: + runs-on: ubuntu-latest + outputs: + should_skip: ${{ steps.skip_check.outputs.should_skip }} + steps: + - id: skip_check + uses: fkirc/skip-duplicate-actions@v5 + with: + paths_ignore: '["**/README.md", "docs/**", "guidelines/**"]' + # cancel previous builds if a new commit is pushed + cancel_others: 'true' + # only run on push *or* pull_request, not both + concurrent_skipping: 'same_content_newer' + + test-compile: + runs-on: ${{ matrix.os }} + needs: pre_job + if: needs.pre_job.outputs.should_skip != 'true' + env: + CC: ${{ matrix.compiler }} + CXX: ${{ matrix.compiler }} + CXXSTD: ${{ matrix.cpp_std }} + strategy: + matrix: + os: + - ubuntu-20.04 + compiler: + - 'clang-12' + - 'gcc-11' + cpp_std: + - 'c++11' + - 'c++14' + - 'c++17' + - 'c++20' + include: + # Add os_name + - os: ubuntu-20.04 + os_name: focal + # macOS builds + - os: macos-13 + compiler: 'clang' + cpp_std: 'c++11' + - os: macos-13 + compiler: 'clang' + cpp_std: 'c++17' + # Limited testing for older compilers + - os: ubuntu-20.04 + os_name: focal + compiler: 'clang-11' + cpp_std: 'c++11' + - os: ubuntu-20.04 + os_name: focal + compiler: 'gcc-10' + cpp_std: 'c++11' + fail-fast: false + steps: + - name: Install Linux Dependencies + if: runner.os == 'Linux' + shell: bash + run: | + sudo apt-get update + sudo apt-get install gperf build-essential bison flex libreadline-dev gawk tcl-dev libffi-dev git graphviz xdot pkg-config python python3 libboost-system-dev libboost-python-dev libboost-filesystem-dev zlib1g-dev + + - name: Install macOS Dependencies + if: runner.os == 'macOS' + run: | + brew install bison flex gawk libffi pkg-config bash + + - name: Setup GCC + if: startsWith(matrix.compiler, 'gcc') + shell: bash + run: | + CXX=${CC/#gcc/g++} + sudo apt-add-repository ppa:ubuntu-toolchain-r/test + sudo apt-get update + sudo apt-get install $CC $CXX + echo "CXX=$CXX" >> $GITHUB_ENV + echo "CXXFLAGS=-Wp,-D_GLIBCXX_ASSERTIONS" >> $GITHUB_ENV + + - name: Setup Clang + if: startsWith(matrix.compiler, 'clang') && (matrix.compiler != 'clang') + shell: bash + run: | + wget https://apt.llvm.org/llvm-snapshot.gpg.key + sudo apt-key add llvm-snapshot.gpg.key + rm llvm-snapshot.gpg.key + sudo apt-add-repository "deb https://apt.llvm.org/${{ matrix.os_name }}/ llvm-toolchain-${{ matrix.os_name }} main" + sudo apt-get update + CXX=${CC/#clang/clang++} + sudo apt-get install $CC $CXX + echo "CXX=$CXX" >> $GITHUB_ENV + + - name: Linux runtime environment + if: runner.os == 'Linux' + shell: bash + run: | + echo "${{ github.workspace }}/.local/bin" >> $GITHUB_PATH + echo "procs=$(nproc)" >> $GITHUB_ENV + + - name: macOS runtime environment + if: runner.os == 'macOS' + shell: bash + run: | + echo "${{ github.workspace }}/.local/bin" >> $GITHUB_PATH + echo "$(brew --prefix bison)/bin" >> $GITHUB_PATH + echo "$(brew --prefix flex)/bin" >> $GITHUB_PATH + echo "procs=$(sysctl -n hw.ncpu)" >> $GITHUB_ENV + + - name: Tool versions + shell: bash + run: | + $CC --version + $CXX --version + + - name: Checkout Yosys + uses: actions/checkout@v4 + + - name: Build + shell: bash + run: | + make config-${CC%%-*} + make -j$procs CXXSTD=$CXXSTD CC=$CC CXX=$CXX LD=$CC + + - name: Log yosys-config output + run: | + ./yosys-config || true From 616848b773297ed8c37d94c0a5cf68c84b416284 Mon Sep 17 00:00:00 2001 From: Krystine Sherwin <93062060+KrystalDelusion@users.noreply.github.com> Date: Mon, 4 Mar 2024 11:37:25 +1300 Subject: [PATCH 16/38] ci: Use aminya/setup-cpp --- .github/workflows/test-compile.yml | 30 +++++------------------------- 1 file changed, 5 insertions(+), 25 deletions(-) diff --git a/.github/workflows/test-compile.yml b/.github/workflows/test-compile.yml index 5d1c0aca94b..b03af924346 100644 --- a/.github/workflows/test-compile.yml +++ b/.github/workflows/test-compile.yml @@ -28,9 +28,8 @@ jobs: needs: pre_job if: needs.pre_job.outputs.should_skip != 'true' env: - CC: ${{ matrix.compiler }} - CXX: ${{ matrix.compiler }} CXXSTD: ${{ matrix.cpp_std }} + CXXFLAGS: ${{ startsWith(matrix.compiler, 'gcc') && '-Wp,-D_GLIBCXX_ASSERTIONS' || ''}} strategy: matrix: os: @@ -77,29 +76,10 @@ jobs: run: | brew install bison flex gawk libffi pkg-config bash - - name: Setup GCC - if: startsWith(matrix.compiler, 'gcc') - shell: bash - run: | - CXX=${CC/#gcc/g++} - sudo apt-add-repository ppa:ubuntu-toolchain-r/test - sudo apt-get update - sudo apt-get install $CC $CXX - echo "CXX=$CXX" >> $GITHUB_ENV - echo "CXXFLAGS=-Wp,-D_GLIBCXX_ASSERTIONS" >> $GITHUB_ENV - - - name: Setup Clang - if: startsWith(matrix.compiler, 'clang') && (matrix.compiler != 'clang') - shell: bash - run: | - wget https://apt.llvm.org/llvm-snapshot.gpg.key - sudo apt-key add llvm-snapshot.gpg.key - rm llvm-snapshot.gpg.key - sudo apt-add-repository "deb https://apt.llvm.org/${{ matrix.os_name }}/ llvm-toolchain-${{ matrix.os_name }} main" - sudo apt-get update - CXX=${CC/#clang/clang++} - sudo apt-get install $CC $CXX - echo "CXX=$CXX" >> $GITHUB_ENV + - name: Setup Cpp + uses: aminya/setup-cpp@v1 + with: + compiler: ${{ matrix.compiler }} - name: Linux runtime environment if: runner.os == 'Linux' From 62440246ec2d9fdc16d9a9ae535087c3498fc273 Mon Sep 17 00:00:00 2001 From: Krystine Sherwin <93062060+KrystalDelusion@users.noreply.github.com> Date: Mon, 4 Mar 2024 12:00:51 +1300 Subject: [PATCH 17/38] ci: Add CC_SHORT env var New Setup Cpp step uses fully qualified paths for $CC and $CXX so ${CC%%-*} no longer works. Remove os_name since it's not needed anymore. --- .github/workflows/test-compile.yml | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/.github/workflows/test-compile.yml b/.github/workflows/test-compile.yml index b03af924346..9c25874bbcd 100644 --- a/.github/workflows/test-compile.yml +++ b/.github/workflows/test-compile.yml @@ -30,6 +30,7 @@ jobs: env: CXXSTD: ${{ matrix.cpp_std }} CXXFLAGS: ${{ startsWith(matrix.compiler, 'gcc') && '-Wp,-D_GLIBCXX_ASSERTIONS' || ''}} + CC_SHORT: ${{ startsWith(matrix.compiler, 'gcc') && 'gcc' || 'clang' }} strategy: matrix: os: @@ -43,9 +44,6 @@ jobs: - 'c++17' - 'c++20' include: - # Add os_name - - os: ubuntu-20.04 - os_name: focal # macOS builds - os: macos-13 compiler: 'clang' @@ -55,11 +53,9 @@ jobs: cpp_std: 'c++17' # Limited testing for older compilers - os: ubuntu-20.04 - os_name: focal compiler: 'clang-11' cpp_std: 'c++11' - os: ubuntu-20.04 - os_name: focal compiler: 'gcc-10' cpp_std: 'c++11' fail-fast: false @@ -109,8 +105,8 @@ jobs: - name: Build shell: bash run: | - make config-${CC%%-*} - make -j$procs CXXSTD=$CXXSTD CC=$CC CXX=$CXX LD=$CC + make config-$CC_SHORT + make -j$procs CXXSTD=$CXXSTD - name: Log yosys-config output run: | From d07323e7ddca262727c39750a8c5ec29fcbd59d1 Mon Sep 17 00:00:00 2001 From: Krystine Sherwin <93062060+KrystalDelusion@users.noreply.github.com> Date: Mon, 4 Mar 2024 13:10:50 +1300 Subject: [PATCH 18/38] ci: Add action for reusable build env setup --- .github/actions/setup-build-env/action.yml | 32 ++++++++++++ .github/workflows/test-build.yml | 58 ++-------------------- .github/workflows/test-compile.yml | 29 +---------- 3 files changed, 38 insertions(+), 81 deletions(-) create mode 100644 .github/actions/setup-build-env/action.yml diff --git a/.github/actions/setup-build-env/action.yml b/.github/actions/setup-build-env/action.yml new file mode 100644 index 00000000000..e1b550e5ca8 --- /dev/null +++ b/.github/actions/setup-build-env/action.yml @@ -0,0 +1,32 @@ +name: Build environment setup +description: Configure build env for Yosys builds +runs: + using: composite + steps: + - name: Install Linux Dependencies + if: runner.os == 'Linux' + shell: bash + run: | + sudo apt-get update + sudo apt-get install gperf build-essential bison flex libreadline-dev gawk tcl-dev libffi-dev git graphviz xdot pkg-config python python3 libboost-system-dev libboost-python-dev libboost-filesystem-dev zlib1g-dev + + - name: Install macOS Dependencies + if: runner.os == 'macOS' + run: | + brew install bison flex gawk libffi pkg-config bash + + - name: Linux runtime environment + if: runner.os == 'Linux' + shell: bash + run: | + echo "${{ github.workspace }}/.local/bin" >> $GITHUB_PATH + echo "procs=$(nproc)" >> $GITHUB_ENV + + - name: macOS runtime environment + if: runner.os == 'macOS' + shell: bash + run: | + echo "${{ github.workspace }}/.local/bin" >> $GITHUB_PATH + echo "$(brew --prefix bison)/bin" >> $GITHUB_PATH + echo "$(brew --prefix flex)/bin" >> $GITHUB_PATH + echo "procs=$(sysctl -n hw.ncpu)" >> $GITHUB_ENV \ No newline at end of file diff --git a/.github/workflows/test-build.yml b/.github/workflows/test-build.yml index 8ad44f0b550..37322883106 100644 --- a/.github/workflows/test-build.yml +++ b/.github/workflows/test-build.yml @@ -35,33 +35,8 @@ jobs: os: [ubuntu-20.04, macos-13] fail-fast: false steps: - - name: Install Linux Dependencies - if: runner.os == 'Linux' - shell: bash - run: | - sudo apt-get update - sudo apt-get install gperf build-essential bison flex libreadline-dev gawk tcl-dev libffi-dev git graphviz xdot pkg-config python python3 libboost-system-dev libboost-python-dev libboost-filesystem-dev zlib1g-dev - - - name: Install macOS Dependencies - if: runner.os == 'macOS' - run: | - brew install bison flex gawk libffi pkg-config bash - - - name: Linux runtime environment - if: runner.os == 'Linux' - shell: bash - run: | - echo "${{ github.workspace }}/.local/bin" >> $GITHUB_PATH - echo "procs=$(nproc)" >> $GITHUB_ENV - - - name: macOS runtime environment - if: runner.os == 'macOS' - shell: bash - run: | - echo "${{ github.workspace }}/.local/bin" >> $GITHUB_PATH - echo "$(brew --prefix bison)/bin" >> $GITHUB_PATH - echo "$(brew --prefix flex)/bin" >> $GITHUB_PATH - echo "procs=$(sysctl -n hw.ncpu)" >> $GITHUB_ENV + - name: Setup environment + uses: ./.github/actions/setup-build-env - name: Checkout Yosys uses: actions/checkout@v4 @@ -105,33 +80,8 @@ jobs: matrix: os: [ubuntu-20.04, macos-13] steps: - - name: Install Linux Dependencies - if: runner.os == 'Linux' - shell: bash - run: | - sudo apt-get update - sudo apt-get install gperf build-essential bison flex libreadline-dev gawk tcl-dev libffi-dev git graphviz xdot pkg-config python python3 libboost-system-dev libboost-python-dev libboost-filesystem-dev zlib1g-dev - - - name: Install macOS Dependencies - if: runner.os == 'macOS' - run: | - brew install bison flex gawk libffi pkg-config bash - - - name: Linux runtime environment - if: runner.os == 'Linux' - shell: bash - run: | - echo "${{ github.workspace }}/.local/bin" >> $GITHUB_PATH - echo "procs=$(nproc)" >> $GITHUB_ENV - - - name: macOS runtime environment - if: runner.os == 'macOS' - shell: bash - run: | - echo "${{ github.workspace }}/.local/bin" >> $GITHUB_PATH - echo "$(brew --prefix bison)/bin" >> $GITHUB_PATH - echo "$(brew --prefix flex)/bin" >> $GITHUB_PATH - echo "procs=$(sysctl -n hw.ncpu)" >> $GITHUB_ENV + - name: Setup environment + uses: ./.github/actions/setup-build-env - name: Checkout Yosys uses: actions/checkout@v4 diff --git a/.github/workflows/test-compile.yml b/.github/workflows/test-compile.yml index 9c25874bbcd..6a0b69c8bb3 100644 --- a/.github/workflows/test-compile.yml +++ b/.github/workflows/test-compile.yml @@ -60,39 +60,14 @@ jobs: cpp_std: 'c++11' fail-fast: false steps: - - name: Install Linux Dependencies - if: runner.os == 'Linux' - shell: bash - run: | - sudo apt-get update - sudo apt-get install gperf build-essential bison flex libreadline-dev gawk tcl-dev libffi-dev git graphviz xdot pkg-config python python3 libboost-system-dev libboost-python-dev libboost-filesystem-dev zlib1g-dev - - - name: Install macOS Dependencies - if: runner.os == 'macOS' - run: | - brew install bison flex gawk libffi pkg-config bash + - name: Setup environment + uses: ./.github/actions/setup-build-env - name: Setup Cpp uses: aminya/setup-cpp@v1 with: compiler: ${{ matrix.compiler }} - - name: Linux runtime environment - if: runner.os == 'Linux' - shell: bash - run: | - echo "${{ github.workspace }}/.local/bin" >> $GITHUB_PATH - echo "procs=$(nproc)" >> $GITHUB_ENV - - - name: macOS runtime environment - if: runner.os == 'macOS' - shell: bash - run: | - echo "${{ github.workspace }}/.local/bin" >> $GITHUB_PATH - echo "$(brew --prefix bison)/bin" >> $GITHUB_PATH - echo "$(brew --prefix flex)/bin" >> $GITHUB_PATH - echo "procs=$(sysctl -n hw.ncpu)" >> $GITHUB_ENV - - name: Tool versions shell: bash run: | From 3c65ddbea07a12e6f0d4cbcee4b18e9c6297913c Mon Sep 17 00:00:00 2001 From: Krystine Sherwin <93062060+KrystalDelusion@users.noreply.github.com> Date: Mon, 4 Mar 2024 13:12:45 +1300 Subject: [PATCH 19/38] ci: Checkout goes first --- .github/workflows/test-build.yml | 12 ++++++------ .github/workflows/test-compile.yml | 6 +++--- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/.github/workflows/test-build.yml b/.github/workflows/test-build.yml index 37322883106..cdc19b0e35a 100644 --- a/.github/workflows/test-build.yml +++ b/.github/workflows/test-build.yml @@ -35,12 +35,12 @@ jobs: os: [ubuntu-20.04, macos-13] fail-fast: false steps: - - name: Setup environment - uses: ./.github/actions/setup-build-env - - name: Checkout Yosys uses: actions/checkout@v4 + - name: Setup environment + uses: ./.github/actions/setup-build-env + - name: Build shell: bash run: | @@ -80,12 +80,12 @@ jobs: matrix: os: [ubuntu-20.04, macos-13] steps: - - name: Setup environment - uses: ./.github/actions/setup-build-env - - name: Checkout Yosys uses: actions/checkout@v4 + - name: Setup environment + uses: ./.github/actions/setup-build-env + - name: Get iverilog shell: bash run: | diff --git a/.github/workflows/test-compile.yml b/.github/workflows/test-compile.yml index 6a0b69c8bb3..c541b68ff30 100644 --- a/.github/workflows/test-compile.yml +++ b/.github/workflows/test-compile.yml @@ -60,6 +60,9 @@ jobs: cpp_std: 'c++11' fail-fast: false steps: + - name: Checkout Yosys + uses: actions/checkout@v4 + - name: Setup environment uses: ./.github/actions/setup-build-env @@ -74,9 +77,6 @@ jobs: $CC --version $CXX --version - - name: Checkout Yosys - uses: actions/checkout@v4 - - name: Build shell: bash run: | From 6451a6a0dc480a67bf681610577a76b4e6d58559 Mon Sep 17 00:00:00 2001 From: Krystine Sherwin <93062060+KrystalDelusion@users.noreply.github.com> Date: Mon, 4 Mar 2024 13:13:43 +1300 Subject: [PATCH 20/38] ci: Fix action.yml --- .github/actions/setup-build-env/action.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/actions/setup-build-env/action.yml b/.github/actions/setup-build-env/action.yml index e1b550e5ca8..f61d6565e51 100644 --- a/.github/actions/setup-build-env/action.yml +++ b/.github/actions/setup-build-env/action.yml @@ -12,6 +12,7 @@ runs: - name: Install macOS Dependencies if: runner.os == 'macOS' + shell: bash run: | brew install bison flex gawk libffi pkg-config bash From 112a5cfc6752c04f5fcec35c750df30b812c56d8 Mon Sep 17 00:00:00 2001 From: Krystine Sherwin <93062060+KrystalDelusion@users.noreply.github.com> Date: Thu, 21 Mar 2024 10:01:01 +1300 Subject: [PATCH 21/38] ci: Add testing for newer compilers --- .github/workflows/test-compile.yml | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/.github/workflows/test-compile.yml b/.github/workflows/test-compile.yml index c541b68ff30..5b0c716f0be 100644 --- a/.github/workflows/test-compile.yml +++ b/.github/workflows/test-compile.yml @@ -58,6 +58,28 @@ jobs: - os: ubuntu-20.04 compiler: 'gcc-10' cpp_std: 'c++11' + # Limited testing for newer compilers + - os: ubuntu-20.04 + compiler: 'clang-13' + cpp_std: 'c++11' + - os: ubuntu-20.04 + compiler: 'clang-14' + cpp_std: 'c++11' + - os: ubuntu-20.04 + compiler: 'clang-15' + cpp_std: 'c++11' + - os: ubuntu-20.04 + compiler: 'clang-16' + cpp_std: 'c++11' + - os: ubuntu-20.04 + compiler: 'clang-17' + cpp_std: 'c++11' + - os: ubuntu-20.04 + compiler: 'gcc-12' + cpp_std: 'c++11' + - os: ubuntu-20.04 + compiler: 'gcc-13' + cpp_std: 'c++11' fail-fast: false steps: - name: Checkout Yosys From 6f602e79d4abe113eff11d61d9072e18a4bf6733 Mon Sep 17 00:00:00 2001 From: Krystine Sherwin <93062060+KrystalDelusion@users.noreply.github.com> Date: Thu, 21 Mar 2024 11:02:18 +1300 Subject: [PATCH 22/38] docs: Debugging macro test fail Call yosys-config post build extraction for sanity check. Report absolute path for yosys exe if it can't be found. --- .github/workflows/test-build.yml | 43 +++++++++++++++++++++++++++++++- docs/tests/macro_commands.py | 7 +++--- 2 files changed, 46 insertions(+), 4 deletions(-) diff --git a/.github/workflows/test-build.yml b/.github/workflows/test-build.yml index cdc19b0e35a..605ce570da4 100644 --- a/.github/workflows/test-build.yml +++ b/.github/workflows/test-build.yml @@ -72,8 +72,9 @@ jobs: test-yosys: name: Run tests - needs: build-yosys runs-on: ${{ matrix.os }} + needs: [build-yosys, pre_job] + if: needs.pre_job.outputs.should_skip != 'true' env: CC: clang strategy: @@ -122,6 +123,10 @@ jobs: run: tar -xvf build.tar + - name: Log yosys-config output + run: | + ./yosys-config || true + - name: Run tests shell: bash run: | @@ -132,3 +137,39 @@ jobs: shell: bash run: | find tests/**/*.err -print -exec cat {} \; + + test-docs: + name: Run docs tests + runs-on: ${{ matrix.os }} + needs: [build-yosys, pre_job] + if: needs.pre_job.outputs.should_skip != 'true' + env: + CC: clang + strategy: + matrix: + os: [ubuntu-20.04, macos-13] + steps: + - name: Checkout Yosys + uses: actions/checkout@v4 + + - name: Setup environment + uses: ./.github/actions/setup-build-env + + - name: Download build artifact + uses: actions/download-artifact@v4 + with: + name: build-${{ matrix.os }} + + - name: Uncompress build + shell: bash + run: + tar -xvf build.tar + + - name: Log yosys-config output + run: | + ./yosys-config || true + + - name: Run tests + shell: bash + run: | + make -C docs test -j${{ env.procs }} diff --git a/docs/tests/macro_commands.py b/docs/tests/macro_commands.py index faf2baa530b..d879e4365b2 100755 --- a/docs/tests/macro_commands.py +++ b/docs/tests/macro_commands.py @@ -12,12 +12,13 @@ # expects __file__ = yosys/docs/tests/macro_commands.py TESTS_DIR = Path(__file__).parent ROOT_DIR = TESTS_DIR.parent.parent +logging.log(logging.INFO, f"Using {ROOT_DIR.absolute()} as root directory") THIS_FILE = (TESTS_DIR / "macro_commands.py").relative_to(ROOT_DIR) MACRO_SOURCE = TESTS_DIR.parent / "source" / "code_examples" / "macro_commands" -assert MACRO_SOURCE.exists(), f"can't find macro_commands in {MACRO_SOURCE}" +assert MACRO_SOURCE.exists(), f"can't find macro_commands in {MACRO_SOURCE.absolute()}" -YOSYS = TESTS_DIR.parent.parent / "yosys" -assert YOSYS.exists(), f"can't find yosys executable in {YOSYS}" +YOSYS = ROOT_DIR / "yosys" +assert YOSYS.exists(), f"can't find yosys executable in {YOSYS.absolute()}" raise_error = False # get all macro commands being used From 0720020226426838c8f670b8288b71284244ed16 Mon Sep 17 00:00:00 2001 From: Krystine Sherwin <93062060+KrystalDelusion@users.noreply.github.com> Date: Thu, 21 Mar 2024 11:04:24 +1300 Subject: [PATCH 23/38] ci: Drop gcc-12 Setup script unable to install gcc-12 under ubuntu-20.04. --- .github/workflows/test-compile.yml | 3 --- 1 file changed, 3 deletions(-) diff --git a/.github/workflows/test-compile.yml b/.github/workflows/test-compile.yml index 5b0c716f0be..ae48c618081 100644 --- a/.github/workflows/test-compile.yml +++ b/.github/workflows/test-compile.yml @@ -74,9 +74,6 @@ jobs: - os: ubuntu-20.04 compiler: 'clang-17' cpp_std: 'c++11' - - os: ubuntu-20.04 - compiler: 'gcc-12' - cpp_std: 'c++11' - os: ubuntu-20.04 compiler: 'gcc-13' cpp_std: 'c++11' From a4c3dcc5a0cc6a32dd4ac756a66394b41cc060f0 Mon Sep 17 00:00:00 2001 From: Krystine Sherwin <93062060+KrystalDelusion@users.noreply.github.com> Date: Fri, 22 Mar 2024 09:13:39 +1300 Subject: [PATCH 24/38] docs: Fix macro_commands Get absolute path for `TESTS_DIR` to work from `docs` directory or from `docs/tests` in addition to `yosys` directory. --- docs/tests/macro_commands.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/docs/tests/macro_commands.py b/docs/tests/macro_commands.py index d879e4365b2..7ceb092d867 100755 --- a/docs/tests/macro_commands.py +++ b/docs/tests/macro_commands.py @@ -10,15 +10,15 @@ logging.basicConfig(level=logging.INFO) # expects __file__ = yosys/docs/tests/macro_commands.py -TESTS_DIR = Path(__file__).parent +TESTS_DIR = Path(__file__).parent.absolute() ROOT_DIR = TESTS_DIR.parent.parent -logging.log(logging.INFO, f"Using {ROOT_DIR.absolute()} as root directory") +logging.log(logging.INFO, f"Using {ROOT_DIR} as root directory") THIS_FILE = (TESTS_DIR / "macro_commands.py").relative_to(ROOT_DIR) MACRO_SOURCE = TESTS_DIR.parent / "source" / "code_examples" / "macro_commands" -assert MACRO_SOURCE.exists(), f"can't find macro_commands in {MACRO_SOURCE.absolute()}" +assert MACRO_SOURCE.exists(), f"can't find macro_commands in {MACRO_SOURCE}" YOSYS = ROOT_DIR / "yosys" -assert YOSYS.exists(), f"can't find yosys executable in {YOSYS.absolute()}" +assert YOSYS.exists(), f"can't find yosys executable in {YOSYS}" raise_error = False # get all macro commands being used From 7fbf286b3f240fe82ca89a22f07497b5f92c6eaa Mon Sep 17 00:00:00 2001 From: Krystine Sherwin <93062060+KrystalDelusion@users.noreply.github.com> Date: Fri, 22 Mar 2024 09:16:43 +1300 Subject: [PATCH 25/38] ci: Update for main branch rename --- .github/workflows/test-build.yml | 4 ++-- .github/workflows/test-compile.yml | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/test-build.yml b/.github/workflows/test-build.yml index 605ce570da4..5a957e5bb70 100644 --- a/.github/workflows/test-build.yml +++ b/.github/workflows/test-build.yml @@ -3,10 +3,10 @@ name: Build and run tests on: pull_request: branches: - - master + - main push: branches: - - master + - main jobs: pre_job: diff --git a/.github/workflows/test-compile.yml b/.github/workflows/test-compile.yml index ae48c618081..88eaed90c35 100644 --- a/.github/workflows/test-compile.yml +++ b/.github/workflows/test-compile.yml @@ -3,10 +3,10 @@ name: Compiler testing on: pull_request: branches: - - master + - main push: branches: - - master + - main jobs: pre_job: From c89c5c34a0782d5cdcac37ed60c6b40be08921cc Mon Sep 17 00:00:00 2001 From: Krystine Sherwin <93062060+KrystalDelusion@users.noreply.github.com> Date: Fri, 22 Mar 2024 10:06:30 +1300 Subject: [PATCH 26/38] ci: Disable fail fast for test runs --- .github/workflows/test-build.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/test-build.yml b/.github/workflows/test-build.yml index 5a957e5bb70..2f078ae6974 100644 --- a/.github/workflows/test-build.yml +++ b/.github/workflows/test-build.yml @@ -80,6 +80,7 @@ jobs: strategy: matrix: os: [ubuntu-20.04, macos-13] + fail-fast: false steps: - name: Checkout Yosys uses: actions/checkout@v4 @@ -148,6 +149,7 @@ jobs: strategy: matrix: os: [ubuntu-20.04, macos-13] + fail-fast: false steps: - name: Checkout Yosys uses: actions/checkout@v4 From 7d8928af4b9488dca402ba90f7d2878c13151bc7 Mon Sep 17 00:00:00 2001 From: Krystine Sherwin <93062060+KrystalDelusion@users.noreply.github.com> Date: Fri, 22 Mar 2024 10:24:07 +1300 Subject: [PATCH 27/38] ci: Remove macOS from test-docs macOS fails due to missing gvpack, but trying to install graphviz triggers a Python update which breaks the macOS runner. --- .github/workflows/test-build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test-build.yml b/.github/workflows/test-build.yml index 2f078ae6974..beb98e60e35 100644 --- a/.github/workflows/test-build.yml +++ b/.github/workflows/test-build.yml @@ -148,7 +148,7 @@ jobs: CC: clang strategy: matrix: - os: [ubuntu-20.04, macos-13] + os: [ubuntu-20.04] fail-fast: false steps: - name: Checkout Yosys From 144d3c9601341730705920da7e5c73cc20a99d36 Mon Sep 17 00:00:00 2001 From: Krystine Sherwin <93062060+KrystalDelusion@users.noreply.github.com> Date: Thu, 25 Apr 2024 09:58:07 +1200 Subject: [PATCH 28/38] Add empty line to action.yml --- .github/actions/setup-build-env/action.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/actions/setup-build-env/action.yml b/.github/actions/setup-build-env/action.yml index f61d6565e51..56565ce89fd 100644 --- a/.github/actions/setup-build-env/action.yml +++ b/.github/actions/setup-build-env/action.yml @@ -30,4 +30,4 @@ runs: echo "${{ github.workspace }}/.local/bin" >> $GITHUB_PATH echo "$(brew --prefix bison)/bin" >> $GITHUB_PATH echo "$(brew --prefix flex)/bin" >> $GITHUB_PATH - echo "procs=$(sysctl -n hw.ncpu)" >> $GITHUB_ENV \ No newline at end of file + echo "procs=$(sysctl -n hw.ncpu)" >> $GITHUB_ENV From fc48c3a8719c413dd48aa122695166d506673173 Mon Sep 17 00:00:00 2001 From: Krystine Sherwin <93062060+KrystalDelusion@users.noreply.github.com> Date: Thu, 25 Apr 2024 10:41:28 +1200 Subject: [PATCH 29/38] ci: Update OS/compiler targets --- .github/workflows/test-compile.yml | 32 ++++++++++++++++++------------ 1 file changed, 19 insertions(+), 13 deletions(-) diff --git a/.github/workflows/test-compile.yml b/.github/workflows/test-compile.yml index 88eaed90c35..935167b629c 100644 --- a/.github/workflows/test-compile.yml +++ b/.github/workflows/test-compile.yml @@ -34,7 +34,7 @@ jobs: strategy: matrix: os: - - ubuntu-20.04 + - ubuntu-22.04 compiler: - 'clang-12' - 'gcc-11' @@ -45,36 +45,42 @@ jobs: - 'c++20' include: # macOS builds + - os: macos-latest + compiler: 'clang' + cpp_std: 'c++11' - os: macos-13 compiler: 'clang' cpp_std: 'c++11' - os: macos-13 compiler: 'clang' cpp_std: 'c++17' - # Limited testing for older compilers - - os: ubuntu-20.04 + # ubuntu-22.04 compilers + - os: ubuntu-22.04 compiler: 'clang-11' cpp_std: 'c++11' - - os: ubuntu-20.04 - compiler: 'gcc-10' - cpp_std: 'c++11' - # Limited testing for newer compilers - - os: ubuntu-20.04 + - os: ubuntu-22.04 compiler: 'clang-13' cpp_std: 'c++11' - - os: ubuntu-20.04 + # ubuntu-latest compilers + - os: ubuntu-latest compiler: 'clang-14' cpp_std: 'c++11' - - os: ubuntu-20.04 + - os: ubuntu-latest compiler: 'clang-15' cpp_std: 'c++11' - - os: ubuntu-20.04 + - os: ubuntu-latest compiler: 'clang-16' cpp_std: 'c++11' - - os: ubuntu-20.04 + - os: ubuntu-latest compiler: 'clang-17' cpp_std: 'c++11' - - os: ubuntu-20.04 + - os: ubuntu-latest + compiler: 'gcc-10' + cpp_std: 'c++11' + - os: ubuntu-latest + compiler: 'gcc-12' + cpp_std: 'c++11' + - os: ubuntu-latest compiler: 'gcc-13' cpp_std: 'c++11' fail-fast: false From 8fc7dcb5165ccc051fb3f838843fd3f50d076450 Mon Sep 17 00:00:00 2001 From: Krystine Sherwin <93062060+KrystalDelusion@users.noreply.github.com> Date: Thu, 25 Apr 2024 10:42:50 +1200 Subject: [PATCH 30/38] ci: Drop python2 --- .github/actions/setup-build-env/action.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/actions/setup-build-env/action.yml b/.github/actions/setup-build-env/action.yml index 56565ce89fd..d938d6b27ae 100644 --- a/.github/actions/setup-build-env/action.yml +++ b/.github/actions/setup-build-env/action.yml @@ -8,7 +8,7 @@ runs: shell: bash run: | sudo apt-get update - sudo apt-get install gperf build-essential bison flex libreadline-dev gawk tcl-dev libffi-dev git graphviz xdot pkg-config python python3 libboost-system-dev libboost-python-dev libboost-filesystem-dev zlib1g-dev + sudo apt-get install gperf build-essential bison flex libreadline-dev gawk tcl-dev libffi-dev git graphviz xdot pkg-config python3 libboost-system-dev libboost-python-dev libboost-filesystem-dev zlib1g-dev - name: Install macOS Dependencies if: runner.os == 'macOS' From eae7356c701d8419859e378bada12b6550d65262 Mon Sep 17 00:00:00 2001 From: Miodrag Milanovic Date: Thu, 25 Apr 2024 08:37:44 +0200 Subject: [PATCH 31/38] Cleanups and update of VS action --- .github/workflows/test-build.yml | 14 ++++---------- .github/workflows/test-compile.yml | 8 +------- .gitignore | 1 - 3 files changed, 5 insertions(+), 18 deletions(-) diff --git a/.github/workflows/test-build.yml b/.github/workflows/test-build.yml index beb98e60e35..703cb6bd70a 100644 --- a/.github/workflows/test-build.yml +++ b/.github/workflows/test-build.yml @@ -1,12 +1,6 @@ name: Build and run tests -on: - pull_request: - branches: - - main - push: - branches: - - main +on: [push, pull_request] jobs: pre_job: @@ -32,7 +26,7 @@ jobs: CC: clang strategy: matrix: - os: [ubuntu-20.04, macos-13] + os: [ubuntu-latest, macos-13] fail-fast: false steps: - name: Checkout Yosys @@ -79,7 +73,7 @@ jobs: CC: clang strategy: matrix: - os: [ubuntu-20.04, macos-13] + os: [ubuntu-latest, macos-13] fail-fast: false steps: - name: Checkout Yosys @@ -148,7 +142,7 @@ jobs: CC: clang strategy: matrix: - os: [ubuntu-20.04] + os: [ubuntu-latest] fail-fast: false steps: - name: Checkout Yosys diff --git a/.github/workflows/test-compile.yml b/.github/workflows/test-compile.yml index 935167b629c..6dd348102b5 100644 --- a/.github/workflows/test-compile.yml +++ b/.github/workflows/test-compile.yml @@ -1,12 +1,6 @@ name: Compiler testing -on: - pull_request: - branches: - - main - push: - branches: - - main +on: [push, pull_request] jobs: pre_job: diff --git a/.gitignore b/.gitignore index b4797d63884..6f3e521d62e 100644 --- a/.gitignore +++ b/.gitignore @@ -45,4 +45,3 @@ __pycache__ /tests/unit/bintest/ /tests/unit/objtest/ /tests/ystests -/build From 24b3690c255d8e23a0d422daf3c5dad20e645952 Mon Sep 17 00:00:00 2001 From: Krystine Sherwin <93062060+KrystalDelusion@users.noreply.github.com> Date: Tue, 30 Apr 2024 11:01:30 +1200 Subject: [PATCH 32/38] test-build: Use macos-latest (macOS 14, M1) --- .github/workflows/test-build.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test-build.yml b/.github/workflows/test-build.yml index 703cb6bd70a..c73aa995347 100644 --- a/.github/workflows/test-build.yml +++ b/.github/workflows/test-build.yml @@ -26,7 +26,7 @@ jobs: CC: clang strategy: matrix: - os: [ubuntu-latest, macos-13] + os: [ubuntu-latest, macos-latest] fail-fast: false steps: - name: Checkout Yosys @@ -73,7 +73,7 @@ jobs: CC: clang strategy: matrix: - os: [ubuntu-latest, macos-13] + os: [ubuntu-latest, macos-latest] fail-fast: false steps: - name: Checkout Yosys From 6908330005f8e1b08a5367fe25a82b2670c482d0 Mon Sep 17 00:00:00 2001 From: Krystine Sherwin <93062060+KrystalDelusion@users.noreply.github.com> Date: Tue, 30 Apr 2024 11:11:46 +1200 Subject: [PATCH 33/38] ci: Reduce number of jobs Limit compilers to oldest and newest. Oldest compilers test with minimum supported standard. Newest compilers test with minimum *and* maximum supported standard. --- .github/workflows/test-compile.yml | 66 ++++++++---------------------- Makefile | 6 +++ 2 files changed, 24 insertions(+), 48 deletions(-) diff --git a/.github/workflows/test-compile.yml b/.github/workflows/test-compile.yml index 6dd348102b5..6a9097ad33a 100644 --- a/.github/workflows/test-compile.yml +++ b/.github/workflows/test-compile.yml @@ -22,61 +22,26 @@ jobs: needs: pre_job if: needs.pre_job.outputs.should_skip != 'true' env: - CXXSTD: ${{ matrix.cpp_std }} CXXFLAGS: ${{ startsWith(matrix.compiler, 'gcc') && '-Wp,-D_GLIBCXX_ASSERTIONS' || ''}} CC_SHORT: ${{ startsWith(matrix.compiler, 'gcc') && 'gcc' || 'clang' }} strategy: matrix: os: - - ubuntu-22.04 + - ubuntu-latest compiler: - - 'clang-12' - - 'gcc-11' - cpp_std: - - 'c++11' - - 'c++14' - - 'c++17' - - 'c++20' + # oldest supported + - 'clang-14' + - 'gcc-10' + # newest + - 'clang' + - 'gcc' include: - # macOS builds - - os: macos-latest - compiler: 'clang' - cpp_std: 'c++11' - - os: macos-13 - compiler: 'clang' - cpp_std: 'c++11' + # macOS - os: macos-13 compiler: 'clang' - cpp_std: 'c++17' - # ubuntu-22.04 compilers + # oldest clang not available on ubuntu-latest - os: ubuntu-22.04 compiler: 'clang-11' - cpp_std: 'c++11' - - os: ubuntu-22.04 - compiler: 'clang-13' - cpp_std: 'c++11' - # ubuntu-latest compilers - - os: ubuntu-latest - compiler: 'clang-14' - cpp_std: 'c++11' - - os: ubuntu-latest - compiler: 'clang-15' - cpp_std: 'c++11' - - os: ubuntu-latest - compiler: 'clang-16' - cpp_std: 'c++11' - - os: ubuntu-latest - compiler: 'clang-17' - cpp_std: 'c++11' - - os: ubuntu-latest - compiler: 'gcc-10' - cpp_std: 'c++11' - - os: ubuntu-latest - compiler: 'gcc-12' - cpp_std: 'c++11' - - os: ubuntu-latest - compiler: 'gcc-13' - cpp_std: 'c++11' fail-fast: false steps: - name: Checkout Yosys @@ -96,12 +61,17 @@ jobs: $CC --version $CXX --version - - name: Build + # minimum standard + - name: Build C++11 shell: bash run: | make config-$CC_SHORT - make -j$procs CXXSTD=$CXXSTD + make -j$procs CXXSTD=c++11 compile-only - - name: Log yosys-config output + # maximum standard, only on newest compilers + - name: Build C++20 + if: ${{ matrix.compiler == 'clang' || matrix.compiler == 'gcc'}} + shell: bash run: | - ./yosys-config || true + make config-$CC_SHORT + make -j$procs CXXSTD=c++20 compile-only diff --git a/Makefile b/Makefile index f359ab76749..85391d47013 100644 --- a/Makefile +++ b/Makefile @@ -727,6 +727,12 @@ top-all: $(TARGETS) $(EXTRA_TARGETS) @echo " Build successful." @echo "" +.PHONY: compile-only +compile-only: $(OBJS) + @echo "" + @echo " Compile successful." + @echo "" + ifeq ($(CONFIG),emcc) yosys.js: $(filter-out yosysjs-$(YOSYS_VER).zip,$(EXTRA_TARGETS)) endif From 4d8ce13aa4d4e347b552b9e365238e83c6a14b3c Mon Sep 17 00:00:00 2001 From: Krystine Sherwin <93062060+KrystalDelusion@users.noreply.github.com> Date: Tue, 30 Apr 2024 11:18:42 +1200 Subject: [PATCH 34/38] compile-only: Include genfiles and extra_targets --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 85391d47013..8f427579d92 100644 --- a/Makefile +++ b/Makefile @@ -728,7 +728,7 @@ top-all: $(TARGETS) $(EXTRA_TARGETS) @echo "" .PHONY: compile-only -compile-only: $(OBJS) +compile-only: $(OBJS) $(GENFILES) $(EXTRA_TARGETS) @echo "" @echo " Compile successful." @echo "" From ff730f486a80d73f6502cb6b39ec7c25571a90e1 Mon Sep 17 00:00:00 2001 From: Krystine Sherwin <93062060+KrystalDelusion@users.noreply.github.com> Date: Tue, 30 Apr 2024 11:38:05 +1200 Subject: [PATCH 35/38] ci: Add autoconf to macos dependencies --- .github/actions/setup-build-env/action.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/actions/setup-build-env/action.yml b/.github/actions/setup-build-env/action.yml index d938d6b27ae..345b6db8ada 100644 --- a/.github/actions/setup-build-env/action.yml +++ b/.github/actions/setup-build-env/action.yml @@ -14,7 +14,7 @@ runs: if: runner.os == 'macOS' shell: bash run: | - brew install bison flex gawk libffi pkg-config bash + HOMEBREW_NO_INSTALLED_DEPENDENTS_CHECK=1 brew install bison flex gawk libffi pkg-config bash autoconf - name: Linux runtime environment if: runner.os == 'Linux' From 7905921bd0cdeafb714886aa13021e96b42ffff4 Mon Sep 17 00:00:00 2001 From: Krystine Sherwin <93062060+KrystalDelusion@users.noreply.github.com> Date: Fri, 10 May 2024 10:00:33 +1200 Subject: [PATCH 36/38] Remove test-docs.yml in favour of test-build --- .github/workflows/test-docs.yml | 58 --------------------------------- 1 file changed, 58 deletions(-) delete mode 100644 .github/workflows/test-docs.yml diff --git a/.github/workflows/test-docs.yml b/.github/workflows/test-docs.yml deleted file mode 100644 index 7b3906c52ca..00000000000 --- a/.github/workflows/test-docs.yml +++ /dev/null @@ -1,58 +0,0 @@ -name: Build and test doc code samples - -on: - pull_request: - branches: - - main - -jobs: - pre_job: - runs-on: ubuntu-latest - outputs: - should_skip: ${{ steps.skip_check.outputs.should_skip }} - steps: - - id: skip_check - uses: fkirc/skip-duplicate-actions@v5 - with: - # cancel previous builds if a new commit is pushed - cancel_others: 'true' - # only run on push *or* pull_request, not both - concurrent_skipping: 'same_content_newer' - - test-docs: - needs: pre_job - if: needs.pre_job.outputs.should_skip != 'true' - runs-on: ubuntu-latest - steps: - - name: Install Dependencies - shell: bash - run: | - sudo apt-get update - sudo apt-get install gperf build-essential bison flex libreadline-dev gawk tcl-dev libffi-dev git graphviz xdot pkg-config python3 libboost-system-dev libboost-python-dev libboost-filesystem-dev zlib1g-dev - - - name: Setup GCC - uses: Dup4/actions-setup-gcc@v1 - - - name: Runtime environment - shell: bash - env: - WORKSPACE: ${{ github.workspace }} - run: | - echo "GITHUB_WORKSPACE=`pwd`" >> $GITHUB_ENV - echo "$GITHUB_WORKSPACE/.local/bin" >> $GITHUB_PATH - echo "procs=$(nproc)" >> $GITHUB_ENV - - - name: Checkout Yosys - uses: actions/checkout@v4 - with: - submodules: true - - name: Build yosys - shell: bash - run: | - make config-gcc - make -j${{ env.procs }} - - - name: Run tests - shell: bash - run: | - make -C docs test -j${{ env.procs }} From c24a9063b6c5cb6591906ceed497b89b1f4ee36f Mon Sep 17 00:00:00 2001 From: Krystine Sherwin <93062060+KrystalDelusion@users.noreply.github.com> Date: Fri, 10 May 2024 10:15:03 +1200 Subject: [PATCH 37/38] Fix submodules --- .github/workflows/test-build.yml | 2 ++ .github/workflows/test-compile.yml | 2 ++ 2 files changed, 4 insertions(+) diff --git a/.github/workflows/test-build.yml b/.github/workflows/test-build.yml index c73aa995347..e13b96816ab 100644 --- a/.github/workflows/test-build.yml +++ b/.github/workflows/test-build.yml @@ -31,6 +31,8 @@ jobs: steps: - name: Checkout Yosys uses: actions/checkout@v4 + with: + submodules: true - name: Setup environment uses: ./.github/actions/setup-build-env diff --git a/.github/workflows/test-compile.yml b/.github/workflows/test-compile.yml index 6a9097ad33a..375ea7fc54a 100644 --- a/.github/workflows/test-compile.yml +++ b/.github/workflows/test-compile.yml @@ -46,6 +46,8 @@ jobs: steps: - name: Checkout Yosys uses: actions/checkout@v4 + with: + submodules: true - name: Setup environment uses: ./.github/actions/setup-build-env From 6dde8107c3214a917eb7f1c1683576fde4922840 Mon Sep 17 00:00:00 2001 From: Miodrag Milanovic Date: Fri, 10 May 2024 15:46:32 +0200 Subject: [PATCH 38/38] Remove checkout for specific iverilog git version --- .github/workflows/test-build.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/test-build.yml b/.github/workflows/test-build.yml index e13b96816ab..5966ec3afdf 100644 --- a/.github/workflows/test-build.yml +++ b/.github/workflows/test-build.yml @@ -89,7 +89,6 @@ jobs: run: | git clone https://github.com/steveicarus/iverilog.git cd iverilog - git checkout 192b6aec96fde982e6ddcb28b346d5893aa8e874 echo "IVERILOG_GIT=$(git rev-parse HEAD)" >> $GITHUB_ENV - name: Cache iverilog