-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: slowy07 <[email protected]>
- Loading branch information
Showing
3 changed files
with
85 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
if defined(release) or defined(danger): | ||
--opt: speed | ||
--passC: "-flto" | ||
--passL: "-flto" | ||
--passL: "-s" | ||
else: | ||
--checks: on | ||
--assertions: on | ||
--spellSuggest | ||
--styleCheck: error | ||
|
||
--mm:arc | ||
|
||
import std/[os, sequtils] | ||
from std/strutils import startsWith, endsWith | ||
from std/strformat import `&` | ||
|
||
const IgnorePathPrefixes = ["."] | ||
|
||
func isIgnored(path: string): bool = | ||
IgnorePathPrefixes.mapIt(path.startsWith(it)).anyIt(it) | ||
|
||
iterator modules(dir: string = getCurrentDir()): string = | ||
for path in walkDirRec(dir, relative = true): | ||
if not path.isIgnored() and path.endsWith(".nim"): | ||
yield path | ||
|
||
############ Tasks | ||
task test, "Test semuanya": | ||
--warning: "BareExcept:off" | ||
--hints: off | ||
var failedUnits: seq[string] | ||
|
||
for path in modules(): | ||
echo &"Testing {path}:" | ||
try: selfExec(&"-f --warning[BareExcept]:off --hints:off r \"{path}\"") | ||
except OSError: | ||
failedUnits.add(path) | ||
if failedUnits.len > 0: | ||
echo "Test yang Gagal:" | ||
for path in failedUnits: | ||
echo &"- {path}" | ||
quit(1) | ||
else: | ||
echo "Semua Test Berjalan dengan baik" | ||
|
||
task prettyfy, "Run nimpretty untuk semua file": | ||
for path in modules(): | ||
exec(&"nimpretty --indent:2 \"{path}\"") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters