From 4a245f9fed374e6406f33172135ce97ed89587b5 Mon Sep 17 00:00:00 2001 From: Mohamed Gaber Date: Tue, 30 Jun 2026 12:40:16 +0300 Subject: [PATCH 1/3] ci: cache build instead of using artifacts --- .github/workflows/release.yml | 15 -------- .github/workflows/test-build.yml | 63 ++++++++++++-------------------- 2 files changed, 23 insertions(+), 55 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 86ae739ae..96b48891a 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -55,11 +55,6 @@ jobs: python3 -m pip wheel . --wheel-dir /src/dist ' - - uses: actions/upload-artifact@v4 - with: - name: linux-musl-wheel - path: dist/*.whl - build-manylinux-wheel: runs-on: ubuntu-latest name: Build Linux amd64 wheel (manylinux2014, glibc 2.17+) @@ -121,11 +116,6 @@ jobs: done ' - - uses: actions/upload-artifact@v4 - with: - name: linux-manylinux-wheel - path: dist-manylinux/*.whl - build-macos-wheel: runs-on: macos-15 name: Build macOS arm64 wheel @@ -162,11 +152,6 @@ jobs: mkdir -p dist python3 -m pip wheel . --wheel-dir dist - - uses: actions/upload-artifact@v4 - with: - name: macos-wheel - path: dist/*.whl - release: # allow testing outside main branch if: github.ref_name == 'main' diff --git a/.github/workflows/test-build.yml b/.github/workflows/test-build.yml index 56e94328e..01a7e505c 100644 --- a/.github/workflows/test-build.yml +++ b/.github/workflows/test-build.yml @@ -90,7 +90,13 @@ jobs: key: test-build-${{ matrix.os }} save: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }} restore-keys: | - test-build-${{ matrix.os }}- + test-build-${{ matrix.os }} + + - name: Cache Build Directory + uses: actions/cache@v6 + with: + path: build + key: ${{ runner.os }}-build-${{ github.run_id }} - name: Build shell: bash @@ -104,19 +110,6 @@ jobs: run: | ./build/yosys-config || true - - name: Compress build - shell: bash - run: | - cd build - tar -cvf ../build.tar share/ yosys yosys-* - - - name: Store build artifact - uses: actions/upload-artifact@v7 - with: - name: build-${{ matrix.os }} - path: build.tar - retention-days: 1 - test-yosys: name: Run tests runs-on: ${{ matrix.os }} @@ -142,16 +135,12 @@ jobs: get-build-deps: true get-iverilog: true - - name: Download build artifact - uses: actions/download-artifact@v8 + - name: Restore Build Directory from Cache + uses: actions/cache@v6 with: - name: build-${{ matrix.os }} - - - name: Uncompress build - shell: bash - run: | - mkdir -p build - tar -xvf build.tar -C build + path: build + key: ${{ runner.os }}-build-${{ github.run_id }} + fail-on-cache-miss: true - name: Log yosys-config output run: | @@ -192,19 +181,17 @@ jobs: with: runs-on: ${{ matrix.os }} - - name: Download build artifact - uses: actions/download-artifact@v8 + - name: Restore Build Directory from Cache + uses: actions/cache@v6 with: - name: build-${{ matrix.os }} - - - name: Uncompress build - shell: bash - run: - tar -xvf build.tar + path: build + key: ${{ runner.os }}-build-${{ github.run_id }} + fail-on-cache-miss: true - name: test_cell shell: bash run: | + cd build ./yosys -p 'test_cell -n 20 -s 1 all' ./yosys -p 'test_cell -n 20 -s 1 -nosat -aigmap $pow $pmux' ./yosys -p 'test_cell -n 20 -s 1 -nosat -aigmap $eqx $nex $bweqx' @@ -233,16 +220,12 @@ jobs: get-build-deps: true get-docs-deps: true - - name: Download build artifact - uses: actions/download-artifact@v8 + - name: Restore Build Directory from Cache + uses: actions/cache@v6 with: - name: build-${{ matrix.os }} - - - name: Uncompress build - shell: bash - run: | - mkdir -p build - tar -xvf build.tar -C build + path: build + key: ${{ runner.os }}-build-${{ github.run_id }} + fail-on-cache-miss: true - name: Log yosys-config output run: | From 268ff490307a4b2f0c53881325ecf9fcdfb28eb5 Mon Sep 17 00:00:00 2001 From: Mohamed Gaber Date: Wed, 1 Jul 2026 21:06:52 +0300 Subject: [PATCH 2/3] ci: target different repo for release --- .github/workflows/release.yml | 108 +++++++++++++++++++++++++--------- 1 file changed, 80 insertions(+), 28 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 96b48891a..1e3beaa3f 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -22,6 +22,13 @@ jobs: persist-credentials: false ssh-key: ${{ secrets.SSH_PRIVATE_KEY }} + - name: Cache Dist Directory + uses: actions/cache@v6 + with: + path: dist-x86_64-musllinux + key: ${{ github.run_id }}-x86_64-musllinux-wheel + enableCrossOsArchive: true + - name: Build wheel in Alpine container run: | docker run --rm \ @@ -51,8 +58,8 @@ jobs: # Build the wheel via setup.py pip install --break-system-packages pybind11 cxxheaderparser - mkdir -p /src/dist - python3 -m pip wheel . --wheel-dir /src/dist + mkdir -p /src/dist-x86_64-musllinux + python3 -m pip wheel . --wheel-dir /src/dist-x86_64-musllinux ' build-manylinux-wheel: @@ -66,6 +73,13 @@ jobs: submodules: recursive ssh-key: ${{ secrets.SSH_PRIVATE_KEY }} + - name: Cache Dist Directory + uses: actions/cache@v6 + with: + path: dist-x86_64-manylinux + key: ${{ github.run_id }}-x86_64-manylinux-wheel + enableCrossOsArchive: true + - name: Build wheel in manylinux2014 container run: | docker run --rm \ @@ -105,14 +119,15 @@ jobs: make cd /src + WHEEL_DIR=/src/dist-x86_64-manylinux pip3 install --upgrade pip setuptools wheel pybind11 cxxheaderparser mkdir -p dist-manylinux - python3 -m pip wheel . --wheel-dir /src/dist-manylinux + python3 -m pip wheel . --wheel-dir $WHEEL_DIR # Tag wheel as manylinux2014 pip3 install auditwheel || true - for whl in /src/dist-manylinux/*.whl; do - auditwheel repair "$whl" --plat manylinux2014_x86_64 -w /src/dist-manylinux/ 2>/dev/null || true + for whl in $WHEEL_DIR/*.whl; do + auditwheel repair "$whl" --plat manylinux2014_x86_64 -w $WHEEL_DIR/ 2>/dev/null || true done ' @@ -145,44 +160,76 @@ jobs: cd verific/tclmain make + - name: Cache Dist Directory + uses: actions/cache@v6 + with: + path: dist-aarch64-macos + key: ${{ github.run_id }}-aarch64-macos-wheel + enableCrossOsArchive: true + - name: Build wheel run: | export PATH="$(brew --prefix bison)/bin:$(brew --prefix flex)/bin:$PATH" export MACOSX_DEPLOYMENT_TARGET=11.0 mkdir -p dist - python3 -m pip wheel . --wheel-dir dist + python3 -m pip wheel . --wheel-dir dist-aarch64-macos release: # allow testing outside main branch - if: github.ref_name == 'main' + # if: github.ref_name == 'main' runs-on: ubuntu-latest needs: [build-linux-wheel, build-manylinux-wheel, build-macos-wheel] name: Create GitHub releases steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v6 with: + ssh-key: ${{ secrets.SSH_PRIVATE_KEY }} fetch-depth: 0 - - - name: Download artifacts - uses: actions/download-artifact@v4 - with: - path: all-wheels - merge-multiple: true - - - name: Generate release notes - id: meta + - id: meta + name: Get repo metadata and clean up run: | SHORT_SHA=$(git rev-parse --short HEAD) FULL_SHA=$(git rev-parse HEAD) DATE=$(date -u +%Y-%m-%d) - echo "short_sha=$SHORT_SHA" >> "$GITHUB_OUTPUT" - echo "date=$DATE" >> "$GITHUB_OUTPUT" REPO_URL="${{ github.server_url }}/${{ github.repository }}" + echo "short_sha=$SHORT_SHA" >> "$GITHUB_OUTPUT" + echo "full_sha=$FULL_SHA" >> "$GITHUB_OUTPUT" + echo "date=$DATE" >> "$GITHUB_OUTPUT" + echo "url=$REPO_URL" >> "$GITHUB_OUTPUT" + rm -rf ./* ./.* + - uses: actions/checkout@v6 + with: + repository: silimate/yosys-wheels + ssh-key: ${{ secrets.SSH_PRIVATE_KEY }} + fetch-depth: 0 + - name: Restore dist from cache (x86_64-musllinux) + uses: actions/cache@v6 + with: + path: dist-x86_64-musllinux + key: ${{ github.run_id }}-x86_64-musllinux-wheel + enableCrossOsArchive: true + fail-on-cache-miss: true + - name: Restore dist from cache (x86_64-manylinux) + uses: actions/cache@v6 + with: + path: dist-x86_64-manylinux + key: ${{ github.run_id }}-x86_64-manylinux-wheel + enableCrossOsArchive: true + fail-on-cache-miss: true + - name: Restore dist from cache (aarch64-macos) + uses: actions/cache@v6 + with: + path: dist-aarch64-macos + key: ${{ github.run_id }}-aarch64-macos-wheel + enableCrossOsArchive: true + fail-on-cache-miss: true + - name: Update release notes + run: | printf '%s\n' \ - "Automated build from \`main\` @ [\`${SHORT_SHA}\`](${REPO_URL}/commit/${FULL_SHA})" \ + "Automated build from \`main\` @ [\`${{ steps.meta.outputs.short_sha }}\`](${{ steps.meta.outputs.repo_url }}/commit/${{ steps.meta.outputs.full_sha }})" \ "" \ - "**Built:** ${DATE}" \ + "**Built:** ${{ steps.meta.outputs.date }}" \ "" \ "### Assets" \ "| File | Platform |" \ @@ -196,17 +243,22 @@ jobs: "pip install pyosys-*.whl" \ "\`\`\`" \ > release_notes.md - + - name: Commit and push + run: | + git config user.name "github-actions[bot]" + git config user.email "github-actions[bot]@users.noreply.github.com" + git commit --all --message="Build for ${{ steps.meta.outputs.date }}-${{ steps.meta.outputs.short_sha }}" + git push - name: Create permanent release run: | TAG="build-${{ steps.meta.outputs.date }}-${{ steps.meta.outputs.short_sha }}" gh release create "$TAG" \ - all-wheels/*.whl \ - --target "${{ github.sha }}" \ + dist-*/*.whl \ + --target "$(git rev-parse HEAD)" \ --title "Build ${{ steps.meta.outputs.date }} (${{ steps.meta.outputs.short_sha }})" \ --notes-file release_notes.md env: - GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + GH_TOKEN: ${{ secrets.YOSYS_WHEELS_TOKEN }} - name: Update latest release run: | @@ -214,10 +266,10 @@ jobs: git push -f origin latest gh release delete latest --yes 2>/dev/null || true gh release create latest \ - all-wheels/*.whl \ - --target "${{ github.sha }}" \ + dist-*/*.whl \ + --target "$(git rev-parse HEAD)" \ --title "Latest Build (${{ steps.meta.outputs.date }})" \ --notes-file release_notes.md \ --prerelease env: - GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + GH_TOKEN: ${{ secrets.YOSYS_WHEELS_TOKEN }} From 56dd057ab47b627aa5d203482ac6a9cd94680299 Mon Sep 17 00:00:00 2001 From: Mohamed Gaber Date: Thu, 2 Jul 2026 18:56:25 +0300 Subject: [PATCH 3/3] test/ci fixes - fix incorrect repo_url output - fix parsing in test_splitnets to match new format - fix silimate-shell.nix referring to removed derivation --- .github/workflows/release.yml | 2 +- silimate-shell.nix | 1 - tests/various/test_splitnets.tcl | 4 ++-- 3 files changed, 3 insertions(+), 4 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 1e3beaa3f..bfd7140e9 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -196,7 +196,7 @@ jobs: echo "short_sha=$SHORT_SHA" >> "$GITHUB_OUTPUT" echo "full_sha=$FULL_SHA" >> "$GITHUB_OUTPUT" echo "date=$DATE" >> "$GITHUB_OUTPUT" - echo "url=$REPO_URL" >> "$GITHUB_OUTPUT" + echo "repo_url=$REPO_URL" >> "$GITHUB_OUTPUT" rm -rf ./* ./.* - uses: actions/checkout@v6 with: diff --git a/silimate-shell.nix b/silimate-shell.nix index beef60ae6..01ac4b657 100644 --- a/silimate-shell.nix +++ b/silimate-shell.nix @@ -29,7 +29,6 @@ pkgs.mkShell { iverilog # tests gtkwave # vcd2fst (python3.withPackages(ps: with ps; [pip wheel pybind11 cxxheaderparser])) - gnu-ar gtest ] ++ lib.optionals stdenv.isLinux [ elfutils # provides libdw.so (not to be confused with libdwarf.so) diff --git a/tests/various/test_splitnets.tcl b/tests/various/test_splitnets.tcl index 9cb2b4305..21b10641b 100644 --- a/tests/various/test_splitnets.tcl +++ b/tests/various/test_splitnets.tcl @@ -7,10 +7,10 @@ proc read_stats { file } { set ports 0 set nets 0 foreach line [split $result "\n"] { - if [regexp {Number of wires:[ \t]+([0-9]+)} $line tmp n] { + if [regexp {\s([0-9]+) wires} $line tmp n] { set nets [expr $nets + $n] } - if [regexp {Number of ports:[ \t]+([0-9]+)} $line tmp n] { + if [regexp {(\s[0-9]+) ports} $line tmp n] { set ports [expr $ports + $n] } }