Skip to content

Commit

Permalink
Quit after compile for GH actions compliance
Browse files Browse the repository at this point in the history
  • Loading branch information
ThomasTJdev committed Feb 23, 2024
1 parent 76c51f9 commit 3b8e71e
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 5 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
8 changes: 6 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ jobs:
#- windows-latest
#- macOS-latest
version:
- stable
- 1.6.18
# - stable

steps:
- uses: actions/checkout@v2
Expand All @@ -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
Expand Down
11 changes: 9 additions & 2 deletions nimwc.nim
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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:
Expand Down Expand Up @@ -280,15 +282,20 @@ 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

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)

0 comments on commit 3b8e71e

Please sign in to comment.