diff --git a/.github/workflows/backend-tests.yml b/.github/workflows/backend-tests.yml index 85029bf..7e7e36e 100644 --- a/.github/workflows/backend-tests.yml +++ b/.github/workflows/backend-tests.yml @@ -14,6 +14,24 @@ jobs: runs-on: ubuntu-latest steps: + - + uses: pnpm/action-setup@v3 + name: Install pnpm + with: + version: 8 + - name: Get pnpm store directory + shell: bash + run: | + echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV + - uses: actions/cache@v4 + name: Setup pnpm cache + with: + path: ${{ env.STORE_PATH }} + key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }} + restore-keys: | + ${{ runner.os }}-pnpm-store- + - name: Only install direct dependencies + run: pnpm config set auto-install-peers false - name: Install libreoffice run: | @@ -25,6 +43,7 @@ jobs: uses: actions/checkout@v4 with: repository: ether/etherpad-lite + ref: develop - name: Checkout plugin repository uses: actions/checkout@v4 @@ -46,18 +65,11 @@ jobs: uses: actions/setup-node@v4 with: node-version: 20 - cache: 'npm' - cache-dependency-path: | - src/package-lock.json - src/bin/doc/package-lock.json - node_modules/${{ steps.plugin_name.outputs.plugin_name }}/package-lock.json - - run: npm install npm@6.14.18 -g - name: Install legacy npm for correct dependency resolution - name: Install plugin dependencies run: | cd ./node_modules/"${PLUGIN_NAME}" - npm ci + pnpm i env: PLUGIN_NAME: ${{ steps.plugin_name.outputs.plugin_name }} # Etherpad core dependencies must be installed after installing the @@ -74,4 +86,4 @@ jobs: run: src/bin/installDeps.sh - name: Run the backend tests - run: cd src && npm test + run: cd src && pnpm test diff --git a/.github/workflows/frontend-tests.yml b/.github/workflows/frontend-tests.yml index 58dd011..2f1466f 100644 --- a/.github/workflows/frontend-tests.yml +++ b/.github/workflows/frontend-tests.yml @@ -25,12 +25,23 @@ jobs: uses: actions/setup-node@v4 with: node-version: 20 - cache: 'npm' - cache-dependency-path: | - src/package-lock.json - src/bin/doc/package-lock.json - - run: npm install npm@6.14.18 -g - name: Install legacy npm for correct dependency resolution + - uses: pnpm/action-setup@v3 + name: Install pnpm + with: + version: 8 + - name: Get pnpm store directory + shell: bash + run: | + echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV + - uses: actions/cache@v4 + name: Setup pnpm cache + with: + path: ${{ env.STORE_PATH }} + key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }} + restore-keys: | + ${{ runner.os }}-pnpm-store- + - name: Only install direct dependencies + run: pnpm config set auto-install-peers false - name: Check out the plugin uses: actions/checkout@v4 @@ -60,7 +71,7 @@ jobs: PLUGIN_NAME: ${{ steps.plugin_name.outputs.plugin_name }} run: | cd ./node_modules/"${PLUGIN_NAME}" - npm ci + pnpm i # Etherpad core dependencies must be installed after installing the # plugin's dependencies, otherwise npm will try to hoist common # dependencies by removing them from src/node_modules and installing them diff --git a/.github/workflows/npmpublish.yml b/.github/workflows/npmpublish.yml index 0bcfc36..04a84c2 100644 --- a/.github/workflows/npmpublish.yml +++ b/.github/workflows/npmpublish.yml @@ -43,13 +43,23 @@ jobs: uses: actions/setup-node@v4 with: node-version: 20 - cache: 'npm' - cache-dependency-path: | - node_modules/ep_etherpad-lite/package-lock.json - node_modules/ep_etherpad-lite/bin/doc/package-lock.json - package-lock.json - - run: npm install npm@6.14.18 -g - name: Install legacy npm for correct dependency resolution + - uses: pnpm/action-setup@v3 + name: Install pnpm + with: + version: 8 + - name: Get pnpm store directory + shell: bash + run: | + echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV + - uses: actions/cache@v4 + name: Setup pnpm cache + with: + path: ${{ env.STORE_PATH }} + key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }} + restore-keys: | + ${{ runner.os }}-pnpm-store- + - name: Only install direct dependencies + run: pnpm config set auto-install-peers false # All of ep_etherpad-lite's devDependencies are installed because the # plugin might do `require('ep_etherpad-lite/node_modules/${devDep}')`. # Eventually it would be nice to create an ESLint plugin that prohibits @@ -57,9 +67,9 @@ jobs: # devDependencies. If we had that, we could change this line to only # install production dependencies. - - run: cd ../etherpad-lite/src && npm ci + run: cd ../etherpad-lite/src && pnpm i - - run: npm ci + run: pnpm i # This runs some sanity checks and creates a symlink at # node_modules/ep_etherpad-lite that points to ../../etherpad-lite/src. # This step must be done after `npm ci` installs the plugin's dependencies @@ -67,11 +77,14 @@ jobs: # ep_etherpad-lite in the plugin's node_modules prevents lint errors and # unit test failures if the plugin does `require('ep_etherpad-lite/foo')`. - - run: npm install --no-save ep_etherpad-lite@file:../etherpad-lite/src + run: pnpm install ep_etherpad-lite@file:../etherpad-lite/src - - run: npm test + run: | + ls -lisa + pwd + pnpm run test - - run: npm run lint + run: pnpm run lint publish-npm: if: github.event_name == 'push' @@ -87,9 +100,23 @@ jobs: with: node-version: 20 registry-url: https://registry.npmjs.org/ - cache: 'npm' - - run: npm install npm@6.14.18 -g - name: Install legacy npm for correct dependency resolution + - uses: pnpm/action-setup@v3 + name: Install pnpm + with: + version: 8 + - name: Get pnpm store directory + shell: bash + run: | + echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV + - uses: actions/cache@v4 + name: Setup pnpm cache + with: + path: ${{ env.STORE_PATH }} + key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }} + restore-keys: | + ${{ runner.os }}-pnpm-store- + - name: Only install direct dependencies + run: pnpm config set auto-install-peers false - name: Bump version (patch) run: | @@ -98,13 +125,13 @@ jobs: [ "${NEW_COMMITS}" -gt 0 ] || exit 0 git config user.name 'github-actions[bot]' git config user.email '41898282+github-actions[bot]@users.noreply.github.com' - npm ci + pnpm i npm version patch git push --follow-tags # This is required if the package has a prepare script that uses something # in dependencies or devDependencies. - - run: npm ci + run: pnpm i # `npm publish` must come after `git push` otherwise there is a race # condition: If two PRs are merged back-to-back then master/main will be # updated with the commits from the second PR before the first PR's