Chore: update dependency eslint-plugin-unicorn to v66 #1450
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Requires repo secret: PERSONAL_ACCESS_TOKEN with permissions: | |
| # Contents: read and write | |
| # Pull Requests: read and write | |
| name: Node Native Addons Prebuild | |
| on: | |
| # Note: dorny/paths-filter can't use 'pull_request' with the 'base' option | |
| push: | |
| branches-ignore: | |
| - 'main' | |
| workflow_dispatch: | |
| inputs: | |
| ref: | |
| description: 'Git branch' | |
| required: true | |
| type: string | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ inputs.ref || github.ref }} | |
| cancel-in-progress: true | |
| env: | |
| ref: ${{ inputs.ref || github.ref }} | |
| jobs: | |
| # Perform some `on.push.branches-ignore` here so that the 'prebuild-status-check' job can still run | |
| branch-gate: | |
| if: ${{ github.actor == 'emmercm' }} | |
| permissions: {} | |
| runs-on: ubuntu-latest | |
| outputs: | |
| should-prebuild: ${{ steps.branch-gate.outputs.should-prebuild }} | |
| steps: | |
| - id: branch-gate | |
| env: | |
| REF: ${{ env.ref }} | |
| run: | | |
| set -x | |
| branch="${REF#refs/heads/}" | |
| # Don't prebuild on version bump branches (e.g. 'emmercm/1.2.3') | |
| if [[ "${branch}" =~ /[0-9]+\.[0-9]+\.[0-9]+$ ]]; then | |
| echo "should-prebuild=false" >> "${GITHUB_OUTPUT}" | |
| else | |
| echo "should-prebuild=true" >> "${GITHUB_OUTPUT}" | |
| fi | |
| path-filter: | |
| if: ${{ github.actor == 'emmercm' }} | |
| permissions: | |
| pull-requests: read # dorny/paths-filter | |
| runs-on: ubuntu-latest | |
| outputs: | |
| changes: ${{ steps.change-filter.outputs.changes == 'true' && steps.commit-filter.outputs.changes == 'false' && 'true' || 'false' }} | |
| steps: | |
| - uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 | |
| with: | |
| persist-credentials: false | |
| ref: ${{ env.ref }} | |
| # Prebuild if any relevant source file has changed | |
| - id: change-filter | |
| uses: dorny/paths-filter@fbd0ab8f3e69293af611ebaee6363fc25e6d187d # v4.0.1 | |
| with: | |
| filters: | | |
| changes: | |
| - '.github/workflows/node-addon-prebuild.yml' | |
| - 'packages/zlib*/**' | |
| - 'packages/zstd*/**' | |
| - 'package*.json' | |
| # DON'T prebuild if the last commit was prebuilds | |
| - id: commit-filter | |
| uses: dorny/paths-filter@fbd0ab8f3e69293af611ebaee6363fc25e6d187d # v4.0.1 | |
| with: | |
| base: ${{ github.ref }} | |
| filters: | | |
| changes: | |
| - 'packages/*/addon*/**' | |
| - 'packages/*/prebuilds*/**' | |
| prebuild: | |
| name: prebuildify (${{ matrix.os }}, ${{ matrix.docker_arch || 'default' }}) | |
| needs: | |
| - branch-gate | |
| - path-filter | |
| if: ${{ (needs.branch-gate.outputs.should-prebuild == 'true' && needs.path-filter.outputs.changes == 'true') || github.event_name == 'workflow_dispatch' }} | |
| permissions: | |
| contents: read # actions/checkout | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| # docker manifest inspect node:<version> | jq '.manifests[].platform' | |
| - os: ubuntu-latest | |
| docker_arch: linux/amd64 | |
| - os: ubuntu-24.04-arm | |
| docker_arch: linux/arm64/v8 | |
| - os: macos-15-intel | |
| - os: macos-latest | |
| - os: windows-latest | |
| - os: windows-11-arm | |
| runs-on: ${{ matrix.os }} | |
| timeout-minutes: 30 # QEMU cross-builds | |
| defaults: | |
| run: | |
| shell: bash | |
| steps: | |
| # Setup and install | |
| - uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 | |
| with: | |
| persist-credentials: false | |
| ref: ${{ env.ref }} | |
| submodules: 'recursive' | |
| - uses: volta-cli/action@615a78f6c83e116339c53b94f3f82b4d6c0b7d18 # v5.0.0 | |
| with: | |
| node-version: 22 | |
| - id: npm-cache-dir | |
| shell: bash | |
| run: echo "dir=$(npm config get cache)" >> "${GITHUB_OUTPUT}" | |
| - uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5 | |
| with: | |
| path: ${{ steps.npm-cache-dir.outputs.dir }} | |
| key: ${{ runner.os }}-npm-${{ hashFiles('**/package-lock.json') }} | |
| restore-keys: | | |
| ${{ runner.os }}-npm- | |
| ${{ runner.os }}- | |
| # Prebuild | |
| - shell: bash | |
| run: | | |
| npm ci --ignore-scripts | |
| - if: ${{ startsWith(matrix.os, 'ubuntu') }} | |
| uses: docker/setup-qemu-action@06116385d9baf250c9f4dcb4858b16962ea869c3 # v4.1.0 | |
| - id: linux-vars | |
| if: ${{ startsWith(matrix.os, 'ubuntu') }} | |
| run: | | |
| set -x | |
| echo "VERSIONS_NODE=$(node --print 'process.versions.node')" >> "${GITHUB_OUTPUT}" | |
| DOCKER_ARCH=${{ matrix.docker_arch }} | |
| DOCKER_ARCH=${DOCKER_ARCH/linux\//} | |
| DOCKER_ARCH=${DOCKER_ARCH//\//} | |
| echo "DOCKER_ARCH=${DOCKER_ARCH}" >> "${GITHUB_OUTPUT}" | |
| - if: ${{ startsWith(matrix.os, 'ubuntu') }} | |
| id: build-docker | |
| uses: ./.github/actions/docker-run-action | |
| with: | |
| image: node:${{ steps.linux-vars.outputs.VERSIONS_NODE }} | |
| shell: bash | |
| options: | | |
| --platform ${{ matrix.docker_arch }} | |
| --volume ${{ github.workspace }}:/build | |
| --workdir /build | |
| run: | | |
| set -euo pipefail | |
| set -x | |
| uname -a | |
| find packages -maxdepth 1 -type d \( -name "zlib*" -o -name "zstd*" \) | while IFS= read -r dir; do | |
| cd "${dir}" | |
| rm -rf addon* prebuilds* | |
| ../../node_modules/.bin/prebuildify --target "$(node --print 'process.versions.node')" --napi --strip --out "addon-$(basename "$(pwd)")" | |
| cd ../.. | |
| done | |
| find packages/*/addon* -type f -print0 | xargs -0 ls -al | |
| # Test the build | |
| rm -rf packages/*/build | |
| npm ci --foreground-scripts | |
| npm run test:unit packages | |
| - if: ${{ !startsWith(matrix.os, 'ubuntu') }} | |
| id: build | |
| run: | | |
| set -x | |
| node --print 'process' | |
| find packages -maxdepth 1 -type d \( -name "zlib*" -o -name "zstd*" \) | while IFS= read -r dir; do | |
| cd "${dir}" | |
| rm -rf addon* prebuilds* | |
| ../../node_modules/.bin/prebuildify --target "$(node --print 'process.versions.node')" --napi --strip --out "addon-$(basename "$(pwd)")" | |
| cd ../.. | |
| done | |
| find packages/*/addon* -type f -print0 | xargs -0 ls -al | |
| # Test the build | |
| rm -rf packages/*/build | |
| npm ci --foreground-scripts | |
| npm run test:unit packages | |
| - uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 | |
| with: | |
| name: prebuild-${{ matrix.os }}-${{ steps.linux-vars.outputs.DOCKER_ARCH }} | |
| path: packages/*/addon*/ | |
| include-hidden-files: true | |
| if-no-files-found: error | |
| retention-days: 7 | |
| cpp-lint: | |
| needs: | |
| - branch-gate | |
| - path-filter | |
| if: ${{ (needs.branch-gate.outputs.should-prebuild == 'true' && needs.path-filter.outputs.changes == 'true') || github.event_name == 'workflow_dispatch' }} | |
| permissions: | |
| contents: read # actions/checkout | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 | |
| with: | |
| persist-credentials: false | |
| ref: ${{ env.ref }} | |
| submodules: 'recursive' | |
| - uses: volta-cli/action@615a78f6c83e116339c53b94f3f82b4d6c0b7d18 # v5.0.0 | |
| - name: Install dependencies | |
| run: | | |
| npm ci --ignore-scripts | |
| pipx install clang-format | |
| clang-format --version | |
| pipx install clang-tidy | |
| clang-tidy --version | |
| - name: clang-format | |
| run: | | |
| set -x | |
| mapfile -t cpp_files < <(find packages -type f \( -name '*.cpp' -o -name '*.cc' \) \ | |
| -not -path '*/deps/*' -not -path '*/build/*' -not -path '*/addon*/*' | sort) | |
| printf 'Checking: %s\n' "${cpp_files[@]}" | |
| clang-format --dry-run --Werror "${cpp_files[@]}" | |
| - name: clang-tidy | |
| run: | | |
| set -x | |
| for gyp in packages/*/binding.gyp; do | |
| pkg=$(dirname "${gyp}") | |
| ( cd "${pkg}" && ../../node_modules/.bin/node-gyp configure -- -f compile_commands_json ) | |
| mapfile -t pkg_files < <(find "${pkg}" -type f \( -name '*.cpp' -o -name '*.cc' \) \ | |
| -not -path '*/deps/*' -not -path '*/build/*' -not -path '*/addon*/*' | sort) | |
| printf 'Linting %s: %s\n' "${pkg}" "${pkg_files[*]}" | |
| clang-tidy --warnings-as-errors='*' -p "${pkg}/build/Release" "${pkg_files[@]}" | |
| done | |
| commit: | |
| needs: | |
| - prebuild | |
| - cpp-lint | |
| permissions: | |
| contents: read # actions/checkout | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 | |
| with: | |
| # zizmor: ignore[artipacked] The persisted credentials are required for the | |
| # subsequent `git push` that commits the prebuilds back to the branch. | |
| ref: ${{ env.ref }} | |
| # Token needed to trigger Actions on push | |
| token: ${{ secrets.PERSONAL_ACCESS_TOKEN }} | |
| - run: | | |
| set -x | |
| find packages/*/addon* -type f -print0 | xargs -0 ls -al | |
| rm -rf packages/*/addon*/ packages/*/prebuilds*/ | |
| find packages/*/addon* -type f -print0 | xargs -0 ls -al | |
| - uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1 | |
| with: | |
| path: packages/ | |
| merge-multiple: true | |
| - id: bump-and-commit | |
| run: | | |
| set -x | |
| find packages/*/addon* -type f -print0 | xargs -0 ls -al | |
| git add --all packages | |
| git status | |
| USER_EMAIL="41898282+github-actions[bot]@users.noreply.github.com" | |
| echo "USER_EMAIL=${USER_EMAIL}" >> "${GITHUB_OUTPUT}" | |
| git config user.email "${USER_EMAIL}" | |
| USER_NAME="github-actions[bot]" | |
| echo "USER_NAME=${USER_NAME}" >> "${GITHUB_OUTPUT}" | |
| git config user.name "${USER_NAME}" | |
| git commit -m "prebuilds @ https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}/attempts/${{ github.run_attempt }}" || exit 0 | |
| git push | |
| # !!! This check should be required by GitHub !!! | |
| prebuild-status-check: | |
| needs: | |
| - path-filter | |
| - branch-gate | |
| - prebuild | |
| - cpp-lint | |
| - commit | |
| if: always() | |
| permissions: { } | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: re-actors/alls-green@05ac9388f0aebcb5727afa17fcccfecd6f8ec5fe # release/v1 | |
| with: | |
| jobs: ${{ toJSON(needs) }} | |
| allowed-skips: branch-gate, path-filter, prebuild, cpp-lint, commit |