-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathbuild.sh
More file actions
executable file
·27 lines (20 loc) · 857 Bytes
/
build.sh
File metadata and controls
executable file
·27 lines (20 loc) · 857 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#!/bin/bash
set -ev
# source $HOME/.cargo/env
export PATH=$PATH:~/.cargo/bin:$GOROOT/bin
export PYENV_VERSION=3.8
run() {
echo "$1" | grep "day-" | cut -d "/" -f1 | cut -d "-" -f2 | sort | uniq | xargs -I{} ./aoc run -fntd {}
}
# In PRs, GITHUB_HEAD_REF is set the the name of the branch
# This variable isn't set on regular commits and as we only allowed the CI to run on pushs only in master
# checking if the variable is the empty string is the same as checking if the branch is master
# Note: we cannot use "git branch --show-current" as GitHub rewrites the history in actions
if [ "$GITHUB_HEAD_REF" == "" ];
then
# if on master, check the diff of the last commit
run "$(git --no-pager diff --name-only HEAD HEAD^ --)"
else
# otherwise, check the diff with master
run "$(git --no-pager diff --name-only origin/master --)"
fi