Skip to content

Commit

Permalink
chore: add test script for testing that "all" build steps work
Browse files Browse the repository at this point in the history
  • Loading branch information
nytamin committed Mar 25, 2024
1 parent ff30fee commit 039cc8e
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 0 deletions.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
39 changes: 39 additions & 0 deletions scripts/test-everything.js
Original file line number Diff line number Diff line change
@@ -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
}

0 comments on commit 039cc8e

Please sign in to comment.