Updated pipeline templates.

This commit is contained in:
SamTV12345 2024-03-13 19:11:19 +01:00
parent f65043672c
commit a768b322cf
4 changed files with 96 additions and 109 deletions

View file

@ -189,13 +189,13 @@ const logger = log4js.getLogger('checkPlugin');
'eslint-plugin-you-dont-need-lodash-underscore': null,
});
await updateDeps(parsedPackageJSON, 'peerDependencies', {
/*await updateDeps(parsedPackageJSON, 'peerDependencies', {
// Some plugins require a newer version of Etherpad so don't overwrite if already set.
'ep_etherpad-lite': {ver: '>=1.8.6', overwrite: false},
});
});*/
await updateDeps(parsedPackageJSON, 'engines', {
node: '>=12.17.0',
node: '>=18.0.0',
});
if (parsedPackageJSON.eslintConfig != null && autoFix) {

View file

@ -16,10 +16,10 @@ jobs:
steps:
-
name: Install libreoffice
run: |
sudo add-apt-repository -y ppa:libreoffice/ppa
sudo apt update
sudo apt install -y --no-install-recommends libreoffice libreoffice-pdfimport
uses: awalsh128/cache-apt-pkgs-action@v1.4.2
with:
packages: libreoffice libreoffice-pdfimport
version: 1.0
-
name: Install etherpad core
uses: actions/checkout@v3
@ -42,22 +42,22 @@ jobs:
mv ./node_modules/__tmp ./node_modules/"${PLUGIN_NAME}"
env:
PLUGIN_NAME: ${{ steps.plugin_name.outputs.plugin_name }}
-
uses: actions/setup-node@v3
- uses: pnpm/action-setup@v3
name: Install pnpm
with:
node-version: 12
cache: 'npm'
cache-dependency-path: |
src/package-lock.json
bin/doc/package-lock.json
node_modules/${{ steps.plugin_name.outputs.plugin_name }}/package-lock.json
-
name: Install plugin dependencies
version: 8
run_install: false
- name: Get pnpm store directory
shell: bash
run: |
cd ./node_modules/"${PLUGIN_NAME}"
npm ci
env:
PLUGIN_NAME: ${{ steps.plugin_name.outputs.plugin_name }}
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-
# 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
@ -72,4 +72,4 @@ jobs:
run: bin/installDeps.sh
-
name: Run the backend tests
run: cd src && pnpm test
run: pnpm run test

View file

@ -1,6 +1,6 @@
# Publicly credit Sauce Labs because they generously support open source
# projects.
name: "frontend tests powered by Sauce Labs"
name: "Frontend Tests"
on: [push]
@ -9,36 +9,27 @@ jobs:
runs-on: ubuntu-latest
steps:
-
name: Fail if Dependabot
if: github.actor == 'dependabot[bot]'
run: |
cat <<EOF >&2
Frontend tests skipped because Dependabot can't access secrets.
Manually re-run the jobs to run the frontend tests.
For more information, see:
https://github.blog/changelog/2021-02-19-github-actions-workflows-triggered-by-dependabot-prs-will-run-with-read-only-permissions/
EOF
exit 1
-
name: Generate Sauce Labs strings
id: sauce_strings
run: |
printf %s\\n '::set-output name=name::${{github.event.repository.name}} ${{ github.workflow }} - ${{ github.job }}'
printf %s\\n '::set-output name=tunnel_id::${{ github.run_id }}-${{ github.run_number }}-${{ github.job }}'
-
name: Check out Etherpad core
uses: actions/checkout@v3
with:
repository: ether/etherpad-lite
-
uses: actions/setup-node@v3
- uses: pnpm/action-setup@v3
name: Install pnpm
with:
node-version: 12
cache: 'npm'
cache-dependency-path: |
src/package-lock.json
bin/doc/package-lock.json
version: 8
run_install: false
- 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: Check out the plugin
uses: actions/checkout@v3
@ -68,7 +59,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
@ -81,30 +72,22 @@ jobs:
-
name: Install Etherpad core dependencies
run: bin/installDeps.sh
-
name: Create settings.json
run: cp settings.json.template settings.json
-
name: Disable import/export rate limiting
run: |
sed -e '/^ *"importExportRateLimiting":/,/^ *\}/ s/"max":.*/"max": 0/' -i settings.json
-
name: Remove standard frontend test files
run: rm -rf src/tests/frontend/specs
-
uses: saucelabs/sauce-connect-action@v2.1.1
with:
username: ${{ secrets.SAUCE_USERNAME }}
accessKey: ${{ secrets.SAUCE_ACCESS_KEY }}
tunnelIdentifier: ${{ steps.sauce_strings.outputs.tunnel_id }}
-
name: Run the frontend tests
- name: Create settings.json
run: cp ./src/tests/settings.json settings.json
- name: Run the frontend tests
shell: bash
env:
SAUCE_USERNAME: ${{ secrets.SAUCE_USERNAME }}
SAUCE_ACCESS_KEY: ${{ secrets.SAUCE_ACCESS_KEY }}
SAUCE_NAME: ${{ steps.sauce_strings.outputs.name }}
TRAVIS_JOB_NUMBER: ${{ steps.sauce_strings.outputs.tunnel_id }}
GIT_HASH: ${{ steps.environment.outputs.sha_short }}
run: |
src/tests/frontend/travis/runner.sh
pnpm run dev &
connected=false
can_connect() {
curl -sSfo /dev/null http://localhost:9001/ || return 1
connected=true
}
now() { date +%s; }
start=$(now)
while [ $(($(now) - $start)) -le 15 ] && ! can_connect; do
sleep 1
done
cd src
pnpm exec playwright install chromium --with-deps
pnpm run test-ui --project=chromium

View file

@ -32,42 +32,34 @@ jobs:
# safe to clone this plugin's repo to $GITHUB_WORKSPACE.
-
uses: actions/checkout@v3
# This is necessary for actions/setup-node because '..' can't be used in
# cache-dependency-path.
-
name: Create ep_etherpad-lite symlink
run: |
mkdir -p node_modules
ln -s ../../etherpad-lite/src node_modules/ep_etherpad-lite
-
uses: actions/setup-node@v3
- uses: pnpm/action-setup@v3
name: Install pnpm
with:
node-version: 12
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
version: 8
run_install: false
- 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-
# 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
# Etherpad plugins from piggybacking off of ep_etherpad-lite's
# devDependencies. If we had that, we could change this line to only
# install production dependencies.
- run: pnpm i && pnpm link --global
-
run: cd ../etherpad-lite/src && npm ci
run: cd ../etherpad-lite/src && pnpm i && pnpm link $PLUGIN_NAME
-
run: npm ci
# 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
# because npm "helpfully" cleans up such symlinks. :( Installing
# 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: npm test
run: pnpm run test
-
run: npm run lint
@ -76,16 +68,28 @@ jobs:
needs: test
runs-on: ubuntu-latest
steps:
-
uses: actions/checkout@v3
- uses: pnpm/action-setup@v3
name: Install pnpm
with:
version: 8
run_install: false
- 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-
-
uses: actions/checkout@v3
with:
fetch-depth: 0
-
uses: actions/setup-node@v3
with:
node-version: 12
registry-url: https://registry.npmjs.org/
cache: 'npm'
-
name: Bump version (patch)
run: |
@ -94,13 +98,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
npm version patch
pnpm i
pnpm 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