From 7a44068cf06de80d2b1f0006ff31d3dbb1395375 Mon Sep 17 00:00:00 2001 From: per1234 Date: Sun, 20 Oct 2024 07:40:59 -0700 Subject: [PATCH] Don't upload multiple times to same artifact in "Compare Performance" workflow The "Compare Performance" GitHub Actions workflow is configured to time indexing runs at the tip ref, and then do the same for the base ref. The times are then compared to provide information regarding whether a proposed change would have a significant performance impact. This is done by using a job matrix in the GitHub Actions workflow to perform each of the runs in a parallel GitHub Actions workflow job. A GitHub Actions workflow artifact was used to transfer the files containing the data for each run between sequential jobs in the workflow. The "actions/upload-artifact" and "actions/download-artifact" actions are used for this purpose. Previously, a single artifact was used for the transfer of all the files, with each of the parallel jobs uploading its own generated files to that artifact. However, support for uploading multiple times to a single artifact was dropped in version 4.0.0 of the "actions/upload-artifact" action. So it is now necessary to use a dedicated artifact for each of the builds. These can be downloaded in aggregate by using the artifact name globbing and merging features which were introduced in version 4.1.0 of the "actions/download-artifact" action. --- .github/workflows/compare-performance.yml | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/.github/workflows/compare-performance.yml b/.github/workflows/compare-performance.yml index bce29fa9..81a212f5 100644 --- a/.github/workflows/compare-performance.yml +++ b/.github/workflows/compare-performance.yml @@ -1,7 +1,7 @@ name: Compare Performance env: - REPORTS_ARTIFACT_NAME: reports + REPORTS_ARTIFACT_PREFIX: reports- # See: https://docs.github.com/en/free-pro-team@latest/actions/reference/events-that-trigger-workflows on: @@ -85,16 +85,20 @@ jobs: matrix: data: # Use two copies of each job to catch job-specific anomalous durations. - - ref: ${{ github.ref }} # The tip of the branch selected in the workflow dispatch dialog's "Use workflow from" menu + - artifact-suffix: tip-run-1 + ref: ${{ github.ref }} # The tip of the branch selected in the workflow dispatch dialog's "Use workflow from" menu description: tip run 1 position: after - - ref: ${{ github.ref }} + - artifact-suffix: tip-run-2 + ref: ${{ github.ref }} description: tip run 2 position: after - - ref: ${{ needs.init.outputs.base-ref }} + - artifact-suffix: comparison-run-1 + ref: ${{ needs.init.outputs.base-ref }} description: comparison run 1 position: before - - ref: ${{ needs.init.outputs.base-ref }} + - artifact-suffix: comparison-run-2 + ref: ${{ needs.init.outputs.base-ref }} description: comparison run 2 position: before @@ -298,7 +302,7 @@ jobs: with: if-no-files-found: error path: ${{ env.REPORTS_PATH }} - name: ${{ env.REPORTS_ARTIFACT_NAME }} + name: ${{ env.REPORTS_ARTIFACT_PREFIX }}${{ matrix.data.ref }} results: needs: run @@ -312,8 +316,9 @@ jobs: - name: Download reports uses: actions/download-artifact@v4 with: - name: ${{ env.REPORTS_ARTIFACT_NAME }} + merge-multiple: true path: ${{ env.REPORTS_PATH }} + pattern: ${{ env.REPORTS_ARTIFACT_PREFIX }}* - name: Print results shell: python