diff --git a/.github/workflows/reusable-rtlmeter-run.yml b/.github/workflows/reusable-rtlmeter-run.yml index ba8d45199..259fe1042 100644 --- a/.github/workflows/reusable-rtlmeter-run.yml +++ b/.github/workflows/reusable-rtlmeter-run.yml @@ -7,6 +7,10 @@ name: reusable-rtlmeter-run on: workflow_call: inputs: + tag: + description: "Unique identifier for storing results" + type: string + required: true runs-on: description: "Runner to use, e.g.: ubuntu-24.04" type: string @@ -113,7 +117,7 @@ jobs: uses: actions/upload-artifact@v4 with: path: results-${{ steps.results.outputs.hash }}.json - name: rtlmeter-results-${{ steps.results.outputs.hash }} + name: rtlmeter-results-${{ inputs.tag }}-${{ steps.results.outputs.hash }} overwrite: true retention-days: 2 diff --git a/.github/workflows/rtlmeter.yml b/.github/workflows/rtlmeter.yml index f7135084d..d60bfeb1b 100644 --- a/.github/workflows/rtlmeter.yml +++ b/.github/workflows/rtlmeter.yml @@ -66,6 +66,7 @@ jobs: needs: build-gcc uses: ./.github/workflows/reusable-rtlmeter-run.yml with: + tag: gcc runs-on: ubuntu-24.04 cc: gcc cases: ${{ matrix.cases }} @@ -107,6 +108,7 @@ jobs: needs: build-clang uses: ./.github/workflows/reusable-rtlmeter-run.yml with: + tag: clang runs-on: ubuntu-24.04 cc: clang cases: ${{ matrix.cases }} @@ -150,29 +152,40 @@ jobs: # 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 + strategy: + fail-fast: false + matrix: + tag: + - gcc + - clang steps: + - name: Checkout RTLMeter + uses: actions/checkout@v4 + with: + repository: "verilator/rtlmeter" + path: rtlmeter + - name: Setup RTLMeter venv + working-directory: rtlmeter + run: make venv - name: Download all results uses: actions/download-artifact@v4 with: - pattern: rtlmeter-results-* - path: all-results-${{ github.run_id }} + pattern: rtlmeter-results-${{ matrix.tag }}-* + path: all-results-${{ matrix.tag }} merge-multiple: true - - name: Tar up all results into single archive + - name: Combine results + working-directory: rtlmeter 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 }} + ./rtlmeter collate ../all-results-${{ matrix.tag }}/*.json > ../all-results-${{ matrix.tag }}.json - name: Upload combined results uses: actions/upload-artifact@v4 with: - path: all-results-${{ github.run_id }}.tar.gz - name: all-results + path: all-results-${{ matrix.tag }}.json + name: all-results-${{ matrix.tag }} overwrite: true retention-days: 30 - publish-results: + publish-scheduled-results: name: Publish results to verilator/verilator-rtlmeter-results needs: combine-results # Only run on scheduled builds on the main repository. We also restrict @@ -186,20 +199,21 @@ jobs: - name: Download combined results uses: actions/download-artifact@v4 with: - name: all-results + pattern: all-results-* path: results - - name: Extract combined results - working-directory: results - run: | - tar xzfv all-results-${{ github.run_id }}.tar.gz - ls -la + merge-multiple: true + - name: Upload published results + uses: actions/upload-artifact@v4 + with: + path: results/*.json + name: published-results # 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 }} + app-id: ${{ vars.VERILATOR_CI_ID }} + private-key: ${{ secrets.VERILATOR_CI_KEY }} owner: verilator repositories: verilator-rtlmeter-results permission-contents: write @@ -228,11 +242,59 @@ jobs: git commit -m "Verilator CI: Results of 'RTLMeter' workflow run #${{ github.run_number }}" git push origin + #publish-pr-results: + # name: Publish results to Pull Request + # needs: combine-results + # if: ${{ github.event_name == 'pull_request' && github.repository == 'verilator/verilator' && github.run_attempt == 1 && contains(needs.*.result, 'success') && !cancelled() }} + # runs-on: ubuntu-24.04 + # steps: + # - name: Checkout RTLMeter + # uses: actions/checkout@v4 + # with: + # repository: "verilator/rtlmeter" + # path: rtlmeter + # - name: Setup RTLMeter venv + # working-directory: rtlmeter + # run: make venv + # - name: Download combined results + # uses: actions/download-artifact@v4 + # with: + # pattern: all-results-* + # path: all-results + # merge-multiple: true + # - name: Get scheduled run info + # id: scheduled-info + # run: + # IDLATEST=$(gh run list --workflow RTLMeter --event schedule --status success --limit 1 --json databaseId --jq ".[0].databaseId") + # echo "id=$IDLATEST" >> $GITHUB_OUTPUT + # URL=$(gh run view $IDLATEST --json url --jq ".url") + # echo "url=$URL" >> $GITHUB_OUTPUT + # NUM=$(gh run view $IDLATEST --json number --jq ".number") + # echo "num=$NUM" >> $GITHUB_OUTPUT + # # Fetching artifacts from different workflow requires elevated privilege + # - name: Generate access token + # id: generate-token + # uses: actions/create-github-app-token@v2.0.6 + # with: + # app-id: ${{ vars.VERILATOR_CI_ID }} + # private-key: ${{ secrets.VERILATOR_CI_KEY }} + # owner: verilator + # repositories: verilator + # permission-actions: read + # - name: Download scheduled run results + # uses: actions/download-artifact@v4 + # with: + # name: published-results + # path: nightly-results + # run-id: ${{ steps.schedueld-info.outputs.id }} + # github-token: ${{ steps.generate-token.outputs.token }} + # # TODO: diff and present + # 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 + needs: publish-scheduled-results if: ${{ github.event_name == 'schedule' && github.repository == 'verilator/verilator' && github.run_attempt == 1 && failure() && !cancelled() }} runs-on: ubuntu-24.04 steps: @@ -241,8 +303,8 @@ jobs: 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 }} + app-id: ${{ vars.VERILATOR_CI_ID }} + private-key: ${{ secrets.VERILATOR_CI_KEY }} owner: verilator repositories: verilator permission-issues: write