From 3b8e71e18778a1a824d44ebaac932142f8a10925 Mon Sep 17 00:00:00 2001 From: ThomasTJdev Date: Fri, 23 Feb 2024 09:32:19 +0100 Subject: [PATCH] Quit after compile for GH actions compliance --- .github/workflows/build.yml | 2 +- .github/workflows/release.yml | 8 ++++++-- nimwc.nim | 11 +++++++++-- 3 files changed, 16 insertions(+), 5 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index a197a8063..6b792df53 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -45,7 +45,7 @@ jobs: run: | nimble build -d:release cp config/config_default.cfg config/config.cfg - ./nimwc + ./nimwc --quitAfterCompile - name: Nimble install run: nimble install \ No newline at end of file diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 659deb90b..10fabb74c 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -16,7 +16,8 @@ jobs: #- windows-latest #- macOS-latest version: - - stable + - 1.6.18 + # - stable steps: - uses: actions/checkout@v2 @@ -37,7 +38,10 @@ jobs: run: nimble -y install --depsOnly - name: Build binaries - run: nimble build -d:release + run: | + nimble build -d:release + cp config/config_default.cfg config/config.cfg + ./nimwc --quitAfterCompile - name: Archive Release uses: papeloto/action-zip@v1 diff --git a/nimwc.nim b/nimwc.nim index 2f38b174e..883fb850b 100644 --- a/nimwc.nim +++ b/nimwc.nim @@ -227,7 +227,7 @@ proc startupCheck(cfg: Config) = echo compile_start_msg & userArgs & "\n\n" let nimv2 = if NimMajor >= 2: " --mm:orc " else: "" - let (output, exitCode) = execCmdEx("nim c --out:" & appPath & " " & compileOptions & " " & nimv2& " " & getAppDir() & "/nimwcpkg/nimwc_main.nim") + let (output, exitCode) = execCmdEx("nim c --out:" & appPath & " " & compileOptions & " " & nimv2 & " " & getAppDir() & "/nimwcpkg/nimwc_main.nim") if exitCode != 0: styledEcho(fgRed, bgBlack, compile_fail_msg) echo output @@ -248,6 +248,8 @@ when isMainModule: when defined(dev): echo($compileOptions, "\n\n") + var quitAfterCompile = false + for keysType, keys, values in getopt(): case keysType of cmdShortOption, cmdLongOption: @@ -280,6 +282,8 @@ when isMainModule: echo backupDb(cfg.getSectionValue("Database", when defined(postgres): "name" else: "host"), checksum=false, sign=false, targz=false) of "backuplogs": echo backupOldLogs(splitPath(cfg.getSectionValue("Logging", when defined(release): "logfile" else: "logfiledev")).head) + of "quitAfterCompile": + quitAfterCompile = true of cmdArgument: discard @@ -287,8 +291,11 @@ when isMainModule: of cmdEnd: quit("Wrong arguments, please see help with: --help", 1) - if keys.len != 0: + if keys.len != 0 and not quitAfterCompile: quit("Run again with no arguments, please see help with: --help", 0) startupCheck(cfg) + if quitAfterCompile: + sleep(1000) launcherActivated(cfg) +