From 039cc8ef5d2ebc57bbc374d59b22cbef7e930fd2 Mon Sep 17 00:00:00 2001 From: Johan Nyman Date: Mon, 25 Mar 2024 13:48:08 +0100 Subject: [PATCH] chore: add test script for testing that "all" build steps work --- package.json | 1 + scripts/test-everything.js | 39 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 40 insertions(+) create mode 100644 scripts/test-everything.js diff --git a/package.json b/package.json index 90c38347..ceaf6935 100644 --- a/package.json +++ b/package.json @@ -41,6 +41,7 @@ "update-packages": "node scripts/update-packages.js", "do:build-win32": "yarn build && yarn build-win32 && yarn gather-built && yarn sign-executables", "do:build-win32:ci": "yarn build && yarn build-win32:ci && yarn gather-built", + "do:test:everything": "node scripts/test-everything.js", "verify:build-win32": "node scripts/verify-build-win32.mjs", "precommit": "run -T lint-staged", "generate-schema-types": "node scripts/schema-types.mjs", diff --git a/scripts/test-everything.js b/scripts/test-everything.js new file mode 100644 index 00000000..d5186e50 --- /dev/null +++ b/scripts/test-everything.js @@ -0,0 +1,39 @@ +/* eslint-disable node/no-unpublished-require, no-console */ + +const { promisify } = require('util') +const { exec } = require('child_process') + +const execPromise = promisify(exec) + +/* +This script test _everything_ like building, testing, building binaries, building docker images, etc. +Run this script when updating larger things, like the node version, yarn version etc. +*/ + +;(async function () { + await run('yarn') + await run('yarn build') + await run('yarn test') + + // Test that binary builds work: + await run('yarn do:build-win32:ci') + + // Test that docker builds work: + await run('docker build -f apps/http-server/app/Dockerfile -t pm-http-server .') + await run( + 'docker build -f apps/quantel-http-transformer-proxy/app/Dockerfile -t pm-quantel-http-transformer-proxy .' + ) + + // Done + console.log('All seems to be working!') +})().catch(console.error) + +async function run(command) { + console.log(`RUN COMMAND: ${command}`) + const pChild = execPromise(command) + + pChild.child.stdout.on('data', console.log) + pChild.child.stderr.on('data', console.log) + + await pChild +}