-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
595a5a6
commit 0624f27
Showing
2 changed files
with
39 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,3 +11,7 @@ init: | |
# run today's puzzle | ||
run: | ||
./scripts/run.sh | ||
|
||
# test today's puzzle | ||
test: | ||
./scripts/test.sh |
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,35 @@ | ||
#!/usr/bin/env bash | ||
|
||
set -e | ||
|
||
export PATH="/usr/local/opt/[email protected]/bin:$PATH" | ||
|
||
year="${AOC_YEAR:-$(date +%Y)}" | ||
month="${AOC_MONTH:-$(date +%m)}" | ||
day="${AOC_DAY:-$(date +%-d)}" | ||
|
||
if [[ ! "$month" -eq 12 ]]; then | ||
echo "It's not december quite yet. If you wish to run a previous puzzle" | ||
echo "specify AOC_YEAR, AOC_MONTH and AOC_DAY" | ||
exit 1 | ||
fi | ||
|
||
if [[ ! -d "$year/$day" ]]; then | ||
echo "Cannot find a puzzle in $year/$day. Have you forgot to initialize it?" | ||
exit 1 | ||
fi | ||
|
||
main_files="$(find "$year/$day" -depth 1 -iname "main*")" | ||
for file in $main_files; do | ||
name="$(basename "$file")" | ||
directory="$(dirname "$file")" | ||
pushd "$directory" | ||
case "${name##*.}" in | ||
"ts") | ||
NO_COLOR=1 deno test --quiet --allow-read | ||
;; | ||
*) | ||
echo "unsupported $file" | ||
esac | ||
popd | ||
done |