From 2c98f3a3fa37528cfa45b5ad700d53e6fff3a89a Mon Sep 17 00:00:00 2001 From: Jan Kowalleck Date: Thu, 2 May 2024 12:48:09 +0200 Subject: [PATCH] ci: modernize artifact action (#1178) supersedes #1141 supersedes #1140 --------- Signed-off-by: dependabot[bot] Signed-off-by: Jan Kowalleck Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .github/workflows/nodejs.yml | 28 ++++++++++++----------- .github/workflows/npm-ls_demo-results.yml | 12 +++++----- .github/workflows/release.yml | 4 ++-- 3 files changed, 23 insertions(+), 21 deletions(-) diff --git a/.github/workflows/nodejs.yml b/.github/workflows/nodejs.yml index df361d10..2fe35a9a 100644 --- a/.github/workflows/nodejs.yml +++ b/.github/workflows/nodejs.yml @@ -14,7 +14,7 @@ on: - cron: '42 23 * * 5' concurrency: - group: ${{ github.workflow }}-${{ github.ref }} + group: '${{ github.workflow }}-${{ github.ref }}' cancel-in-progress: true env: @@ -45,7 +45,7 @@ jobs: run: npm run build - name: artifact build result # see https://github.com/actions/upload-artifact - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: name: ${{ env.DIST_DIR }} path: ${{ env.DIST_DIR }} @@ -129,7 +129,7 @@ jobs: npm i --ignore-scripts --loglevel=silly --no-save $dev_requirements - name: fetch build artifact # see https://github.com/actions/download-artifact - uses: actions/download-artifact@v3 + uses: actions/download-artifact@v4 with: name: ${{ env.DIST_DIR }} path: ${{ env.DIST_DIR }} @@ -143,21 +143,21 @@ jobs: --coverage --coverageDirectory='${{ env.REPORTS_DIR }}/node${{ matrix.node-version }}_${{ matrix.os }}/coverage' env: - JEST_JUNIT_OUTPUT_DIR: ${{ env.REPORTS_DIR }}/node${{ matrix.node-version }}_${{ matrix.os }} + JEST_JUNIT_OUTPUT_DIR: '${{ env.REPORTS_DIR }}/node${{ matrix.node-version }}_${{ matrix.os }}' - name: artifact test logs if: ${{ failure() }} # see https://github.com/actions/upload-artifact - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: - name: logs-jest_node${{ matrix.node-version }}-${{ matrix.os }} + name: logs-jest_node${{ matrix.node-version }}_${{ matrix.os }} path: tests/_log if-no-files-found: error - name: artifact test reports if: ${{ ! cancelled() }} # see https://github.com/actions/upload-artifact - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: - name: ${{ env.TESTS_REPORTS_ARTIFACT }} + name: '${{ env.TESTS_REPORTS_ARTIFACT }}_node${{ matrix.node-version }}_${{ matrix.os }}' path: ${{ env.REPORTS_DIR }} if-no-files-found: error @@ -212,7 +212,7 @@ jobs: npm rebuild --loglevel=silly libxmljs2 || npm uninstall --no-save libxmljs2 - name: fetch build artifact # see https://github.com/actions/download-artifact - uses: actions/download-artifact@v3 + uses: actions/download-artifact@v4 with: name: ${{ env.DIST_DIR }} path: ${{ env.DIST_DIR }} @@ -227,7 +227,7 @@ jobs: - name: artifact test reports if: ${{ failure() }} # see https://github.com/actions/upload-artifact - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: name: dogfooding-direct_npm${{ matrix.npm-version }} path: ${{ env.REPORTS_DIR }} @@ -242,14 +242,16 @@ jobs: steps: - name: fetch test artifacts # see https://github.com/actions/download-artifact - uses: actions/download-artifact@v3 + uses: actions/download-artifact@v4 with: - name: ${{ env.TESTS_REPORTS_ARTIFACT }} + pattern: '${{ env.TESTS_REPORTS_ARTIFACT }}_*' + merge-multiple: true path: ${{ env.REPORTS_DIR }} - name: Run codacy-coverage-reporter env: CODACY_PROJECT_TOKEN: ${{ secrets.CODACY_PROJECT_TOKEN }} - if: ${{ env.CODACY_PROJECT_TOKEN != '' }} ## see https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#example-using-secrets + ## see https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#example-using-secrets + if: ${{ env.CODACY_PROJECT_TOKEN != '' }} # see https://github.com/codacy/codacy-coverage-reporter-action uses: codacy/codacy-coverage-reporter-action@v1 with: diff --git a/.github/workflows/npm-ls_demo-results.yml b/.github/workflows/npm-ls_demo-results.yml index 584e5f5f..40763bc8 100644 --- a/.github/workflows/npm-ls_demo-results.yml +++ b/.github/workflows/npm-ls_demo-results.yml @@ -13,7 +13,7 @@ env: jobs: demo-results: - name: ${{ matrix.subject }} npm${{ matrix.npm-version }} node${{ matrix.node-version }} ${{ matrix.os }} + name: '${{ matrix.subject }} npm${{ matrix.npm-version }} node${{ matrix.node-version }} ${{ matrix.os }}' runs-on: ${{ matrix.os }} strategy: fail-fast: false # gather all the results ! @@ -73,7 +73,7 @@ jobs: run: | mkdir -p '${{ env.RESULTS_DIR }}' echo 'OUT_FILE_PREFIX=${{ env.RESULTS_DIR }}/npm-ls_npm${{ matrix.npm-version }}_node${{ matrix.node-version }}_${{ matrix.os }}' >> $GITHUB_ENV - working-directory: ${{ env.DEMO_ROOT_DIR}}/${{ matrix.subject }} + working-directory: '${{ env.DEMO_ROOT_DIR}}/${{ matrix.subject }}' shell: bash # don't want to write tht code twice, windows and unix-like - name: Setup Node.js ${{ matrix.node-version }} # see https://github.com/actions/setup-node @@ -97,11 +97,11 @@ jobs: ls --json --all --long 2> ${{ env.OUT_FILE_PREFIX }}.err.log 1> ${{ env.OUT_FILE_PREFIX }}.json - working-directory: ${{ env.DEMO_ROOT_DIR}}/${{ matrix.subject }} + working-directory: '${{ env.DEMO_ROOT_DIR}}/${{ matrix.subject }}' - name: Artifact RESULTS # see https://github.com/actions/upload-artifact - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: - name: ${{ env.RESULTS_ARTIFACT }} - path: ${{ env.DEMO_ROOT_DIR}}/*/${{ env.RESULTS_DIR }} + name: '${{ env.RESULTS_ARTIFACT }}_${{ matrix.subject }}_npm${{ matrix.npm-version }}_node${{ matrix.node-version }}_${{ matrix.os }}' + path: '${{ env.DEMO_ROOT_DIR}}/*/${{ env.RESULTS_DIR }}' if-no-files-found: error diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 7ee3efa8..95c974c4 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -112,7 +112,7 @@ jobs: npm pack --pack-destination "$PACKED_DIR" - name: artifact release result # see https://github.com/actions/upload-artifact - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: name: ${{ env.PACKED_ARTIFACT }} path: ${{ env.PACKED_DIR }}/ @@ -130,7 +130,7 @@ jobs: steps: - name: fetch release result # see https://github.com/actions/download-artifact - uses: actions/download-artifact@v3 + uses: actions/download-artifact@v4 with: name: ${{ env.PACKED_ARTIFACT }} path: ${{ env.ASSETS_DIR }}