From e4b4383e6869880f453014b6a6b57d7ec1e08607 Mon Sep 17 00:00:00 2001 From: sokari Date: Sat, 7 Dec 2024 21:38:38 +0100 Subject: [PATCH] fix: build issue --- start.sh | 6 +++--- worker/app/notifier.ts | 1 + worker/app/util.ts | 10 +++++----- worker/index.ts | 4 ++-- worker/package.json | 2 +- worker/test.tsconfig.json | 19 +++++++++++++++++++ worker/tsconfig.json | 2 +- 7 files changed, 32 insertions(+), 12 deletions(-) create mode 100644 worker/test.tsconfig.json diff --git a/start.sh b/start.sh index 6054639..64c6af6 100644 --- a/start.sh +++ b/start.sh @@ -32,9 +32,9 @@ if [ ! -d "$MOUNT_POINT" ]; then exit 1 fi -GITHUB_SUMMARY_FILE="/github/summary.txt" -if [ ! -f "$GITHUB_SUMMARY_FILE" ]; then - export GITHUB_SUMMARY_FILE +GITHUB_STEP_SUMMARY="/github/summary.txt" +if [ -f "$GITHUB_STEP_SUMMARY" ]; then + export GITHUB_STEP_SUMMARY echo "Running on GitHub. Summary will be available in a bit" fi diff --git a/worker/app/notifier.ts b/worker/app/notifier.ts index 48ba458..d99c20d 100644 --- a/worker/app/notifier.ts +++ b/worker/app/notifier.ts @@ -108,6 +108,7 @@ class Notifier { const result = await web.chat.postMessage({ channel: cred.conversationId, blocks: blocks, + text: 'Your Allure report is ready.' }); console.log('Message sent: ', result.ts); diff --git a/worker/app/util.ts b/worker/app/util.ts index 1ba6e62..1996495 100644 --- a/worker/app/util.ts +++ b/worker/app/util.ts @@ -3,7 +3,7 @@ import * as fs from 'fs/promises' import * as path from "node:path"; import util from "node:util"; const exec = util.promisify(require('child_process').exec) -import {REPORTS_DIR, websiteId} from "../index"; +import {DEBUG, REPORTS_DIR, websiteId} from "../index"; import {StringBuilder} from "./string-builder"; export const getProjectIdFromCredentialsFile = async () => { @@ -88,10 +88,10 @@ export async function changePermissionsRecursively(dirPath: string, mode: fsSync } export async function publishToFireBaseHosting(): Promise { - // if (DEBUG) { - // console.warn('DEBUG=true: Skipping live deployment') - // return - // } + if (DEBUG) { + console.warn('DEBUG=true: Skipping live deployment') + return + } const hosting = { "hosting": { "public": ".", diff --git a/worker/index.ts b/worker/index.ts index 146493d..e3459fc 100644 --- a/worker/index.ts +++ b/worker/index.ts @@ -76,9 +76,9 @@ export function main(): void { if (cloudStorage && keepRetires) { await cloudStorage.uploadResults() } - const summaryPath = process.env.GITHUB_SUMMARY_FILE + const summaryPath = process.env.GITHUB_STEP_SUMMARY if(url && summaryPath){ - notifier.printGithubSummary({mountedFilePath: summaryPath, url: url}) + await notifier.printGithubSummary({mountedFilePath: summaryPath, url: url}) } const token = process.env.SLACK_TOKEN; const conversationId = process.env.SLACK_CHANNEL_ID; diff --git a/worker/package.json b/worker/package.json index 6bcf9d3..898393f 100644 --- a/worker/package.json +++ b/worker/package.json @@ -5,7 +5,7 @@ "lint": "eslint --ext .js,.ts .", "build": "tsc", "build:watch": "tsc --watch", - "test": "tsc && cucumber-js" + "test": "tsc --project test.tsconfig.json && npx cucumber-js" }, "engines": { "node": "22" diff --git a/worker/test.tsconfig.json b/worker/test.tsconfig.json new file mode 100644 index 0000000..5c5c9b5 --- /dev/null +++ b/worker/test.tsconfig.json @@ -0,0 +1,19 @@ +{ + "compilerOptions": { + "module": "commonjs", + "noImplicitReturns": true, + "noUnusedLocals": true, + "outDir": "lib", + "sourceMap": true, + "strict": true, + "target": "es2017", + "allowSyntheticDefaultImports": true, + "esModuleInterop": true + }, + + "compileOnSave": true, + "include": [ + "test" + ], + "exclude": ["app"] +} diff --git a/worker/tsconfig.json b/worker/tsconfig.json index 712a624..1fe239d 100644 --- a/worker/tsconfig.json +++ b/worker/tsconfig.json @@ -15,6 +15,6 @@ "include": [ "index.ts", "app/*.ts", - "test/step_definitions/*.ts" ], + "exclude": ["test"] }