From e13ebb5c98562aa3d6948431076a457f0ae0472e Mon Sep 17 00:00:00 2001 From: Nathan Fritz Date: Tue, 16 Nov 2021 10:27:55 -0800 Subject: [PATCH] separate github actions for workspaces PR-URL: https://github.com/npm/cli/pull/4050 Credit: @fritzy Close: #4050 Reviewed-by: @wraithgar PR-URL: https://github.com/npm/cli/pull/4050 Credit: @fritzy Close: #4050 Reviewed-by: @wraithgar --- .github/workflows/ci-docs.yml | 52 ++++++++++++ .github/workflows/ci-libnpmdiff.yml | 76 ++++++++++++++++++ .github/workflows/ci.yml | 46 +---------- docs/package.json | 4 +- node_modules/libnpmdiff | 2 +- package-lock.json | 28 ++++++- package.json | 4 +- .../libnpmdiff/.eslintrc.json | 0 .../libnpmdiff/.gitignore | 0 .../libnpmdiff/CHANGELOG.md | 0 {packages => workspaces}/libnpmdiff/LICENSE | 0 {packages => workspaces}/libnpmdiff/README.md | 0 {packages => workspaces}/libnpmdiff/index.js | 0 .../libnpmdiff/lib/format-diff.js | 0 .../libnpmdiff/lib/should-print-patch.js | 0 .../libnpmdiff/lib/tarball.js | 0 .../libnpmdiff/lib/untar.js | 0 .../libnpmdiff/package.json | 0 .../test/format-diff.js.test.cjs | 0 .../tap-snapshots/test/index.js.test.cjs | 0 .../tap-snapshots/test/untar.js.test.cjs | 0 .../libnpmdiff/test/fixtures/archive.tgz | Bin ...orno-simplistic-pkg-with-folders-1.0.0.tgz | Bin .../test/fixtures/simple-output-2.2.1.tgz | Bin .../libnpmdiff/test/format-diff.js | 0 .../libnpmdiff/test/index.js | 0 .../libnpmdiff/test/should-print-patch.js | 0 .../libnpmdiff/test/tarball.js | 0 .../libnpmdiff/test/untar.js | 0 29 files changed, 162 insertions(+), 50 deletions(-) create mode 100644 .github/workflows/ci-docs.yml create mode 100644 .github/workflows/ci-libnpmdiff.yml rename {packages => workspaces}/libnpmdiff/.eslintrc.json (100%) rename {packages => workspaces}/libnpmdiff/.gitignore (100%) rename {packages => workspaces}/libnpmdiff/CHANGELOG.md (100%) rename {packages => workspaces}/libnpmdiff/LICENSE (100%) rename {packages => workspaces}/libnpmdiff/README.md (100%) rename {packages => workspaces}/libnpmdiff/index.js (100%) rename {packages => workspaces}/libnpmdiff/lib/format-diff.js (100%) rename {packages => workspaces}/libnpmdiff/lib/should-print-patch.js (100%) rename {packages => workspaces}/libnpmdiff/lib/tarball.js (100%) rename {packages => workspaces}/libnpmdiff/lib/untar.js (100%) rename {packages => workspaces}/libnpmdiff/package.json (100%) rename {packages => workspaces}/libnpmdiff/tap-snapshots/test/format-diff.js.test.cjs (100%) rename {packages => workspaces}/libnpmdiff/tap-snapshots/test/index.js.test.cjs (100%) rename {packages => workspaces}/libnpmdiff/tap-snapshots/test/untar.js.test.cjs (100%) rename {packages => workspaces}/libnpmdiff/test/fixtures/archive.tgz (100%) rename {packages => workspaces}/libnpmdiff/test/fixtures/ruyadorno-simplistic-pkg-with-folders-1.0.0.tgz (100%) rename {packages => workspaces}/libnpmdiff/test/fixtures/simple-output-2.2.1.tgz (100%) rename {packages => workspaces}/libnpmdiff/test/format-diff.js (100%) rename {packages => workspaces}/libnpmdiff/test/index.js (100%) rename {packages => workspaces}/libnpmdiff/test/should-print-patch.js (100%) rename {packages => workspaces}/libnpmdiff/test/tarball.js (100%) rename {packages => workspaces}/libnpmdiff/test/untar.js (100%) diff --git a/.github/workflows/ci-docs.yml b/.github/workflows/ci-docs.yml new file mode 100644 index 0000000000000..67a075227017a --- /dev/null +++ b/.github/workflows/ci-docs.yml @@ -0,0 +1,52 @@ +name: Node CI docs + +on: + pull_request: + paths: + - docs/** + branches: + - '*' + push: + paths: + - docs/** + branches: + - release-next + - latest + workflow_dispatch: + +jobs: + lint: + runs-on: ubuntu-latest + steps: + # Checkout the npm/cli repo + - uses: actions/checkout@v2 + - name: Use Node.js 14.x + uses: actions/setup-node@v2 + with: + node-version: 14.x + cache: npm + - name: Install dependencies + run: | + node ./bin/npm-cli.js install --ignore-scripts --no-audit + node ./bin/npm-cli.js rebuild + - name: Run linting + run: node ./bin/npm-cli.js run lint -w docs + env: + DEPLOY_VERSION: testing + + check_docs: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: Use Node.js 14.x + uses: actions/setup-node@v2 + with: + node-version: 14.x + cache: npm + - name: Install dependencies + run: | + node ./bin/npm-cli.js install --ignore-scripts --no-audit + - name: Rebuild the docs + run: make freshdocs + - name: Git should not be dirty + run: node scripts/git-dirty.js diff --git a/.github/workflows/ci-libnpmdiff.yml b/.github/workflows/ci-libnpmdiff.yml new file mode 100644 index 0000000000000..5f8a20f64cedb --- /dev/null +++ b/.github/workflows/ci-libnpmdiff.yml @@ -0,0 +1,76 @@ +name: Node CI libnpmdiff + +on: + pull_request: + paths: + - workspaces/libnpmdiff/** + branches: + - '*' + push: + paths: + - workspaces/libnpmdiff/** + branches: + - release-next + - latest + workflow_dispatch: + +jobs: + lint: + runs-on: ubuntu-latest + steps: + # Checkout the npm/cli repo + - uses: actions/checkout@v2 + - name: Use Node.js 14.x + uses: actions/setup-node@v2 + with: + node-version: 14.x + cache: npm + - name: Install dependencies + run: | + node ./bin/npm-cli.js install --ignore-scripts --no-audit + node ./bin/npm-cli.js rebuild + - name: Run linting + run: node ./bin/npm-cli.js run posttest -w libnpmdiff + env: + DEPLOY_VERSION: testing + + test: + strategy: + fail-fast: false + matrix: + node-version: ['12.13.0', 12.x, '14.15.0', 14.x, '16.0.0', 16.x] + platform: + - os: ubuntu-latest + shell: bash + - os: macos-latest + shell: bash + - os: windows-latest + shell: bash + - os: windows-latest + shell: powershell + + runs-on: ${{ matrix.platform.os }} + defaults: + run: + shell: ${{ matrix.platform.shell }} + + steps: + # Checkout the npm/cli repo + - uses: actions/checkout@v2 + + # Installs the specific version of Node.js + - name: Use Node.js ${{ matrix.node-version }} + uses: actions/setup-node@v2 + with: + node-version: ${{ matrix.node-version }} + cache: npm + + # Run the installer script + - name: Install dependencies + run: | + node ./bin/npm-cli.js install --ignore-scripts --no-audit + node ./bin/npm-cli.js rebuild + + # Run the tests, but not if we're just gonna do coveralls later anyway + - name: Run Tap tests + run: node ./bin/npm-cli.js run -w libnpmdiff --ignore-scripts test -- -t600 -Rbase -c diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 3fba2a3ba3ad1..473e30f37a57d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -8,6 +8,8 @@ on: branches: - release-next - latest + workflow_dispatch: + jobs: lint: runs-on: ubuntu-latest @@ -106,49 +108,7 @@ jobs: env: DEPLOY_VERSION: testing - workspaces-tests: - strategy: - fail-fast: false - matrix: - node-version: [12.x, 14.x, 16.x] - platform: - - os: ubuntu-latest - shell: bash - - os: macos-latest - shell: bash - - os: windows-latest - shell: bash - - os: windows-latest - shell: powershell - - runs-on: ${{ matrix.platform.os }} - defaults: - run: - shell: ${{ matrix.platform.shell }} - - steps: - # Checkout the npm/cli repo - - uses: actions/checkout@v2 - - # Installs the specific version of Node.js - - name: Use Node.js ${{ matrix.node-version }} - uses: actions/setup-node@v2 - with: - node-version: ${{ matrix.node-version }} - cache: npm - - # Run the installer script - - name: Install dependencies - run: | - node ./bin/npm-cli.js install --ignore-scripts --no-audit - node ./bin/npm-cli.js rebuild - - - name: Run workspaces tests - run: node ./bin/npm-cli.js test -w ./packages -- --no-check-coverage -t600 -Rbase -c - env: - DEPLOY_VERSION: testing - - build: + test: strategy: fail-fast: false matrix: diff --git a/docs/package.json b/docs/package.json index e48785bdba923..9e594a12f9881 100644 --- a/docs/package.json +++ b/docs/package.json @@ -3,7 +3,9 @@ "description": "The npm cli documentation", "version": "1.0.0", "scripts": { - "build": "node dockhand" + "build": "node dockhand", + "eslint": "eslint", + "lint": "npm run eslint -- ./*.js" }, "repository": { "type": "git", diff --git a/node_modules/libnpmdiff b/node_modules/libnpmdiff index ae8dd62893029..70ab2f9c6bbee 120000 --- a/node_modules/libnpmdiff +++ b/node_modules/libnpmdiff @@ -1 +1 @@ -../packages/libnpmdiff \ No newline at end of file +../workspaces/libnpmdiff \ No newline at end of file diff --git a/package-lock.json b/package-lock.json index d679c943760db..421ee28410dca 100644 --- a/package-lock.json +++ b/package-lock.json @@ -82,7 +82,7 @@ "license": "Artistic-2.0", "workspaces": [ "docs", - "packages/*" + "workspaces/*" ], "dependencies": { "@isaacs/string-locale-compare": "^1.1.0", @@ -4532,7 +4532,7 @@ } }, "node_modules/libnpmdiff": { - "resolved": "packages/libnpmdiff", + "resolved": "workspaces/libnpmdiff", "link": true }, "node_modules/libnpmexec": { @@ -10044,6 +10044,28 @@ } }, "packages/libnpmdiff": { + "version": "2.0.4", + "extraneous": true, + "license": "ISC", + "dependencies": { + "@npmcli/disparity-colors": "^1.0.1", + "@npmcli/installed-package-contents": "^1.0.7", + "binary-extensions": "^2.2.0", + "diff": "^5.0.0", + "minimatch": "^3.0.4", + "npm-package-arg": "^8.1.4", + "pacote": "^12.0.0", + "tar": "^6.1.0" + }, + "devDependencies": { + "eslint": "^8.1.0", + "tap": "^15.0.9" + }, + "engines": { + "node": ">=10" + } + }, + "workspaces/libnpmdiff": { "version": "2.0.4", "license": "ISC", "dependencies": { @@ -13321,7 +13343,7 @@ } }, "libnpmdiff": { - "version": "file:packages/libnpmdiff", + "version": "file:workspaces/libnpmdiff", "requires": { "@npmcli/disparity-colors": "^1.0.1", "@npmcli/installed-package-contents": "^1.0.7", diff --git a/package.json b/package.json index 02ee5c387af84..541bd38928eba 100644 --- a/package.json +++ b/package.json @@ -4,7 +4,7 @@ "description": "a package manager for JavaScript", "workspaces": [ "docs", - "packages/*" + "workspaces/*" ], "files": [ "index.js", @@ -217,7 +217,7 @@ "sudotest:nocleanup": "sudo NO_TEST_CLEANUP=1 npm run test --", "posttest": "npm run lint", "eslint": "eslint", - "lint": "npm run eslint -- bin docs lib scripts smoke-tests test ./*.js", + "lint": "npm run eslint -- bin lib scripts smoke-tests test ./*.js", "lintfix": "npm run lint -- --fix", "prelint": "rimraf test/npm_cache*", "resetdeps": "bash scripts/resetdeps.sh", diff --git a/packages/libnpmdiff/.eslintrc.json b/workspaces/libnpmdiff/.eslintrc.json similarity index 100% rename from packages/libnpmdiff/.eslintrc.json rename to workspaces/libnpmdiff/.eslintrc.json diff --git a/packages/libnpmdiff/.gitignore b/workspaces/libnpmdiff/.gitignore similarity index 100% rename from packages/libnpmdiff/.gitignore rename to workspaces/libnpmdiff/.gitignore diff --git a/packages/libnpmdiff/CHANGELOG.md b/workspaces/libnpmdiff/CHANGELOG.md similarity index 100% rename from packages/libnpmdiff/CHANGELOG.md rename to workspaces/libnpmdiff/CHANGELOG.md diff --git a/packages/libnpmdiff/LICENSE b/workspaces/libnpmdiff/LICENSE similarity index 100% rename from packages/libnpmdiff/LICENSE rename to workspaces/libnpmdiff/LICENSE diff --git a/packages/libnpmdiff/README.md b/workspaces/libnpmdiff/README.md similarity index 100% rename from packages/libnpmdiff/README.md rename to workspaces/libnpmdiff/README.md diff --git a/packages/libnpmdiff/index.js b/workspaces/libnpmdiff/index.js similarity index 100% rename from packages/libnpmdiff/index.js rename to workspaces/libnpmdiff/index.js diff --git a/packages/libnpmdiff/lib/format-diff.js b/workspaces/libnpmdiff/lib/format-diff.js similarity index 100% rename from packages/libnpmdiff/lib/format-diff.js rename to workspaces/libnpmdiff/lib/format-diff.js diff --git a/packages/libnpmdiff/lib/should-print-patch.js b/workspaces/libnpmdiff/lib/should-print-patch.js similarity index 100% rename from packages/libnpmdiff/lib/should-print-patch.js rename to workspaces/libnpmdiff/lib/should-print-patch.js diff --git a/packages/libnpmdiff/lib/tarball.js b/workspaces/libnpmdiff/lib/tarball.js similarity index 100% rename from packages/libnpmdiff/lib/tarball.js rename to workspaces/libnpmdiff/lib/tarball.js diff --git a/packages/libnpmdiff/lib/untar.js b/workspaces/libnpmdiff/lib/untar.js similarity index 100% rename from packages/libnpmdiff/lib/untar.js rename to workspaces/libnpmdiff/lib/untar.js diff --git a/packages/libnpmdiff/package.json b/workspaces/libnpmdiff/package.json similarity index 100% rename from packages/libnpmdiff/package.json rename to workspaces/libnpmdiff/package.json diff --git a/packages/libnpmdiff/tap-snapshots/test/format-diff.js.test.cjs b/workspaces/libnpmdiff/tap-snapshots/test/format-diff.js.test.cjs similarity index 100% rename from packages/libnpmdiff/tap-snapshots/test/format-diff.js.test.cjs rename to workspaces/libnpmdiff/tap-snapshots/test/format-diff.js.test.cjs diff --git a/packages/libnpmdiff/tap-snapshots/test/index.js.test.cjs b/workspaces/libnpmdiff/tap-snapshots/test/index.js.test.cjs similarity index 100% rename from packages/libnpmdiff/tap-snapshots/test/index.js.test.cjs rename to workspaces/libnpmdiff/tap-snapshots/test/index.js.test.cjs diff --git a/packages/libnpmdiff/tap-snapshots/test/untar.js.test.cjs b/workspaces/libnpmdiff/tap-snapshots/test/untar.js.test.cjs similarity index 100% rename from packages/libnpmdiff/tap-snapshots/test/untar.js.test.cjs rename to workspaces/libnpmdiff/tap-snapshots/test/untar.js.test.cjs diff --git a/packages/libnpmdiff/test/fixtures/archive.tgz b/workspaces/libnpmdiff/test/fixtures/archive.tgz similarity index 100% rename from packages/libnpmdiff/test/fixtures/archive.tgz rename to workspaces/libnpmdiff/test/fixtures/archive.tgz diff --git a/packages/libnpmdiff/test/fixtures/ruyadorno-simplistic-pkg-with-folders-1.0.0.tgz b/workspaces/libnpmdiff/test/fixtures/ruyadorno-simplistic-pkg-with-folders-1.0.0.tgz similarity index 100% rename from packages/libnpmdiff/test/fixtures/ruyadorno-simplistic-pkg-with-folders-1.0.0.tgz rename to workspaces/libnpmdiff/test/fixtures/ruyadorno-simplistic-pkg-with-folders-1.0.0.tgz diff --git a/packages/libnpmdiff/test/fixtures/simple-output-2.2.1.tgz b/workspaces/libnpmdiff/test/fixtures/simple-output-2.2.1.tgz similarity index 100% rename from packages/libnpmdiff/test/fixtures/simple-output-2.2.1.tgz rename to workspaces/libnpmdiff/test/fixtures/simple-output-2.2.1.tgz diff --git a/packages/libnpmdiff/test/format-diff.js b/workspaces/libnpmdiff/test/format-diff.js similarity index 100% rename from packages/libnpmdiff/test/format-diff.js rename to workspaces/libnpmdiff/test/format-diff.js diff --git a/packages/libnpmdiff/test/index.js b/workspaces/libnpmdiff/test/index.js similarity index 100% rename from packages/libnpmdiff/test/index.js rename to workspaces/libnpmdiff/test/index.js diff --git a/packages/libnpmdiff/test/should-print-patch.js b/workspaces/libnpmdiff/test/should-print-patch.js similarity index 100% rename from packages/libnpmdiff/test/should-print-patch.js rename to workspaces/libnpmdiff/test/should-print-patch.js diff --git a/packages/libnpmdiff/test/tarball.js b/workspaces/libnpmdiff/test/tarball.js similarity index 100% rename from packages/libnpmdiff/test/tarball.js rename to workspaces/libnpmdiff/test/tarball.js diff --git a/packages/libnpmdiff/test/untar.js b/workspaces/libnpmdiff/test/untar.js similarity index 100% rename from packages/libnpmdiff/test/untar.js rename to workspaces/libnpmdiff/test/untar.js