From 1e4ede08b60ba7cf511cfcf2fe1f0874fb1445f8 Mon Sep 17 00:00:00 2001 From: Wilson Snyder Date: Wed, 3 Sep 2025 06:32:10 -0400 Subject: [PATCH] CI: Put all OS builds into build-deploy workflow, add passed job (#6358) --- .../workflows/{build.yml => build-test.yml} | 126 +++++++++++++----- .github/workflows/coverage.yml | 2 +- .github/workflows/format.yml | 2 +- .github/workflows/msbuild.yml | 52 -------- .github/workflows/osx-build.yml | 53 -------- .github/workflows/reusable-lint-py.yml | 47 +++++++ .github/workflows/rtlmeter-pr-results.yml | 8 +- .github/workflows/rtlmeter.yml | 13 +- 8 files changed, 147 insertions(+), 156 deletions(-) rename .github/workflows/{build.yml => build-test.yml} (71%) delete mode 100644 .github/workflows/msbuild.yml delete mode 100644 .github/workflows/osx-build.yml create mode 100644 .github/workflows/reusable-lint-py.yml diff --git a/.github/workflows/build.yml b/.github/workflows/build-test.yml similarity index 71% rename from .github/workflows/build.yml rename to .github/workflows/build-test.yml index 73221e8c0..4fddcb839 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build-test.yml @@ -3,7 +3,7 @@ # This name is key to badges in README.rst, so we use the name build # SPDX-License-Identifier: LGPL-3.0-only OR Artistic-2.0 -name: build +name: build-test on: push: @@ -17,7 +17,6 @@ permissions: defaults: run: - shell: bash working-directory: repo concurrency: @@ -27,7 +26,7 @@ concurrency: jobs: build-2404-gcc: - name: Build + name: Build-Ubuntu uses: ./.github/workflows/reusable-build.yml with: os: ${{ matrix.os }} @@ -39,7 +38,7 @@ jobs: - {os: ubuntu-24.04, cc: gcc} build-2404-clang: - name: Build + name: Build-Ubuntu uses: ./.github/workflows/reusable-build.yml with: os: ${{ matrix.os }} @@ -51,7 +50,7 @@ jobs: - {os: ubuntu-24.04, cc: clang} build-2204-gcc: - name: Build + name: Build-Ubuntu uses: ./.github/workflows/reusable-build.yml with: os: ${{ matrix.os }} @@ -63,7 +62,7 @@ jobs: - {os: ubuntu-22.04, cc: gcc} build-2204-clang: - name: Build + name: Build-Ubuntu uses: ./.github/workflows/reusable-build.yml with: os: ${{ matrix.os }} @@ -74,6 +73,69 @@ jobs: include: - {os: ubuntu-22.04, cc: clang} + build-osx-gcc: + name: Build-OSX + uses: ./.github/workflows/reusable-build.yml + with: + os: ${{ matrix.os }} + os-name: osx + cc: ${{ matrix.cc }} + strategy: + fail-fast: false + matrix: + include: + - {os: macos-15, cc: gcc} + + build-osx-clang: + name: Build-OSX + uses: ./.github/workflows/reusable-build.yml + with: + os: ${{ matrix.os }} + os-name: osx + cc: ${{ matrix.cc }} + strategy: + fail-fast: false + matrix: + include: + - {os: macos-15, cc: clang} + + windows: + name: Build-Windows + runs-on: ${{ matrix.os }} + strategy: + fail-fast: false + matrix: + include: + - {os: windows-2025, cc: msvc} + env: + CI_OS_NAME: win + CI_COMMIT: ${{ github.sha }} + CCACHE_COMPRESS: 1 + CCACHE_DIR: ${{ github.workspace }}/.ccache + CCACHE_LIMIT_MULTIPLE: 0.95 + steps: + - uses: actions/checkout@v4 + with: + path: repo + - name: Cache $CCACHE_DIR + uses: actions/cache@v4 + with: + path: ${{ env.CCACHE_DIR }} + key: msbuild-msvc-cmake + - name: compile + env: + WIN_FLEX_BISON: ${{ github.workspace }}/.ccache + run: ./ci/ci-win-compile.ps1 + - name: test build + run: ./ci/ci-win-test.ps1 + - name: Zip up repository + run: Compress-Archive -LiteralPath install -DestinationPath verilator.zip + - name: Upload zip archive + uses: actions/upload-artifact@v4 + with: + path: ${{ github.workspace }}/repo/verilator.zip + name: verilator-win.zip + test-2404-gcc: name: Test | ${{ matrix.os }} | ${{ matrix.cc }} needs: build-2404-gcc @@ -163,34 +225,30 @@ jobs: - {os: ubuntu-22.04, cc: clang, reloc: 1, suite: vltmt-2} lint-py: - runs-on: ubuntu-22.04 name: Lint Python - env: - CI_OS_NAME: linux - CI_COMMIT: ${{ github.sha }} - CI_BUILD_STAGE_NAME: build - CI_RUNS_ON: ubuntu-22.04 - CCACHE_COMPRESS: 1 - CCACHE_DIR: ${{ github.workspace }}/.ccache - CCACHE_LIMIT_MULTIPLE: 0.95 - strategy: - fail-fast: false + uses: ./.github/workflows/reusable-lint-py.yml + + passed: + name: Test suite passed + if: always() + needs: + - build-2404-gcc + - build-2404-clang + - build-2204-gcc + - build-2204-clang + - build-osx-gcc + - build-osx-clang + - windows + - test-2404-gcc + - test-2404-clang + - test-2204-gcc + - test-2204-clang + - lint-py + + runs-on: ubuntu-22.04 + steps: - - name: Checkout - uses: actions/checkout@v4 + - name: Decide whether the needed jobs succeeded or failed + uses: re-actors/alls-green@release/v1 with: - path: repo - - - name: Install packages for build - run: ./ci/ci-install.bash - - # We use specific version numbers, otherwise a Python package - # update may add a warning and break our build - - name: Install packages for lint - run: sudo pip3 install pylint==3.0.2 ruff==0.1.3 clang sphinx sphinx_rtd_theme sphinxcontrib-spelling breathe ruff - - - name: Configure - run: autoconf && ./configure --enable-longtests --enable-ccwarn - - - name: Lint - run: make -k lint-py + jobs: ${{ toJSON(needs) }} diff --git a/.github/workflows/coverage.yml b/.github/workflows/coverage.yml index aaa990d00..b42d1ddfe 100644 --- a/.github/workflows/coverage.yml +++ b/.github/workflows/coverage.yml @@ -92,6 +92,6 @@ jobs: - name: Upload coverage data to Codecov env: CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} - run: | + run: |- find . -name '*.gcno' -exec rm {} \; ./ci/codecov -v upload-process -Z --sha ${{ github.sha }} -f nodist/obj_dir/coverage/app_total.info diff --git a/.github/workflows/format.yml b/.github/workflows/format.yml index aca23c017..345f4c2a5 100644 --- a/.github/workflows/format.yml +++ b/.github/workflows/format.yml @@ -38,7 +38,7 @@ jobs: make -j 2 format CLANGFORMAT=clang-format-18 && git status - name: Push - run: | + run: |- if [ -n "$(git status --porcelain)" ]; then git commit . -m "Apply 'make format'" && git push origin diff --git a/.github/workflows/msbuild.yml b/.github/workflows/msbuild.yml deleted file mode 100644 index b0c37e87f..000000000 --- a/.github/workflows/msbuild.yml +++ /dev/null @@ -1,52 +0,0 @@ ---- -# DESCRIPTION: Github actions config -# This name is key to badges in README.rst, so we use the name build -# SPDX-License-Identifier: LGPL-3.0-only OR Artistic-2.0 -# -name: msbuild -on: - push: - pull_request: - workflow_dispatch: - schedule: - - cron: 0 0 * * 0 # weekly -permissions: - contents: read -env: - CI_OS_NAME: win - CI_COMMIT: ${{ github.sha }} - CCACHE_COMPRESS: 1 - CCACHE_DIR: ${{ github.workspace }}/.ccache - CCACHE_LIMIT_MULTIPLE: 0.95 -defaults: - run: - working-directory: repo -concurrency: - group: ${{ github.workflow }}-${{ github.actor }}-${{ github.event_name == 'pull_request' && github.ref || github.run_id }} - cancel-in-progress: true -jobs: - windows: - name: run on windows - runs-on: windows-2025 - steps: - - uses: actions/checkout@v4 - with: - path: repo - - name: Cache $CCACHE_DIR - uses: actions/cache@v4 - with: - path: ${{ env.CCACHE_DIR }} - key: msbuild-msvc-cmake - - name: compile - env: - WIN_FLEX_BISON: ${{ github.workspace }}/.ccache - run: ./ci/ci-win-compile.ps1 - - name: test build - run: ./ci/ci-win-test.ps1 - - name: Zip up repository - run: Compress-Archive -LiteralPath install -DestinationPath verilator.zip - - name: Upload zip archive - uses: actions/upload-artifact@v4 - with: - path: ${{ github.workspace }}/repo/verilator.zip - name: verilator-win.zip diff --git a/.github/workflows/osx-build.yml b/.github/workflows/osx-build.yml deleted file mode 100644 index fabde38df..000000000 --- a/.github/workflows/osx-build.yml +++ /dev/null @@ -1,53 +0,0 @@ ---- -# DESCRIPTION: Github actions config -# This name is key to badges in README.rst, so we use the name build -# SPDX-License-Identifier: LGPL-3.0-only OR Artistic-2.0 -# -name: osx-build - -on: - push: - pull_request: - workflow_dispatch: - schedule: - - cron: 0 0 * * 0 # weekly - -permissions: - contents: read - -defaults: - run: - shell: bash - working-directory: repo - -concurrency: - group: ${{ github.workflow }}-${{ github.actor }}-${{ github.event_name == 'pull_request' && github.ref || github.run_id }} - cancel-in-progress: true - -jobs: - - build-osx-gcc: - name: Build - uses: ./.github/workflows/reusable-build.yml - with: - os: ${{ matrix.os }} - os-name: osx - cc: ${{ matrix.cc }} - strategy: - fail-fast: false - matrix: - include: - - {os: macos-15, cc: gcc} - - build-osx-clang: - name: Build - uses: ./.github/workflows/reusable-build.yml - with: - os: ${{ matrix.os }} - os-name: osx - cc: ${{ matrix.cc }} - strategy: - fail-fast: false - matrix: - include: - - {os: macos-15, cc: clang} diff --git a/.github/workflows/reusable-lint-py.yml b/.github/workflows/reusable-lint-py.yml new file mode 100644 index 000000000..83d505719 --- /dev/null +++ b/.github/workflows/reusable-lint-py.yml @@ -0,0 +1,47 @@ +--- +# DESCRIPTION: Github actions config +# SPDX-License-Identifier: LGPL-3.0-only OR Artistic-2.0 + +name: reusable-lint-py + +on: + workflow_call: + +env: + CI_OS_NAME: linux + CI_COMMIT: ${{ github.sha }} + CI_BUILD_STAGE_NAME: build + CI_RUNS_ON: ubuntu-22.04 + CCACHE_COMPRESS: 1 + CCACHE_DIR: ${{ github.workspace }}/.ccache + CCACHE_LIMIT_MULTIPLE: 0.95 + +defaults: + run: + shell: bash + working-directory: repo + +jobs: + + lint-py: + runs-on: ubuntu-22.04 + name: Sub-lint | Python + steps: + - name: Checkout + uses: actions/checkout@v4 + with: + path: repo + + - name: Install packages for build + run: ./ci/ci-install.bash + + # We use specific version numbers, otherwise a Python package + # update may add a warning and break our build + - name: Install packages for lint + run: sudo pip3 install pylint==3.0.2 ruff==0.1.3 clang sphinx sphinx_rtd_theme sphinxcontrib-spelling breathe ruff + + - name: Configure + run: autoconf && ./configure --enable-longtests --enable-ccwarn + + - name: Lint + run: make -k lint-py diff --git a/.github/workflows/rtlmeter-pr-results.yml b/.github/workflows/rtlmeter-pr-results.yml index f540d09ee..8d9750ddc 100644 --- a/.github/workflows/rtlmeter-pr-results.yml +++ b/.github/workflows/rtlmeter-pr-results.yml @@ -7,10 +7,8 @@ name: RTLMeter PR results on: workflow_run: - workflows: - - RTLMeter - types: - - completed + workflows: [RTLMeter] + types: [completed] jobs: publish: @@ -44,7 +42,7 @@ jobs: - name: Comment on PR env: GH_TOKEN: ${{ steps.generate-token.outputs.token }} - run: | + run: |- ls -la cat report.txt gh pr --repo ${{ github.repository }} comment $(cat pr-number.txt) --body-file report.txt diff --git a/.github/workflows/rtlmeter.yml b/.github/workflows/rtlmeter.yml index 4bc559285..187df7395 100644 --- a/.github/workflows/rtlmeter.yml +++ b/.github/workflows/rtlmeter.yml @@ -10,12 +10,7 @@ on: schedule: - cron: '0 2 * * *' # Daily, starting at 02:00 UTC pull_request: - types: - - opened - - synchronize - - reopened - - labeled - - unlabeled + types: [opened, synchronize, reopened, labeled, unlabeled] permissions: contents: read @@ -155,9 +150,7 @@ jobs: strategy: fail-fast: false matrix: - tag: - - gcc - - clang + tag: [gcc, clang] steps: - name: Checkout RTLMeter uses: actions/checkout@v4 @@ -357,7 +350,7 @@ jobs: - name: Create issue env: GH_TOKEN: ${{ steps.generate-token.outputs.token }} - run: | + run: |- echo "This issue was created automatically by the GitHub Actions CI due to the failure of a scheduled RTLMeter run." >> body.txt echo "" >> body.txt echo "Workflow status: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}" >> body.txt