diff options
Diffstat (limited to '.github')
-rw-r--r-- | .github/CODEOWNERS | 4 | ||||
-rw-r--r-- | .github/workflows/audit.yml | 26 | ||||
-rw-r--r-- | .github/workflows/ci-docs.yml | 35 | ||||
-rw-r--r-- | .github/workflows/ci-libnpmaccess.yml | 31 | ||||
-rw-r--r-- | .github/workflows/ci-libnpmdiff.yml | 31 | ||||
-rw-r--r-- | .github/workflows/ci-libnpmexec.yml | 31 | ||||
-rw-r--r-- | .github/workflows/ci-libnpmfund.yml | 31 | ||||
-rw-r--r-- | .github/workflows/ci-libnpmhook.yml | 31 | ||||
-rw-r--r-- | .github/workflows/ci-libnpmorg.yml | 31 | ||||
-rw-r--r-- | .github/workflows/ci-libnpmpack.yml | 31 | ||||
-rw-r--r-- | .github/workflows/ci-libnpmpublish.yml | 31 | ||||
-rw-r--r-- | .github/workflows/ci-libnpmsearch.yml | 31 | ||||
-rw-r--r-- | .github/workflows/ci-libnpmteam.yml | 31 | ||||
-rw-r--r-- | .github/workflows/ci-libnpmversion.yml | 31 | ||||
-rw-r--r-- | .github/workflows/ci-npmcli-arborist.yml | 31 | ||||
-rw-r--r-- | .github/workflows/ci-smoke-tests.yml | 73 | ||||
-rw-r--r-- | .github/workflows/ci.yml | 99 | ||||
-rw-r--r-- | .github/workflows/codeql-analysis.yml | 44 | ||||
-rw-r--r-- | .github/workflows/pull-request.yml | 36 | ||||
-rw-r--r-- | .github/workflows/release-please.yml | 27 | ||||
-rw-r--r-- | .github/workflows/release.yml | 85 |
21 files changed, 386 insertions, 415 deletions
diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index ef8743136..2c54b0d25 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -1 +1,3 @@ -* @npm/cli-team +# This file is automatically added by @npmcli/template-oss. Do not edit. + +* @npm/cli-team diff --git a/.github/workflows/audit.yml b/.github/workflows/audit.yml new file mode 100644 index 000000000..69e21c329 --- /dev/null +++ b/.github/workflows/audit.yml @@ -0,0 +1,26 @@ +# This file is automatically added by @npmcli/template-oss. Do not edit. + +name: Audit + +on: + workflow_dispatch: + schedule: + # "At 08:00 UTC (01:00 PT) on Monday" https://crontab.guru/#0_8_*_*_1 + - cron: "0 8 * * 1" + +jobs: + audit: + if: github.repository_owner == 'npm' + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - name: Setup git user + run: | + git config --global user.email "npm-cli+bot@github.com" + git config --global user.name "npm CLI robot" + - uses: actions/setup-node@v3 + with: + node-version: 18.x + cache: npm + - run: node . run resetdeps + - run: node . audit diff --git a/.github/workflows/ci-docs.yml b/.github/workflows/ci-docs.yml index dd8a43192..265343606 100644 --- a/.github/workflows/ci-docs.yml +++ b/.github/workflows/ci-docs.yml @@ -21,6 +21,7 @@ on: jobs: lint: + if: github.repository_owner == 'npm' runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 @@ -30,19 +31,17 @@ jobs: git config --global user.name "npm CLI robot" - uses: actions/setup-node@v3 with: - node-version: 16 - - name: Update npm to latest - run: npm i --prefer-online --no-fund --no-audit -g npm@latest - - run: npm -v - - run: npm i --ignore-scripts --no-audit --no-fund - - run: npm run lint -w docs + node-version: 18.x + - run: node . run resetdeps + - run: node . run lint -w docs test: + if: github.repository_owner == 'npm' strategy: fail-fast: false matrix: node-version: - - 16 + - 18.x platform: - os: ubuntu-latest shell: bash @@ -63,25 +62,7 @@ jobs: - uses: actions/setup-node@v3 with: node-version: ${{ matrix.node-version }} - - name: Update to workable npm (windows) - # node 12 and 14 ship with npm@6, which is known to fail when updating itself in windows - if: matrix.platform.os == 'windows-latest' && (startsWith(matrix.node-version, '12.') || startsWith(matrix.node-version, '14.')) - run: | - curl -sO https://registry.npmjs.org/npm/-/npm-7.5.4.tgz - tar xf npm-7.5.4.tgz - cd package - node lib/npm.js install --no-fund --no-audit -g ..\npm-7.5.4.tgz - cd .. - rmdir /s /q package - - name: Update npm to 7 - # If we do test on npm 10 it needs npm7 - if: startsWith(matrix.node-version, '10.') - run: npm i --prefer-online --no-fund --no-audit -g npm@7 - - name: Update npm to latest - if: ${{ !startsWith(matrix.node-version, '10.') }} - run: npm i --prefer-online --no-fund --no-audit -g npm@latest - - run: npm -v - - run: npm i --ignore-scripts --no-audit --no-fund + - run: node . run resetdeps - name: add tap problem matcher run: echo "::add-matcher::.github/matchers/tap.json" - - run: npm test --ignore-scripts -w docs + - run: node . test --ignore-scripts -w docs diff --git a/.github/workflows/ci-libnpmaccess.yml b/.github/workflows/ci-libnpmaccess.yml index 6f27d9555..baeb67c98 100644 --- a/.github/workflows/ci-libnpmaccess.yml +++ b/.github/workflows/ci-libnpmaccess.yml @@ -21,6 +21,7 @@ on: jobs: lint: + if: github.repository_owner == 'npm' runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 @@ -31,13 +32,11 @@ jobs: - uses: actions/setup-node@v3 with: node-version: 18.x - - name: Update npm to latest - run: npm i --prefer-online --no-fund --no-audit -g npm@latest - - run: npm -v - - run: npm i --ignore-scripts --no-audit --no-fund - - run: npm run lint -w libnpmaccess + - run: node . run resetdeps + - run: node . run lint -w libnpmaccess test: + if: github.repository_owner == 'npm' strategy: fail-fast: false matrix: @@ -68,25 +67,7 @@ jobs: - uses: actions/setup-node@v3 with: node-version: ${{ matrix.node-version }} - - name: Update to workable npm (windows) - # node 12 and 14 ship with npm@6, which is known to fail when updating itself in windows - if: matrix.platform.os == 'windows-latest' && (startsWith(matrix.node-version, '12.') || startsWith(matrix.node-version, '14.')) - run: | - curl -sO https://registry.npmjs.org/npm/-/npm-7.5.4.tgz - tar xf npm-7.5.4.tgz - cd package - node lib/npm.js install --no-fund --no-audit -g ..\npm-7.5.4.tgz - cd .. - rmdir /s /q package - - name: Update npm to 7 - # If we do test on npm 10 it needs npm7 - if: startsWith(matrix.node-version, '10.') - run: npm i --prefer-online --no-fund --no-audit -g npm@7 - - name: Update npm to latest - if: ${{ !startsWith(matrix.node-version, '10.') }} - run: npm i --prefer-online --no-fund --no-audit -g npm@latest - - run: npm -v - - run: npm i --ignore-scripts --no-audit --no-fund + - run: node . run resetdeps - name: add tap problem matcher run: echo "::add-matcher::.github/matchers/tap.json" - - run: npm test --ignore-scripts -w libnpmaccess + - run: node . test --ignore-scripts -w libnpmaccess diff --git a/.github/workflows/ci-libnpmdiff.yml b/.github/workflows/ci-libnpmdiff.yml index daba1324d..c034d1667 100644 --- a/.github/workflows/ci-libnpmdiff.yml +++ b/.github/workflows/ci-libnpmdiff.yml @@ -21,6 +21,7 @@ on: jobs: lint: + if: github.repository_owner == 'npm' runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 @@ -31,13 +32,11 @@ jobs: - uses: actions/setup-node@v3 with: node-version: 18.x - - name: Update npm to latest - run: npm i --prefer-online --no-fund --no-audit -g npm@latest - - run: npm -v - - run: npm i --ignore-scripts --no-audit --no-fund - - run: npm run lint -w libnpmdiff + - run: node . run resetdeps + - run: node . run lint -w libnpmdiff test: + if: github.repository_owner == 'npm' strategy: fail-fast: false matrix: @@ -68,25 +67,7 @@ jobs: - uses: actions/setup-node@v3 with: node-version: ${{ matrix.node-version }} - - name: Update to workable npm (windows) - # node 12 and 14 ship with npm@6, which is known to fail when updating itself in windows - if: matrix.platform.os == 'windows-latest' && (startsWith(matrix.node-version, '12.') || startsWith(matrix.node-version, '14.')) - run: | - curl -sO https://registry.npmjs.org/npm/-/npm-7.5.4.tgz - tar xf npm-7.5.4.tgz - cd package - node lib/npm.js install --no-fund --no-audit -g ..\npm-7.5.4.tgz - cd .. - rmdir /s /q package - - name: Update npm to 7 - # If we do test on npm 10 it needs npm7 - if: startsWith(matrix.node-version, '10.') - run: npm i --prefer-online --no-fund --no-audit -g npm@7 - - name: Update npm to latest - if: ${{ !startsWith(matrix.node-version, '10.') }} - run: npm i --prefer-online --no-fund --no-audit -g npm@latest - - run: npm -v - - run: npm i --ignore-scripts --no-audit --no-fund + - run: node . run resetdeps - name: add tap problem matcher run: echo "::add-matcher::.github/matchers/tap.json" - - run: npm test --ignore-scripts -w libnpmdiff + - run: node . test --ignore-scripts -w libnpmdiff diff --git a/.github/workflows/ci-libnpmexec.yml b/.github/workflows/ci-libnpmexec.yml index e7cd77124..d8504e56c 100644 --- a/.github/workflows/ci-libnpmexec.yml +++ b/.github/workflows/ci-libnpmexec.yml @@ -21,6 +21,7 @@ on: jobs: lint: + if: github.repository_owner == 'npm' runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 @@ -31,13 +32,11 @@ jobs: - uses: actions/setup-node@v3 with: node-version: 18.x - - name: Update npm to latest - run: npm i --prefer-online --no-fund --no-audit -g npm@latest - - run: npm -v - - run: npm i --ignore-scripts --no-audit --no-fund - - run: npm run lint -w libnpmexec + - run: node . run resetdeps + - run: node . run lint -w libnpmexec test: + if: github.repository_owner == 'npm' strategy: fail-fast: false matrix: @@ -68,25 +67,7 @@ jobs: - uses: actions/setup-node@v3 with: node-version: ${{ matrix.node-version }} - - name: Update to workable npm (windows) - # node 12 and 14 ship with npm@6, which is known to fail when updating itself in windows - if: matrix.platform.os == 'windows-latest' && (startsWith(matrix.node-version, '12.') || startsWith(matrix.node-version, '14.')) - run: | - curl -sO https://registry.npmjs.org/npm/-/npm-7.5.4.tgz - tar xf npm-7.5.4.tgz - cd package - node lib/npm.js install --no-fund --no-audit -g ..\npm-7.5.4.tgz - cd .. - rmdir /s /q package - - name: Update npm to 7 - # If we do test on npm 10 it needs npm7 - if: startsWith(matrix.node-version, '10.') - run: npm i --prefer-online --no-fund --no-audit -g npm@7 - - name: Update npm to latest - if: ${{ !startsWith(matrix.node-version, '10.') }} - run: npm i --prefer-online --no-fund --no-audit -g npm@latest - - run: npm -v - - run: npm i --ignore-scripts --no-audit --no-fund + - run: node . run resetdeps - name: add tap problem matcher run: echo "::add-matcher::.github/matchers/tap.json" - - run: npm test --ignore-scripts -w libnpmexec + - run: node . test --ignore-scripts -w libnpmexec diff --git a/.github/workflows/ci-libnpmfund.yml b/.github/workflows/ci-libnpmfund.yml index 268db59da..df55d1d44 100644 --- a/.github/workflows/ci-libnpmfund.yml +++ b/.github/workflows/ci-libnpmfund.yml @@ -21,6 +21,7 @@ on: jobs: lint: + if: github.repository_owner == 'npm' runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 @@ -31,13 +32,11 @@ jobs: - uses: actions/setup-node@v3 with: node-version: 18.x - - name: Update npm to latest - run: npm i --prefer-online --no-fund --no-audit -g npm@latest - - run: npm -v - - run: npm i --ignore-scripts --no-audit --no-fund - - run: npm run lint -w libnpmfund + - run: node . run resetdeps + - run: node . run lint -w libnpmfund test: + if: github.repository_owner == 'npm' strategy: fail-fast: false matrix: @@ -68,25 +67,7 @@ jobs: - uses: actions/setup-node@v3 with: node-version: ${{ matrix.node-version }} - - name: Update to workable npm (windows) - # node 12 and 14 ship with npm@6, which is known to fail when updating itself in windows - if: matrix.platform.os == 'windows-latest' && (startsWith(matrix.node-version, '12.') || startsWith(matrix.node-version, '14.')) - run: | - curl -sO https://registry.npmjs.org/npm/-/npm-7.5.4.tgz - tar xf npm-7.5.4.tgz - cd package - node lib/npm.js install --no-fund --no-audit -g ..\npm-7.5.4.tgz - cd .. - rmdir /s /q package - - name: Update npm to 7 - # If we do test on npm 10 it needs npm7 - if: startsWith(matrix.node-version, '10.') - run: npm i --prefer-online --no-fund --no-audit -g npm@7 - - name: Update npm to latest - if: ${{ !startsWith(matrix.node-version, '10.') }} - run: npm i --prefer-online --no-fund --no-audit -g npm@latest - - run: npm -v - - run: npm i --ignore-scripts --no-audit --no-fund + - run: node . run resetdeps - name: add tap problem matcher run: echo "::add-matcher::.github/matchers/tap.json" - - run: npm test --ignore-scripts -w libnpmfund + - run: node . test --ignore-scripts -w libnpmfund diff --git a/.github/workflows/ci-libnpmhook.yml b/.github/workflows/ci-libnpmhook.yml index 81eb7fe68..f98768a23 100644 --- a/.github/workflows/ci-libnpmhook.yml +++ b/.github/workflows/ci-libnpmhook.yml @@ -21,6 +21,7 @@ on: jobs: lint: + if: github.repository_owner == 'npm' runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 @@ -31,13 +32,11 @@ jobs: - uses: actions/setup-node@v3 with: node-version: 18.x - - name: Update npm to latest - run: npm i --prefer-online --no-fund --no-audit -g npm@latest - - run: npm -v - - run: npm i --ignore-scripts --no-audit --no-fund - - run: npm run lint -w libnpmhook + - run: node . run resetdeps + - run: node . run lint -w libnpmhook test: + if: github.repository_owner == 'npm' strategy: fail-fast: false matrix: @@ -68,25 +67,7 @@ jobs: - uses: actions/setup-node@v3 with: node-version: ${{ matrix.node-version }} - - name: Update to workable npm (windows) - # node 12 and 14 ship with npm@6, which is known to fail when updating itself in windows - if: matrix.platform.os == 'windows-latest' && (startsWith(matrix.node-version, '12.') || startsWith(matrix.node-version, '14.')) - run: | - curl -sO https://registry.npmjs.org/npm/-/npm-7.5.4.tgz - tar xf npm-7.5.4.tgz - cd package - node lib/npm.js install --no-fund --no-audit -g ..\npm-7.5.4.tgz - cd .. - rmdir /s /q package - - name: Update npm to 7 - # If we do test on npm 10 it needs npm7 - if: startsWith(matrix.node-version, '10.') - run: npm i --prefer-online --no-fund --no-audit -g npm@7 - - name: Update npm to latest - if: ${{ !startsWith(matrix.node-version, '10.') }} - run: npm i --prefer-online --no-fund --no-audit -g npm@latest - - run: npm -v - - run: npm i --ignore-scripts --no-audit --no-fund + - run: node . run resetdeps - name: add tap problem matcher run: echo "::add-matcher::.github/matchers/tap.json" - - run: npm test --ignore-scripts -w libnpmhook + - run: node . test --ignore-scripts -w libnpmhook diff --git a/.github/workflows/ci-libnpmorg.yml b/.github/workflows/ci-libnpmorg.yml index 26e5a26dd..5a07174a8 100644 --- a/.github/workflows/ci-libnpmorg.yml +++ b/.github/workflows/ci-libnpmorg.yml @@ -21,6 +21,7 @@ on: jobs: lint: + if: github.repository_owner == 'npm' runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 @@ -31,13 +32,11 @@ jobs: - uses: actions/setup-node@v3 with: node-version: 18.x - - name: Update npm to latest - run: npm i --prefer-online --no-fund --no-audit -g npm@latest - - run: npm -v - - run: npm i --ignore-scripts --no-audit --no-fund - - run: npm run lint -w libnpmorg + - run: node . run resetdeps + - run: node . run lint -w libnpmorg test: + if: github.repository_owner == 'npm' strategy: fail-fast: false matrix: @@ -68,25 +67,7 @@ jobs: - uses: actions/setup-node@v3 with: node-version: ${{ matrix.node-version }} - - name: Update to workable npm (windows) - # node 12 and 14 ship with npm@6, which is known to fail when updating itself in windows - if: matrix.platform.os == 'windows-latest' && (startsWith(matrix.node-version, '12.') || startsWith(matrix.node-version, '14.')) - run: | - curl -sO https://registry.npmjs.org/npm/-/npm-7.5.4.tgz - tar xf npm-7.5.4.tgz - cd package - node lib/npm.js install --no-fund --no-audit -g ..\npm-7.5.4.tgz - cd .. - rmdir /s /q package - - name: Update npm to 7 - # If we do test on npm 10 it needs npm7 - if: startsWith(matrix.node-version, '10.') - run: npm i --prefer-online --no-fund --no-audit -g npm@7 - - name: Update npm to latest - if: ${{ !startsWith(matrix.node-version, '10.') }} - run: npm i --prefer-online --no-fund --no-audit -g npm@latest - - run: npm -v - - run: npm i --ignore-scripts --no-audit --no-fund + - run: node . run resetdeps - name: add tap problem matcher run: echo "::add-matcher::.github/matchers/tap.json" - - run: npm test --ignore-scripts -w libnpmorg + - run: node . test --ignore-scripts -w libnpmorg diff --git a/.github/workflows/ci-libnpmpack.yml b/.github/workflows/ci-libnpmpack.yml index 4bd344e76..0163e6dcf 100644 --- a/.github/workflows/ci-libnpmpack.yml +++ b/.github/workflows/ci-libnpmpack.yml @@ -21,6 +21,7 @@ on: jobs: lint: + if: github.repository_owner == 'npm' runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 @@ -31,13 +32,11 @@ jobs: - uses: actions/setup-node@v3 with: node-version: 18.x - - name: Update npm to latest - run: npm i --prefer-online --no-fund --no-audit -g npm@latest - - run: npm -v - - run: npm i --ignore-scripts --no-audit --no-fund - - run: npm run lint -w libnpmpack + - run: node . run resetdeps + - run: node . run lint -w libnpmpack test: + if: github.repository_owner == 'npm' strategy: fail-fast: false matrix: @@ -68,25 +67,7 @@ jobs: - uses: actions/setup-node@v3 with: node-version: ${{ matrix.node-version }} - - name: Update to workable npm (windows) - # node 12 and 14 ship with npm@6, which is known to fail when updating itself in windows - if: matrix.platform.os == 'windows-latest' && (startsWith(matrix.node-version, '12.') || startsWith(matrix.node-version, '14.')) - run: | - curl -sO https://registry.npmjs.org/npm/-/npm-7.5.4.tgz - tar xf npm-7.5.4.tgz - cd package - node lib/npm.js install --no-fund --no-audit -g ..\npm-7.5.4.tgz - cd .. - rmdir /s /q package - - name: Update npm to 7 - # If we do test on npm 10 it needs npm7 - if: startsWith(matrix.node-version, '10.') - run: npm i --prefer-online --no-fund --no-audit -g npm@7 - - name: Update npm to latest - if: ${{ !startsWith(matrix.node-version, '10.') }} - run: npm i --prefer-online --no-fund --no-audit -g npm@latest - - run: npm -v - - run: npm i --ignore-scripts --no-audit --no-fund + - run: node . run resetdeps - name: add tap problem matcher run: echo "::add-matcher::.github/matchers/tap.json" - - run: npm test --ignore-scripts -w libnpmpack + - run: node . test --ignore-scripts -w libnpmpack diff --git a/.github/workflows/ci-libnpmpublish.yml b/.github/workflows/ci-libnpmpublish.yml index cad4ea600..633e67ed9 100644 --- a/.github/workflows/ci-libnpmpublish.yml +++ b/.github/workflows/ci-libnpmpublish.yml @@ -21,6 +21,7 @@ on: jobs: lint: + if: github.repository_owner == 'npm' runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 @@ -31,13 +32,11 @@ jobs: - uses: actions/setup-node@v3 with: node-version: 18.x - - name: Update npm to latest - run: npm i --prefer-online --no-fund --no-audit -g npm@latest - - run: npm -v - - run: npm i --ignore-scripts --no-audit --no-fund - - run: npm run lint -w libnpmpublish + - run: node . run resetdeps + - run: node . run lint -w libnpmpublish test: + if: github.repository_owner == 'npm' strategy: fail-fast: false matrix: @@ -68,25 +67,7 @@ jobs: - uses: actions/setup-node@v3 with: node-version: ${{ matrix.node-version }} - - name: Update to workable npm (windows) - # node 12 and 14 ship with npm@6, which is known to fail when updating itself in windows - if: matrix.platform.os == 'windows-latest' && (startsWith(matrix.node-version, '12.') || startsWith(matrix.node-version, '14.')) - run: | - curl -sO https://registry.npmjs.org/npm/-/npm-7.5.4.tgz - tar xf npm-7.5.4.tgz - cd package - node lib/npm.js install --no-fund --no-audit -g ..\npm-7.5.4.tgz - cd .. - rmdir /s /q package - - name: Update npm to 7 - # If we do test on npm 10 it needs npm7 - if: startsWith(matrix.node-version, '10.') - run: npm i --prefer-online --no-fund --no-audit -g npm@7 - - name: Update npm to latest - if: ${{ !startsWith(matrix.node-version, '10.') }} - run: npm i --prefer-online --no-fund --no-audit -g npm@latest - - run: npm -v - - run: npm i --ignore-scripts --no-audit --no-fund + - run: node . run resetdeps - name: add tap problem matcher run: echo "::add-matcher::.github/matchers/tap.json" - - run: npm test --ignore-scripts -w libnpmpublish + - run: node . test --ignore-scripts -w libnpmpublish diff --git a/.github/workflows/ci-libnpmsearch.yml b/.github/workflows/ci-libnpmsearch.yml index 83341b465..4a07f5289 100644 --- a/.github/workflows/ci-libnpmsearch.yml +++ b/.github/workflows/ci-libnpmsearch.yml @@ -21,6 +21,7 @@ on: jobs: lint: + if: github.repository_owner == 'npm' runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 @@ -31,13 +32,11 @@ jobs: - uses: actions/setup-node@v3 with: node-version: 18.x - - name: Update npm to latest - run: npm i --prefer-online --no-fund --no-audit -g npm@latest - - run: npm -v - - run: npm i --ignore-scripts --no-audit --no-fund - - run: npm run lint -w libnpmsearch + - run: node . run resetdeps + - run: node . run lint -w libnpmsearch test: + if: github.repository_owner == 'npm' strategy: fail-fast: false matrix: @@ -68,25 +67,7 @@ jobs: - uses: actions/setup-node@v3 with: node-version: ${{ matrix.node-version }} - - name: Update to workable npm (windows) - # node 12 and 14 ship with npm@6, which is known to fail when updating itself in windows - if: matrix.platform.os == 'windows-latest' && (startsWith(matrix.node-version, '12.') || startsWith(matrix.node-version, '14.')) - run: | - curl -sO https://registry.npmjs.org/npm/-/npm-7.5.4.tgz - tar xf npm-7.5.4.tgz - cd package - node lib/npm.js install --no-fund --no-audit -g ..\npm-7.5.4.tgz - cd .. - rmdir /s /q package - - name: Update npm to 7 - # If we do test on npm 10 it needs npm7 - if: startsWith(matrix.node-version, '10.') - run: npm i --prefer-online --no-fund --no-audit -g npm@7 - - name: Update npm to latest - if: ${{ !startsWith(matrix.node-version, '10.') }} - run: npm i --prefer-online --no-fund --no-audit -g npm@latest - - run: npm -v - - run: npm i --ignore-scripts --no-audit --no-fund + - run: node . run resetdeps - name: add tap problem matcher run: echo "::add-matcher::.github/matchers/tap.json" - - run: npm test --ignore-scripts -w libnpmsearch + - run: node . test --ignore-scripts -w libnpmsearch diff --git a/.github/workflows/ci-libnpmteam.yml b/.github/workflows/ci-libnpmteam.yml index 38d77d209..85b692dab 100644 --- a/.github/workflows/ci-libnpmteam.yml +++ b/.github/workflows/ci-libnpmteam.yml @@ -21,6 +21,7 @@ on: jobs: lint: + if: github.repository_owner == 'npm' runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 @@ -31,13 +32,11 @@ jobs: - uses: actions/setup-node@v3 with: node-version: 18.x - - name: Update npm to latest - run: npm i --prefer-online --no-fund --no-audit -g npm@latest - - run: npm -v - - run: npm i --ignore-scripts --no-audit --no-fund - - run: npm run lint -w libnpmteam + - run: node . run resetdeps + - run: node . run lint -w libnpmteam test: + if: github.repository_owner == 'npm' strategy: fail-fast: false matrix: @@ -68,25 +67,7 @@ jobs: - uses: actions/setup-node@v3 with: node-version: ${{ matrix.node-version }} - - name: Update to workable npm (windows) - # node 12 and 14 ship with npm@6, which is known to fail when updating itself in windows - if: matrix.platform.os == 'windows-latest' && (startsWith(matrix.node-version, '12.') || startsWith(matrix.node-version, '14.')) - run: | - curl -sO https://registry.npmjs.org/npm/-/npm-7.5.4.tgz - tar xf npm-7.5.4.tgz - cd package - node lib/npm.js install --no-fund --no-audit -g ..\npm-7.5.4.tgz - cd .. - rmdir /s /q package - - name: Update npm to 7 - # If we do test on npm 10 it needs npm7 - if: startsWith(matrix.node-version, '10.') - run: npm i --prefer-online --no-fund --no-audit -g npm@7 - - name: Update npm to latest - if: ${{ !startsWith(matrix.node-version, '10.') }} - run: npm i --prefer-online --no-fund --no-audit -g npm@latest - - run: npm -v - - run: npm i --ignore-scripts --no-audit --no-fund + - run: node . run resetdeps - name: add tap problem matcher run: echo "::add-matcher::.github/matchers/tap.json" - - run: npm test --ignore-scripts -w libnpmteam + - run: node . test --ignore-scripts -w libnpmteam diff --git a/.github/workflows/ci-libnpmversion.yml b/.github/workflows/ci-libnpmversion.yml index 023fd8b7a..1a29b040c 100644 --- a/.github/workflows/ci-libnpmversion.yml +++ b/.github/workflows/ci-libnpmversion.yml @@ -21,6 +21,7 @@ on: jobs: lint: + if: github.repository_owner == 'npm' runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 @@ -31,13 +32,11 @@ jobs: - uses: actions/setup-node@v3 with: node-version: 18.x - - name: Update npm to latest - run: npm i --prefer-online --no-fund --no-audit -g npm@latest - - run: npm -v - - run: npm i --ignore-scripts --no-audit --no-fund - - run: npm run lint -w libnpmversion + - run: node . run resetdeps + - run: node . run lint -w libnpmversion test: + if: github.repository_owner == 'npm' strategy: fail-fast: false matrix: @@ -68,25 +67,7 @@ jobs: - uses: actions/setup-node@v3 with: node-version: ${{ matrix.node-version }} - - name: Update to workable npm (windows) - # node 12 and 14 ship with npm@6, which is known to fail when updating itself in windows - if: matrix.platform.os == 'windows-latest' && (startsWith(matrix.node-version, '12.') || startsWith(matrix.node-version, '14.')) - run: | - curl -sO https://registry.npmjs.org/npm/-/npm-7.5.4.tgz - tar xf npm-7.5.4.tgz - cd package - node lib/npm.js install --no-fund --no-audit -g ..\npm-7.5.4.tgz - cd .. - rmdir /s /q package - - name: Update npm to 7 - # If we do test on npm 10 it needs npm7 - if: startsWith(matrix.node-version, '10.') - run: npm i --prefer-online --no-fund --no-audit -g npm@7 - - name: Update npm to latest - if: ${{ !startsWith(matrix.node-version, '10.') }} - run: npm i --prefer-online --no-fund --no-audit -g npm@latest - - run: npm -v - - run: npm i --ignore-scripts --no-audit --no-fund + - run: node . run resetdeps - name: add tap problem matcher run: echo "::add-matcher::.github/matchers/tap.json" - - run: npm test --ignore-scripts -w libnpmversion + - run: node . test --ignore-scripts -w libnpmversion diff --git a/.github/workflows/ci-npmcli-arborist.yml b/.github/workflows/ci-npmcli-arborist.yml index d2c83de9e..2ba261d6b 100644 --- a/.github/workflows/ci-npmcli-arborist.yml +++ b/.github/workflows/ci-npmcli-arborist.yml @@ -21,6 +21,7 @@ on: jobs: lint: + if: github.repository_owner == 'npm' runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 @@ -31,13 +32,11 @@ jobs: - uses: actions/setup-node@v3 with: node-version: 18.x - - name: Update npm to latest - run: npm i --prefer-online --no-fund --no-audit -g npm@latest - - run: npm -v - - run: npm i --ignore-scripts --no-audit --no-fund - - run: npm run lint -w @npmcli/arborist + - run: node . run resetdeps + - run: node . run lint -w @npmcli/arborist test: + if: github.repository_owner == 'npm' strategy: fail-fast: false matrix: @@ -68,25 +67,7 @@ jobs: - uses: actions/setup-node@v3 with: node-version: ${{ matrix.node-version }} - - name: Update to workable npm (windows) - # node 12 and 14 ship with npm@6, which is known to fail when updating itself in windows - if: matrix.platform.os == 'windows-latest' && (startsWith(matrix.node-version, '12.') || startsWith(matrix.node-version, '14.')) - run: | - curl -sO https://registry.npmjs.org/npm/-/npm-7.5.4.tgz - tar xf npm-7.5.4.tgz - cd package - node lib/npm.js install --no-fund --no-audit -g ..\npm-7.5.4.tgz - cd .. - rmdir /s /q package - - name: Update npm to 7 - # If we do test on npm 10 it needs npm7 - if: startsWith(matrix.node-version, '10.') - run: npm i --prefer-online --no-fund --no-audit -g npm@7 - - name: Update npm to latest - if: ${{ !startsWith(matrix.node-version, '10.') }} - run: npm i --prefer-online --no-fund --no-audit -g npm@latest - - run: npm -v - - run: npm i --ignore-scripts --no-audit --no-fund + - run: node . run resetdeps - name: add tap problem matcher run: echo "::add-matcher::.github/matchers/tap.json" - - run: npm test --ignore-scripts -w @npmcli/arborist + - run: node . test --ignore-scripts -w @npmcli/arborist diff --git a/.github/workflows/ci-smoke-tests.yml b/.github/workflows/ci-smoke-tests.yml new file mode 100644 index 000000000..3ac1ebefe --- /dev/null +++ b/.github/workflows/ci-smoke-tests.yml @@ -0,0 +1,73 @@ +# This file is automatically added by @npmcli/template-oss. Do not edit. + +name: CI - smoke-tests + +on: + workflow_dispatch: + pull_request: + branches: + - '*' + paths: + - smoke-tests/** + push: + branches: + - main + - latest + paths: + - smoke-tests/** + schedule: + # "At 09:00 UTC (02:00 PT) on Monday" https://crontab.guru/#0_9_*_*_1 + - cron: "0 9 * * 1" + +jobs: + lint: + if: github.repository_owner == 'npm' + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - name: Setup git user + run: | + git config --global user.email "npm-cli+bot@github.com" + git config --global user.name "npm CLI robot" + - uses: actions/setup-node@v3 + with: + node-version: 18.x + - run: node . run resetdeps + - run: node . run lint -w smoke-tests + + test: + if: github.repository_owner == 'npm' + strategy: + fail-fast: false + matrix: + node-version: + - 14.17.0 + - 14.x + - 16.13.0 + - 16.x + - 18.0.0 + - 18.x + platform: + - os: ubuntu-latest + shell: bash + - os: macos-latest + shell: bash + - os: windows-latest + shell: cmd + runs-on: ${{ matrix.platform.os }} + defaults: + run: + shell: ${{ matrix.platform.shell }} + steps: + - uses: actions/checkout@v3 + - name: Setup git user + run: | + git config --global user.email "npm-cli+bot@github.com" + git config --global user.name "npm CLI robot" + - uses: actions/setup-node@v3 + with: + node-version: ${{ matrix.node-version }} + - run: node . run resetdeps + - name: add tap problem matcher + run: echo "::add-matcher::.github/matchers/tap.json" + - run: node . test --ignore-scripts -w smoke-tests diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 8914fa041..df6c20a31 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,3 +1,5 @@ +# This file is automatically added by @npmcli/template-oss. Do not edit. + name: CI - cli on: @@ -5,63 +7,91 @@ on: pull_request: branches: - '*' + paths-ignore: + - docs/** + - smoke-tests/** + - workspaces/** push: branches: + - main - latest + paths-ignore: + - docs/** + - smoke-tests/** + - workspaces/** + schedule: + # "At 09:00 UTC (02:00 PT) on Monday" https://crontab.guru/#0_9_*_*_1 + - cron: "0 9 * * 1" jobs: lint: + if: github.repository_owner == 'npm' runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 - - name: Use Node.js 16.x - uses: actions/setup-node@v3 + - name: Setup git user + run: | + git config --global user.email "npm-cli+bot@github.com" + git config --global user.name "npm CLI robot" + - uses: actions/setup-node@v3 with: - node-version: 16.x + node-version: 18.x cache: npm - - run: node bin/npm-cli.js run resetdeps - - run: node bin/npm-cli.js run lint + - run: node . run resetdeps + - run: node . run lint check_docs: + if: github.repository_owner == 'npm' runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 - - name: Use Node.js 16.x - uses: actions/setup-node@v3 + - name: Setup git user + run: | + git config --global user.email "npm-cli+bot@github.com" + git config --global user.name "npm CLI robot" + - uses: actions/setup-node@v3 with: - node-version: 16.x + node-version: 18.x cache: npm + - run: node . run resetdeps - run: make freshdocs - run: node scripts/git-dirty.js licenses: + if: github.repository_owner == 'npm' runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 - - name: Use Node.js 16.x - uses: actions/setup-node@v3 + - name: Setup git user + run: | + git config --global user.email "npm-cli+bot@github.com" + git config --global user.name "npm CLI robot" + - uses: actions/setup-node@v3 with: - node-version: 16.x + node-version: 18.x cache: npm - - run: node bin/npm-cli.js run resetdeps - - run: node bin/npm-cli.js run licenses - + - run: node . run resetdeps + - run: node . run licenses + smoke-tests: + if: github.repository_owner == 'npm' runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 - - name: Use Node.js 16.x - uses: actions/setup-node@v3 + - name: Setup git user + run: | + git config --global user.email "npm-cli+bot@github.com" + git config --global user.name "npm CLI robot" + - uses: actions/setup-node@v3 with: - node-version: 16.x + node-version: 18.x cache: npm - - run: node bin/npm-cli.js run resetdeps - - run: node bin/npm-cli.js test -w smoke-tests --ignore-scripts - - name: git status - if: matrix.platform.os != 'windows-latest' - run: node scripts/git-dirty.js + - run: node . run resetdeps + - run: node . test -w smoke-tests --ignore-scripts + - run: node scripts/git-dirty.js test: + if: github.repository_owner == 'npm' strategy: fail-fast: false matrix: @@ -84,14 +114,17 @@ jobs: run: shell: ${{ matrix.platform.shell }} steps: - - uses: actions/checkout@v3 - - name: Use Node.js ${{ matrix.node-version }} - uses: actions/setup-node@v3 - with: - node-version: ${{ matrix.node-version }} - cache: npm - - run: node bin/npm-cli.js run resetdeps - - run: node bin/npm-cli.js run test --ignore-scripts - - name: git status - if: matrix.platform.os != 'windows-latest' - run: node scripts/git-dirty.js + - uses: actions/checkout@v3 + - name: Setup git user + run: | + git config --global user.email "npm-cli+bot@github.com" + git config --global user.name "npm CLI robot" + - uses: actions/setup-node@v3 + with: + node-version: ${{ matrix.node-version }} + cache: npm + - run: node . run resetdeps + - run: node . run test --ignore-scripts + - name: git status + if: matrix.platform.os != 'windows-latest' + run: node scripts/git-dirty.js diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml new file mode 100644 index 000000000..cfd0db300 --- /dev/null +++ b/.github/workflows/codeql-analysis.yml @@ -0,0 +1,44 @@ +# This file is automatically added by @npmcli/template-oss. Do not edit. + +name: "CodeQL" + +on: + push: + branches: + - main + - latest + pull_request: + # The branches below must be a subset of the branches above + branches: + - main + - latest + schedule: + # "At 10:00 UTC (03:00 PT) on Monday" https://crontab.guru/#0_10_*_*_1 + - cron: "0 10 * * 1" + +jobs: + analyze: + name: Analyze + runs-on: ubuntu-latest + permissions: + actions: read + contents: read + security-events: write + + strategy: + fail-fast: false + matrix: + language: [ javascript ] + + steps: + - uses: actions/checkout@v3 + - name: Setup git user + run: | + git config --global user.email "npm-cli+bot@github.com" + git config --global user.name "npm CLI robot" + - name: Initialize CodeQL + uses: github/codeql-action/init@v1 + with: + languages: ${{ matrix.language }} + - name: Perform CodeQL Analysis + uses: github/codeql-action/analyze@v1 diff --git a/.github/workflows/pull-request.yml b/.github/workflows/pull-request.yml new file mode 100644 index 000000000..2b9059b1c --- /dev/null +++ b/.github/workflows/pull-request.yml @@ -0,0 +1,36 @@ +# This file is automatically added by @npmcli/template-oss. Do not edit. + +name: Pull Request Linting + +on: + pull_request: + types: + - opened + - reopened + - edited + - synchronize + +jobs: + check: + name: Check PR Title or Commits + if: github.repository_owner == 'npm' + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + with: + fetch-depth: 0 + - name: Setup git user + run: | + git config --global user.email "npm-cli+bot@github.com" + git config --global user.name "npm CLI robot" + - uses: actions/setup-node@v3 + with: + node-version: 18.x + cache: npm + - run: node . run resetdeps + - name: Check commits or PR title + env: + PR_TITLE: ${{ github.event.pull_request.title }} + run: | + npx --offline commitlint -V --from origin/latest --to ${{ github.event.pull_request.head.sha }} \ + || echo $PR_TITLE | npx --offline commitlint -V diff --git a/.github/workflows/release-please.yml b/.github/workflows/release-please.yml index edd39d0ba..071ace6e8 100644 --- a/.github/workflows/release-please.yml +++ b/.github/workflows/release-please.yml @@ -14,10 +14,11 @@ permissions: jobs: release-please: - runs-on: ubuntu-latest outputs: pr: ${{ steps.release.outputs.pr }} release: ${{ steps.release.outputs.release }} + if: github.repository_owner == 'npm' + runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 - name: Setup git user @@ -27,10 +28,8 @@ jobs: - uses: actions/setup-node@v3 with: node-version: 18.x - - name: Update npm to latest - run: npm i --prefer-online --no-fund --no-audit -g npm@latest - - run: npm -v - - run: npm i --ignore-scripts --no-audit --no-fund + cache: npm + - run: node . run resetdeps - name: Release Please id: release run: npx --offline template-oss-release-please ${{ github.ref_name }} @@ -58,15 +57,13 @@ jobs: - uses: actions/setup-node@v3 with: node-version: 18.x - - name: Update npm to latest - run: npm i --prefer-online --no-fund --no-audit -g npm@latest - - run: npm -v - - run: npm i --ignore-scripts --no-audit --no-fund + cache: npm + - run: node . run resetdeps - name: Post pull request actions env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} run: | - npm run rp-pull-request --ignore-scripts --if-present -ws -iwr + node . run rp-pull-request --ignore-scripts --if-present -ws -iwr git commit -am "chore: post pull request" || true git push @@ -79,7 +76,7 @@ jobs: post-release: needs: release-please - if: needs.release-please.outputs.release + if: github.repository_owner == 'npm' && needs.release-please.outputs.release runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 @@ -90,12 +87,10 @@ jobs: - uses: actions/setup-node@v3 with: node-version: 18.x - - name: Update npm to latest - run: npm i --prefer-online --no-fund --no-audit -g npm@latest - - run: npm -v - - run: npm i --ignore-scripts --no-audit --no-fund + cache: npm + - run: node . run resetdeps - name: Post release actions env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} run: | - npm run rp-release --ignore-scripts --if-present -ws -iwr + node . run rp-release --ignore-scripts --if-present -ws -iwr diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 5035e2651..979d9b4fd 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,4 +1,6 @@ -name: Release - cli +# This file is automatically added by @npmcli/template-oss. Do not edit. + +name: Release on: workflow_call: @@ -9,20 +11,25 @@ on: jobs: lint-all: + if: github.repository_owner == 'npm' runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 with: ref: ${{ inputs.ref }} - - name: Use Node.js 16.x - uses: actions/setup-node@v3 + - name: Setup git user + run: | + git config --global user.email "npm-cli+bot@github.com" + git config --global user.name "npm CLI robot" + - uses: actions/setup-node@v3 with: - node-version: 16.x + node-version: 18.x cache: npm - - run: node bin/npm-cli.js run resetdeps - - run: node bin/npm-cli.js run lint-all --ignore-scripts + - run: node . run resetdeps + - run: node . run lint -ws -iwr --if-present - smoke-publish: + test-all: + if: github.repository_owner == 'npm' strategy: fail-fast: false matrix: @@ -38,8 +45,8 @@ jobs: shell: bash - os: macos-latest shell: bash - # XXX: this should be possible in windows also - # but resetdeps cant be a bash script + - os: windows-latest + shell: cmd runs-on: ${{ matrix.platform.os }} defaults: run: @@ -50,29 +57,19 @@ jobs: ref: ${{ inputs.ref }} - name: Setup git user run: | - git config --global user.email "ops+npm-cli@npmjs.com" - git config --global user.name "npm cli ops bot" - - name: Use Node.js 16.x - uses: actions/setup-node@v3 + git config --global user.email "npm-cli+bot@github.com" + git config --global user.name "npm CLI robot" + - uses: actions/setup-node@v3 with: - node-version: 16.x + node-version: ${{ matrix.node-version }} cache: npm - - name: Pack - run: | - NPM_VERSION="$(node bin/npm-cli.js --version)-$GITHUB_SHA.0" - node bin/npm-cli.js version $NPM_VERSION --ignore-scripts - node bin/npm-cli.js run resetdeps - git clean -fd - node bin/npm-cli.js ls --production >/dev/null - node bin/npm-cli.js prune --production --no-save --no-audit --no-fund - node scripts/git-dirty.js - node bin/npm-cli.js pack --pack-destination=$RUNNER_TEMP - node bin/npm-cli.js install -g $RUNNER_TEMP/npm-$NPM_VERSION.tgz - node bin/npm-cli.js install -w smoke-tests --ignore-scripts --no-audit --no-fund - rm -rf {lib,bin,index.js} - SMOKE_PUBLISH_NPM=1 npm test -w smoke-tests --ignore-scripts - - test-all: + - run: node . run resetdeps + - name: add tap problem matcher + run: echo "::add-matcher::.github/matchers/tap.json" + - run: node . run test -ws -iwr --if-present + + smoke-publish: + if: github.repository_owner == 'npm' strategy: fail-fast: false matrix: @@ -98,14 +95,26 @@ jobs: - uses: actions/checkout@v3 with: ref: ${{ inputs.ref }} - - name: Use Node.js ${{ matrix.node-version }} - uses: actions/setup-node@v3 + - name: Setup git user + run: | + git config --global user.email "npm-cli+bot@github.com" + git config --global user.name "npm CLI robot" + - uses: actions/setup-node@v3 with: node-version: ${{ matrix.node-version }} cache: npm - - run: node bin/npm-cli.js run resetdeps - - run: node bin/npm-cli.js link -f --ignore-scripts - - run: node bin/npm-cli.js run test-all --ignore-scripts - - name: git status - if: matrix.platform.os != 'windows-latest' - run: node scripts/git-dirty.js + - run: node . run resetdeps + - name: Pack + run: | + NPM_VERSION="$(node bin/npm-cli.js --version)-$GITHUB_SHA.0" + node bin/npm-cli.js version $NPM_VERSION --ignore-scripts + node bin/npm-cli.js run resetdeps + git clean -fd + node bin/npm-cli.js ls --production >/dev/null + node bin/npm-cli.js prune --production --no-save --no-audit --no-fund + node scripts/git-dirty.js + node bin/npm-cli.js pack --pack-destination=$RUNNER_TEMP + node bin/npm-cli.js install -g $RUNNER_TEMP/npm-$NPM_VERSION.tgz + node bin/npm-cli.js install -w smoke-tests --ignore-scripts --no-audit --no-fund + rm -rf {lib,bin,index.js} + SMOKE_PUBLISH_NPM=1 npm test -w smoke-tests --ignore-scripts |