Added test-and-release

This commit is contained in:
SamTV12345 2024-03-16 20:40:16 +01:00
parent 107598b4b3
commit cb56ec0c17
2 changed files with 22 additions and 4 deletions

View file

@ -159,7 +159,7 @@ const logger = log4js.getLogger('checkPlugin');
if (!files.includes('.git')) throw new Error('No .git folder, aborting'); if (!files.includes('.git')) throw new Error('No .git folder, aborting');
prepareRepo(); prepareRepo();
const workflows = ['backend-tests.yml', 'frontend-tests.yml', 'npmpublish.yml']; const workflows = ['backend-tests.yml', 'frontend-tests.yml', 'npmpublish.yml', ''];
await Promise.all(workflows.map(async (fn) => { await Promise.all(workflows.map(async (fn) => {
await checkFile(`bin/plugins/lib/${fn}`, `.github/workflows/${fn}`); await checkFile(`bin/plugins/lib/${fn}`, `.github/workflows/${fn}`);
})); }));
@ -236,7 +236,7 @@ const logger = log4js.getLogger('checkPlugin');
if (!files.includes('package-lock.json')) { if (!files.includes('package-lock.json')) {
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 pnpm install in the plugin folder and commit the package-lock.json file.');
} else { } else {
logger.info('Autofixing missing package-lock.json file'); logger.info('Autofixing missing package-lock.json file');
execSync('pnpm install', { execSync('pnpm install', {
@ -366,7 +366,7 @@ const logger = log4js.getLogger('checkPlugin');
// Install dependencies so we can run ESLint. This should also create or update package-lock.json // Install dependencies so we can run ESLint. This should also create or update package-lock.json
// if autoFix is enabled. // if autoFix is enabled.
const npmInstall = `npm install${autoFix ? '' : ' --no-package-lock'}`; const npmInstall = `pnpm install${autoFix ? '' : ' --no-package-lock'}`;
execSync(npmInstall, {stdio: 'inherit'}); execSync(npmInstall, {stdio: 'inherit'});
// Create the ep_etherpad-lite symlink if necessary. This must be done after running `npm install` // Create the ep_etherpad-lite symlink if necessary. This must be done after running `npm install`
// because that command nukes the symlink. // because that command nukes the symlink.
@ -383,7 +383,7 @@ const logger = log4js.getLogger('checkPlugin');
execSync(lintCmd, {stdio: 'inherit'}); execSync(lintCmd, {stdio: 'inherit'});
} catch (e) { } catch (e) {
// it is gonna throw an error anyway // it is gonna throw an error anyway
logger.info('Manual linting probably required, check with: npm run lint'); logger.info('Manual linting probably required, check with: pnpm run lint');
} }
// linting ends. // linting ends.

View file

@ -0,0 +1,18 @@
name: Node.js Package
on: [push]
jobs:
backend:
uses: ./.github/workflows/backend-tests.yml
secrets: inherit
frontend:
uses: ./.github/workflows/frontend-tests.yml
secrets: inherit
release:
if: ${{ github.ref == 'refs/heads/master'|| github.ref == 'refs/heads/main' }}
needs:
- backend
- frontend
uses: ./.github/workflows/npmpublish.yml
secrets: inherit