Skip to content

Commit 49741a1

Browse files
authored
Add AI presubmit test (#68)
1 parent 99bda94 commit 49741a1

File tree

4 files changed

+48
-1
lines changed

4 files changed

+48
-1
lines changed

.github/workflows/ai.yml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
name: AICheck
2+
3+
on:
4+
push:
5+
branches: [ master ]
6+
pull_request:
7+
branches: [ master ]
8+
9+
env:
10+
CARGO_TERM_COLOR: always
11+
12+
jobs:
13+
build:
14+
runs-on: ubuntu-latest
15+
timeout-minutes: 20
16+
steps:
17+
- uses: actions/checkout@v2
18+
- name: Test
19+
run: make ai-check

Makefile

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,10 @@ submission-test: submission
2929
performance:
3030
bash test/performance_test.sh
3131

32+
.PHONY: ai-check
33+
ai-check:
34+
bash test/ai_name_test.sh
35+
3236
.PHONY: deploy-dashboard
3337
deploy-dashboard:
3438
cd go/cmd/dashboard && unagi --bare make deploy

submission/run.sh

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,10 @@ export JUDGE_SERVER=1
88

99
source ./AI
1010

11-
./app "${AI_FLAGS[@]}" ${EXTRA_FLAGS:-} "$@" || \
11+
args=(./app)
12+
if [ "${#AI_FLAGS[*]}" -ne 0 ]; then
13+
args+=("${AI_FLAGS[@]}")
14+
fi
15+
16+
"${args[@]}" ${EXTRA_FLAGS:-} "$@" || \
1217
echo "ERROR: exit_code=$?"

test/ai_name_test.sh

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
#!/usr/bin/env bash
2+
3+
set -eux
4+
5+
cd "$(dirname "${BASH_SOURCE}")/.."
6+
7+
source ./AI
8+
9+
if [ ! -f "src/bin/${AI_NAME}.rs" ]; then
10+
echo "src/bin/${AI_NAME}.rs does not exist!"
11+
exit 1
12+
fi
13+
14+
args=(./app)
15+
if [ "${#AI_FLAGS[*]}" -ne 0 ]; then
16+
args+=("${AI_FLAGS[@]}")
17+
fi
18+
19+
echo "${args[@]}"

0 commit comments

Comments
 (0)