mirror of
https://github.com/ether/etherpad-lite.git
synced 2025-01-31 19:02:59 +01:00
Added updated workflow runners.
This commit is contained in:
parent
324ac44ad3
commit
107598b4b3
8 changed files with 87 additions and 118 deletions
|
@ -30,7 +30,7 @@
|
||||||
"migrateDirtyDBtoRealDB": "node --import tsx migrateDirtyDBtoRealDB.ts",
|
"migrateDirtyDBtoRealDB": "node --import tsx migrateDirtyDBtoRealDB.ts",
|
||||||
"rebuildPad": "node --import tsx rebuildPad.ts",
|
"rebuildPad": "node --import tsx rebuildPad.ts",
|
||||||
"stalePlugins": "node --import tsx ./plugins/stalePlugins.ts",
|
"stalePlugins": "node --import tsx ./plugins/stalePlugins.ts",
|
||||||
"checkPlugins": "node --import tsx ./plugins/checkPlugins.ts",
|
"checkPlugin": "node --import tsx ./plugins/checkPlugin.ts",
|
||||||
"install-plugins": "node --import tsx ./installPlugins.ts"
|
"install-plugins": "node --import tsx ./installPlugins.ts"
|
||||||
},
|
},
|
||||||
"author": "",
|
"author": "",
|
||||||
|
|
|
@ -35,7 +35,7 @@ const logger = log4js.getLogger('checkPlugin');
|
||||||
const epRootDir = await fsp.realpath(path.join(await fsp.realpath(__dirname), '../..'));
|
const epRootDir = await fsp.realpath(path.join(await fsp.realpath(__dirname), '../..'));
|
||||||
logger.info(`Etherpad root directory: ${epRootDir}`);
|
logger.info(`Etherpad root directory: ${epRootDir}`);
|
||||||
process.chdir(epRootDir);
|
process.chdir(epRootDir);
|
||||||
const pluginPath = await fsp.realpath(`node_modules/${pluginName}`);
|
const pluginPath = await fsp.realpath(`../${pluginName}`);
|
||||||
logger.info(`Plugin directory: ${pluginPath}`);
|
logger.info(`Plugin directory: ${pluginPath}`);
|
||||||
const epSrcDir = await fsp.realpath(path.join(epRootDir, 'src'));
|
const epSrcDir = await fsp.realpath(path.join(epRootDir, 'src'));
|
||||||
|
|
||||||
|
@ -173,10 +173,10 @@ const logger = log4js.getLogger('checkPlugin');
|
||||||
const parsedPackageJSON = JSON.parse(packageJSON);
|
const parsedPackageJSON = JSON.parse(packageJSON);
|
||||||
|
|
||||||
await updateDeps(parsedPackageJSON, 'devDependencies', {
|
await updateDeps(parsedPackageJSON, 'devDependencies', {
|
||||||
'eslint': '^8.14.0',
|
'eslint': '^8.57.0',
|
||||||
'eslint-config-etherpad': '^3.0.13',
|
'eslint-config-etherpad': '^3.0.22',
|
||||||
// Changing the TypeScript version can break plugin code, so leave it alone if present.
|
// Changing the TypeScript version can break plugin code, so leave it alone if present.
|
||||||
'typescript': {ver: '^4.6.4', overwrite: false},
|
'typescript': {ver: '^5.4.2', overwrite: false},
|
||||||
// These were moved to eslint-config-etherpad's dependencies so they can be removed:
|
// These were moved to eslint-config-etherpad's dependencies so they can be removed:
|
||||||
'@typescript-eslint/eslint-plugin': null,
|
'@typescript-eslint/eslint-plugin': null,
|
||||||
'@typescript-eslint/parser': null,
|
'@typescript-eslint/parser': null,
|
||||||
|
@ -216,7 +216,7 @@ const logger = log4js.getLogger('checkPlugin');
|
||||||
logger.error(`both ${from} and ${to} exist; delete ${from}`);
|
logger.error(`both ${from} and ${to} exist; delete ${from}`);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
checkFile('bin/plugins/lib/eslintrc.cjs', '.eslintrc.cjs', false);
|
await checkFile('bin/plugins/lib/eslintrc.cjs', '.eslintrc.cjs', false);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (checkEntries(parsedPackageJSON, {
|
if (checkEntries(parsedPackageJSON, {
|
||||||
|
@ -237,6 +237,12 @@ const logger = log4js.getLogger('checkPlugin');
|
||||||
logger.warn('package-lock.json not found');
|
logger.warn('package-lock.json not found');
|
||||||
if (!autoFix) {
|
if (!autoFix) {
|
||||||
logger.warn('Run npm install in the plugin folder and commit the package-lock.json file.');
|
logger.warn('Run npm install in the plugin folder and commit the package-lock.json file.');
|
||||||
|
} else {
|
||||||
|
logger.info('Autofixing missing package-lock.json file');
|
||||||
|
execSync('pnpm install', {
|
||||||
|
cwd: `${pluginPath}/`,
|
||||||
|
stdio: 'inherit',
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -15,25 +15,27 @@ cd "${mydir}/../.."
|
||||||
pdir=$(cd .. && pwd -P) || exit 1
|
pdir=$(cd .. && pwd -P) || exit 1
|
||||||
|
|
||||||
plugins=$("${mydir}/listOfficialPlugins") || exit 1
|
plugins=$("${mydir}/listOfficialPlugins") || exit 1
|
||||||
|
echo $plugins
|
||||||
for d in ${plugins}; do
|
for d in ${plugins}; do
|
||||||
|
echo $d
|
||||||
log "============================================================"
|
log "============================================================"
|
||||||
log "${d}"
|
log "${d}"
|
||||||
log "============================================================"
|
log "============================================================"
|
||||||
fd=${pdir}/${d}
|
fd=${pdir}/${d}
|
||||||
repo=git@github.com:ether/${plugin}.git
|
repo=https://github.com/ether/${d}.git
|
||||||
[ -d "${fd}" ] || {
|
[ -d "${fd}" ] || {
|
||||||
log "Cloning ${repo} to ${fd}..."
|
log "Cloning ${repo} to ${fd}..."
|
||||||
(cd "${pdir}" && git clone "${repo}" "${d}") || exit 1
|
(cd "${pdir}" && git clone "${repo}" "${d}") || continue
|
||||||
} || exit 1
|
} || exit 1
|
||||||
log "Fetching latest commits..."
|
log "Fetching latest commits..."
|
||||||
(cd "${fd}" && git pull --ff-only) || exit 1
|
(cd "${fd}" && git pull --ff-only) || exit 1
|
||||||
log "Getting plugin name..."
|
#log "Getting plugin name..."
|
||||||
pn=$(cd "${fd}" && npx -c 'printf %s\\n "${npm_package_name}"') || exit 1
|
#pn=$(cd "${fd}" && npx -c 'printf %s\\n "${npm_package_name}"') || exit 1
|
||||||
[ -n "${pn}" ] || fatal "Unable to determine plugin name for ${d}"
|
#[ -n "${pn}" ] || fatal "Unable to determine plugin name for ${d}"
|
||||||
md=node_modules/${pn}
|
#md=node_modules/${pn}
|
||||||
[ -d "${md}" ] || {
|
#[ -d "${md}" ] || {
|
||||||
log "Installing plugin to ${md}..."
|
# log "Installing plugin to ${md}..."
|
||||||
ln -s ../../"${d}" "${md}"
|
# ln -s ../../"${d}" "${md}"
|
||||||
} || exit 1
|
#} || exit 1
|
||||||
[ "${md}" -ef "${fd}" ] || fatal "${md} is not a symlink to ${fd}"
|
#[ "${md}" -ef "${fd}" ] || fatal "${md} is not a symlink to ${fd}"
|
||||||
done
|
done
|
||||||
|
|
|
@ -1,7 +1,8 @@
|
||||||
name: "Backend tests"
|
name: Backend Tests
|
||||||
|
|
||||||
# any branch is useful for testing before a PR is submitted
|
# any branch is useful for testing before a PR is submitted
|
||||||
on: [push, pull_request]
|
on:
|
||||||
|
workflow_call:
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
withplugins:
|
withplugins:
|
||||||
|
@ -12,7 +13,6 @@ jobs:
|
||||||
|| (github.event.pull_request.head.repo.id != github.event.pull_request.base.repo.id)
|
|| (github.event.pull_request.head.repo.id != github.event.pull_request.base.repo.id)
|
||||||
name: with Plugins
|
name: with Plugins
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
-
|
-
|
||||||
name: Install libreoffice
|
name: Install libreoffice
|
||||||
|
@ -25,23 +25,7 @@ jobs:
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v3
|
||||||
with:
|
with:
|
||||||
repository: ether/etherpad-lite
|
repository: ether/etherpad-lite
|
||||||
-
|
path: etherpad-lite
|
||||||
name: Checkout plugin repository
|
|
||||||
uses: actions/checkout@v3
|
|
||||||
with:
|
|
||||||
path: ./node_modules/__tmp
|
|
||||||
-
|
|
||||||
name: Determine plugin name
|
|
||||||
id: plugin_name
|
|
||||||
run: |
|
|
||||||
cd ./node_modules/__tmp
|
|
||||||
npx -c 'printf %s\\n "::set-output name=plugin_name::${npm_package_name}"'
|
|
||||||
-
|
|
||||||
name: Rename plugin directory
|
|
||||||
run: |
|
|
||||||
mv ./node_modules/__tmp ./node_modules/"${PLUGIN_NAME}"
|
|
||||||
env:
|
|
||||||
PLUGIN_NAME: ${{ steps.plugin_name.outputs.plugin_name }}
|
|
||||||
- uses: pnpm/action-setup@v3
|
- uses: pnpm/action-setup@v3
|
||||||
name: Install pnpm
|
name: Install pnpm
|
||||||
with:
|
with:
|
||||||
|
@ -58,18 +42,45 @@ jobs:
|
||||||
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
|
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
|
||||||
restore-keys: |
|
restore-keys: |
|
||||||
${{ runner.os }}-pnpm-store-
|
${{ runner.os }}-pnpm-store-
|
||||||
# Etherpad core dependencies must be installed after installing the
|
-
|
||||||
# plugin's dependencies, otherwise npm will try to hoist common
|
name: Checkout plugin repository
|
||||||
# dependencies by removing them from src/node_modules and installing them
|
uses: actions/checkout@v3
|
||||||
# in the top-level node_modules. As of v6.14.10, npm's hoist logic appears
|
with:
|
||||||
# to be buggy, because it sometimes removes dependencies from
|
path: plugin
|
||||||
# src/node_modules but fails to add them to the top-level node_modules.
|
-
|
||||||
# Even if npm correctly hoists the dependencies, the hoisting seems to
|
name: Determine plugin name
|
||||||
# confuse tools such as `npm outdated`, `npm update`, and some ESLint
|
id: plugin_name
|
||||||
# rules.
|
working-directory: ./plugin
|
||||||
|
run: |
|
||||||
|
npx -c 'printf %s\\n "::set-output name=plugin_name::${npm_package_name}"'
|
||||||
|
-
|
||||||
|
name: Link plugin directory
|
||||||
|
working-directory: ./plugin
|
||||||
|
run: |
|
||||||
|
pnpm link --global
|
||||||
|
- name: Remove tests
|
||||||
|
working-directory: ./etherpad-lite
|
||||||
|
run: rm -rf ./src/tests/backend/specs
|
||||||
-
|
-
|
||||||
name: Install Etherpad core dependencies
|
name: Install Etherpad core dependencies
|
||||||
|
working-directory: ./etherpad-lite
|
||||||
run: bin/installDeps.sh
|
run: bin/installDeps.sh
|
||||||
|
- name: Link plugin to etherpad-lite
|
||||||
|
working-directory: ./etherpad-lite
|
||||||
|
run: |
|
||||||
|
pnpm link --global $PLUGIN_NAME
|
||||||
|
pnpm run install-plugins --path ../../plugin
|
||||||
|
env:
|
||||||
|
PLUGIN_NAME: ${{ steps.plugin_name.outputs.plugin_name }}
|
||||||
|
- name: Link ep_etherpad-lite
|
||||||
|
working-directory: ./etherpad-lite/src
|
||||||
|
run: |
|
||||||
|
pnpm link --global
|
||||||
|
- name: Link etherpad to plugin
|
||||||
|
working-directory: ./plugin
|
||||||
|
run: |
|
||||||
|
pnpm link --global ep_etherpad-lite
|
||||||
-
|
-
|
||||||
name: Run the backend tests
|
name: Run the backend tests
|
||||||
|
working-directory: ./etherpad-lite
|
||||||
run: pnpm run test
|
run: pnpm run test
|
||||||
|
|
|
@ -1,11 +1,12 @@
|
||||||
# Publicly credit Sauce Labs because they generously support open source
|
# Publicly credit Sauce Labs because they generously support open source
|
||||||
# projects.
|
# projects.
|
||||||
name: "Frontend Tests"
|
name: Frontend Tests
|
||||||
|
|
||||||
on: [push]
|
on:
|
||||||
|
workflow_call:
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
test:
|
test-frontend:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
|
|
|
@ -4,72 +4,21 @@
|
||||||
name: Node.js Package
|
name: Node.js Package
|
||||||
|
|
||||||
on:
|
on:
|
||||||
pull_request:
|
workflow_call:
|
||||||
push:
|
|
||||||
branches:
|
|
||||||
- main
|
|
||||||
- master
|
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
test:
|
publish-npm:
|
||||||
|
if: ${{ github.event.workflow_run.conclusion == 'success' }}
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
# Clone ether/etherpad-lite to ../etherpad-lite so that ep_etherpad-lite
|
- uses: actions/setup-node@v4
|
||||||
# can be "installed" in this plugin's node_modules. The checkout v2 action
|
with:
|
||||||
# doesn't support cloning outside of $GITHUB_WORKSPACE (see
|
node-version: 20
|
||||||
# https://github.com/actions/checkout/issues/197), so the repo is first
|
registry-url: https://registry.npmjs.org/
|
||||||
# cloned to etherpad-lite then moved to ../etherpad-lite. To avoid
|
- name: Check out Etherpad core
|
||||||
# conflicts with this plugin's clone, etherpad-lite must be cloned and
|
|
||||||
# moved out before this plugin's repo is cloned to $GITHUB_WORKSPACE.
|
|
||||||
-
|
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v3
|
||||||
with:
|
with:
|
||||||
repository: ether/etherpad-lite
|
repository: ether/etherpad-lite
|
||||||
path: etherpad-lite
|
|
||||||
-
|
|
||||||
run: mv etherpad-lite ..
|
|
||||||
# etherpad-lite has been moved outside of $GITHUB_WORKSPACE, so it is now
|
|
||||||
# safe to clone this plugin's repo to $GITHUB_WORKSPACE.
|
|
||||||
-
|
|
||||||
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-
|
|
||||||
# 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 && pnpm i && pnpm link $PLUGIN_NAME
|
|
||||||
|
|
||||||
-
|
|
||||||
run: pnpm run test
|
|
||||||
-
|
|
||||||
run: npm run lint
|
|
||||||
|
|
||||||
publish-npm:
|
|
||||||
if: github.event_name == 'push'
|
|
||||||
needs: test
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
-
|
|
||||||
uses: actions/checkout@v3
|
|
||||||
- uses: pnpm/action-setup@v3
|
- uses: pnpm/action-setup@v3
|
||||||
name: Install pnpm
|
name: Install pnpm
|
||||||
with:
|
with:
|
||||||
|
@ -116,11 +65,11 @@ jobs:
|
||||||
# back-to-back merges will cause the first merge's workflow to fail but
|
# back-to-back merges will cause the first merge's workflow to fail but
|
||||||
# the second's will succeed.
|
# the second's will succeed.
|
||||||
-
|
-
|
||||||
run: npm publish
|
run: pnpm publish
|
||||||
env:
|
|
||||||
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}
|
|
||||||
-
|
|
||||||
name: Add package to etherpad organization
|
|
||||||
run: npm access grant read-write etherpad:developers
|
|
||||||
env:
|
env:
|
||||||
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}
|
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}
|
||||||
|
#-
|
||||||
|
# name: Add package to etherpad organization
|
||||||
|
# run: pnpm access grant read-write etherpad:developers
|
||||||
|
# env:
|
||||||
|
# NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}
|
||||||
|
|
|
@ -10,7 +10,7 @@ do
|
||||||
# echo $0
|
# echo $0
|
||||||
if [[ $dir == *"ep_"* ]]; then
|
if [[ $dir == *"ep_"* ]]; then
|
||||||
if [[ $dir != "ep_etherpad-lite" ]]; then
|
if [[ $dir != "ep_etherpad-lite" ]]; then
|
||||||
node bin/plugins/checkPlugin.js $dir autopush
|
pnpm run checkPlugins $dir autopush
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
# echo $dir
|
# echo $dir
|
||||||
|
|
|
@ -5,5 +5,5 @@ set -e
|
||||||
for dir in node_modules/ep_*; do
|
for dir in node_modules/ep_*; do
|
||||||
dir=${dir#node_modules/}
|
dir=${dir#node_modules/}
|
||||||
[ "$dir" != ep_etherpad-lite ] || continue
|
[ "$dir" != ep_etherpad-lite ] || continue
|
||||||
node bin/plugins/checkPlugin.js "$dir" autopush
|
pnpm run checkPlugins "$dir" autopush
|
||||||
done
|
done
|
||||||
|
|
Loading…
Reference in a new issue