--- # 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: RTLMeter on: workflow_dispatch: schedule: - cron: '0 2 * * *' # Daily, starting at 02:00 UTC pull_request: types: - opened - synchronize - reopened - labeled - unlabeled permissions: contents: read defaults: run: shell: bash concurrency: group: ${{ github.ref }} cancel-in-progress: ${{ github.event_name != 'schedule' }} jobs: start: name: Start # Only run scheduled jobs if explicitly enabled for that repo (e.g.: not on forks) # Only run pull request jobs if labelled as needing an RTLMeter run # Always run workflow dispatch jobs if: | (github.event_name == 'schedule' && vars.ENABLE_SCHEDULED_JOBS == 'true') || (github.event_name == 'pull_request' && contains(github.event.pull_request.labels.*.name, 'pr: rtlmeter')) || (github.event_name == 'workflow_dispatch') runs-on: ubuntu-24.04 steps: - name: Startup run: echo build-gcc: name: Build GCC needs: start uses: ./.github/workflows/reusable-rtlmeter-build.yml with: runs-on: ubuntu-24.04 cc: gcc build-clang: name: Build Clang needs: start uses: ./.github/workflows/reusable-rtlmeter-build.yml with: runs-on: ubuntu-24.04 cc: clang run-gcc: name: Run GCC | ${{ matrix.cases }} needs: build-gcc uses: ./.github/workflows/reusable-rtlmeter-run.yml with: runs-on: ubuntu-24.04 cc: gcc cases: ${{ matrix.cases }} run-name: "gcc" compileArgs: "" executeArgs: "" strategy: fail-fast: false max-parallel: ${{ github.event == 'schedule' && 2 || 7 }} matrix: cases: - "NVDLA:*" - "OpenPiton:1x1:*" - "OpenPiton:2x2:*" - "OpenPiton:4x4:*" - "OpenTitan:*" - "VeeR-EH1:asic*" - "VeeR-EH1:default*" - "VeeR-EH1:hiperf*" - "VeeR-EH2:asic*" - "VeeR-EH2:default*" - "VeeR-EH2:hiperf*" - "VeeR-EL2:asic*" - "VeeR-EL2:default*" - "VeeR-EL2:hiperf*" - "Vortex:mini:*" - "Vortex:sane:*" - "XiangShan:default-chisel3:* !*:linux" - "XiangShan:default-chisel6:* !*:linux" - "XiangShan:mini-chisel3:* !*:linux" - "XiangShan:mini-chisel6:* !*:linux" - "XuanTie-E902:*" - "XuanTie-E906:*" - "XuanTie-C906:*" - "XuanTie-C910:*" run-clang: name: Run Clang | ${{ matrix.cases }} needs: build-clang uses: ./.github/workflows/reusable-rtlmeter-run.yml with: runs-on: ubuntu-24.04 cc: clang cases: ${{ matrix.cases }} run-name: "clang --threads 4" compileArgs: "--threads 4" executeArgs: "" strategy: fail-fast: false max-parallel: ${{ github.event == 'schedule' && 2 || 7 }} matrix: cases: - "NVDLA:*" - "OpenPiton:1x1:*" - "OpenPiton:2x2:*" - "OpenPiton:4x4:*" - "OpenTitan:*" - "VeeR-EH1:asic*" - "VeeR-EH1:default*" - "VeeR-EH1:hiperf*" - "VeeR-EH2:asic*" - "VeeR-EH2:default*" - "VeeR-EH2:hiperf*" - "VeeR-EL2:asic*" - "VeeR-EL2:default*" - "VeeR-EL2:hiperf*" - "Vortex:mini:*" - "Vortex:sane:*" - "XiangShan:default-chisel3:* !*:linux" - "XiangShan:default-chisel6:* !*:linux" - "XiangShan:mini-chisel3:* !*:linux" - "XiangShan:mini-chisel6:* !*:linux" - "XuanTie-E902:*" - "XuanTie-E906:*" - "XuanTie-C906:*" - "XuanTie-C910:*" combine-results: name: Combine results needs: [run-gcc, run-clang] # Run if any of the dependencies have run, even if failed. # That is: do not run if all skipped, or the workflow was cancelled. if: ${{ (contains(needs.*.result, 'success') || contains(needs.*.result, 'failure')) && !cancelled() }} runs-on: ubuntu-24.04 steps: - name: Download all results uses: actions/download-artifact@v4 with: pattern: rtlmeter-results-* path: all-results-${{ github.run_id }} merge-multiple: true - name: Tar up all results into single archive run: | # Ensure combined result directory exists in case of no results mkdir -p all-results-${{ github.run_id }} ls -la all-results-${{ github.run_id }} # Tar up the results directory tar --posix -c -z -f all-results-${{ github.run_id }}.tar.gz all-results-${{ github.run_id }} - name: Upload combined results uses: actions/upload-artifact@v4 with: path: all-results-${{ github.run_id }}.tar.gz name: all-results overwrite: true retention-days: 30 publish-results: name: Publish results to verilator/verilator-rtlmeter-results needs: combine-results # Only run on scheduled builds on the main repository. We also restrict # the publishing to run only on the first run_attempt. This is required # to prevent multiple uploads the same day (if rerunning), as the # dashboard UI currently assumes there is only one data point per # calendar day. Results from reruns can be imported manually if needed. if: ${{ github.event_name == 'schedule' && github.repository == 'verilator/verilator' && github.run_attempt == 1 && contains(needs.*.result, 'success') && !cancelled() }} runs-on: ubuntu-24.04 steps: - name: Download combined results uses: actions/download-artifact@v4 with: name: all-results path: results - name: Extract combined results working-directory: results run: | tar xzfv all-results-${{ github.run_id }}.tar.gz ls -la # Pushing to verilator/verilator-rtlmeter-results requires elevated permissions - name: Generate access token id: generate-token uses: actions/create-github-app-token@v2.0.6 with: app-id: ${{ vars.RTLMETER_RESULTS_CI_APP_ID }} private-key: ${{ secrets.RTLMETER_RESULTS_CI_APP_PRIVATE_KEY }} owner: verilator repositories: verilator-rtlmeter-results permission-contents: write - name: Checkout verilator-rtlmeter-results uses: actions/checkout@v4 with: repository: "verilator/verilator-rtlmeter-results" token: ${{ steps.generate-token.outputs.token }} path: verilator-rtlmeter-results - name: Import results id: import-results working-directory: verilator-rtlmeter-results run: | for f in $(find ../results -name "*.json"); do \ echo "Importing $f"; \ ./bin/add-rtlmeter-result $f; \ done test -z "$(git status --porcelain)" || echo "valid=1" >> "$GITHUB_OUTPUT" - name: Push to verilator-rtlmeter-results if: ${{ steps.import-results.outputs.valid }} working-directory: verilator-rtlmeter-results run: | git config --global user.email "action@example.com" git config --global user.name "github action" git add . git commit -m "Verilator CI: Results of 'RTLMeter' workflow run #${{ github.run_number }}" git push origin # Create GitHub issue for failed schedueld jobs # This should always be the last job (we want an issue if anything breaks) create-issue: name: Create issue on failure needs: publish-results if: ${{ github.event_name == 'schedule' && github.repository == 'verilator/verilator' && github.run_attempt == 1 && failure() && !cancelled() }} runs-on: ubuntu-24.04 steps: # Creating issues requires elevated privilege - name: Generate access token id: generate-token uses: actions/create-github-app-token@v2.0.6 with: app-id: ${{ vars.RTLMETER_RESULTS_CI_APP_ID }} private-key: ${{ secrets.RTLMETER_RESULTS_CI_APP_PRIVATE_KEY }} owner: verilator repositories: verilator permission-issues: write - name: Create issue env: GH_TOKEN: ${{ steps.generate-token.outputs.token }} 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 gh issue --repo ${{ github.repository }} create \ --title "RTLMeter run #${{ github.run_number }} Failed" \ --body-file body.txt \ --label new \ --assignee gezalore,wsnyder