ci: local nice

This commit is contained in:
cha0s 2024-02-15 22:44:33 -06:00
parent bf73b78ed7
commit ed73e3a8f3
2 changed files with 20 additions and 10 deletions

View File

@ -2,7 +2,7 @@ name: CI
on: on:
push: push:
branches: [master] branches: [bleeding, master]
pull_request: pull_request:
branches: [master] branches: [master]
workflow_dispatch: {} workflow_dispatch: {}
@ -31,7 +31,7 @@ jobs:
key: ${{ hashFiles('**/package-lock.json') }} key: ${{ hashFiles('**/package-lock.json') }}
- if: ${{ steps.cache-node-modules.outputs.cache-hit != 'true' }} - if: ${{ steps.cache-node-modules.outputs.cache-hit != 'true' }}
run: npm ci run: npm ci
- run: npm run build - run: FLECKS_CI_SHOW_SUCCESS=1 npm run build
test: test:
runs-on: ubuntu-latest runs-on: ubuntu-latest
@ -65,7 +65,7 @@ jobs:
if: ${{ vars.NPM_CI_REGISTRY && steps.cache-node-modules.outputs.cache-hit != 'true' }} if: ${{ vars.NPM_CI_REGISTRY && steps.cache-node-modules.outputs.cache-hit != 'true' }}
- run: npm ci - run: npm ci
if: ${{ steps.cache-node-modules.outputs.cache-hit != 'true' }} if: ${{ steps.cache-node-modules.outputs.cache-hit != 'true' }}
- run: npm run -- test -t 120000 ${{ matrix.test-platforms }} - run: FLECKS_CI_SHOW_SUCCESS=1 npm run -- test -t 120000 ${{ matrix.test-platforms }}
lint: lint:
runs-on: ubuntu-latest runs-on: ubuntu-latest
@ -85,4 +85,4 @@ jobs:
key: ${{ hashFiles('**/package-lock.json') }} key: ${{ hashFiles('**/package-lock.json') }}
- if: ${{ steps.cache-node-modules.outputs.cache-hit != 'true' }} - if: ${{ steps.cache-node-modules.outputs.cache-hit != 'true' }}
run: npm ci run: npm ci
- run: npm run lint - run: FLECKS_CI_SHOW_SUCCESS=1 npm run lint

View File

@ -9,11 +9,14 @@ const concurrent = require('./concurrent');
const { const {
FLECKS_CORE_ROOT = process.cwd(), FLECKS_CORE_ROOT = process.cwd(),
FLECKS_CI_SHOW_SUCCESS,
} = process.env; } = process.env;
const args = process.argv.slice(2); const args = process.argv.slice(2);
const {workspaces} = require(join(FLECKS_CORE_ROOT, 'package.json')); const {workspaces} = require(join(FLECKS_CORE_ROOT, 'package.json'));
const showSuccess = !!FLECKS_CI_SHOW_SUCCESS;
(async () => { (async () => {
process.exitCode = await concurrent( process.exitCode = await concurrent(
(await Promise.all(workspaces.map((path) => glob(join(FLECKS_CORE_ROOT, path))))).flat(), (await Promise.all(workspaces.map((path) => glob(join(FLECKS_CORE_ROOT, path))))).flat(),
@ -28,6 +31,12 @@ const {workspaces} = require(join(FLECKS_CORE_ROOT, 'package.json'));
const stdio = new PassThrough(); const stdio = new PassThrough();
const buffer = pipesink(child.stderr.pipe(child.stdout.pipe(stdio))); const buffer = pipesink(child.stderr.pipe(child.stdout.pipe(stdio)));
const code = await processCode(child); const code = await processCode(child);
if (!showSuccess && 0 === code) {
console.log(`@flecks/${
chalk.blue(relative(join(FLECKS_CORE_ROOT, 'packages'), cwd))
} ${chalk.green('passed')}\n`);
}
else {
console.log( console.log(
`::group::@flecks/${ `::group::@flecks/${
chalk.blue(relative(join(FLECKS_CORE_ROOT, 'packages'), cwd)) chalk.blue(relative(join(FLECKS_CORE_ROOT, 'packages'), cwd))
@ -35,6 +44,7 @@ const {workspaces} = require(join(FLECKS_CORE_ROOT, 'package.json'));
); );
process.stdout.write(await buffer); process.stdout.write(await buffer);
console.log('::endgroup::\n'); console.log('::endgroup::\n');
}
return code; return code;
}, },
); );