-
Notifications
You must be signed in to change notification settings - Fork 1
63 lines (55 loc) · 2.02 KB
/
ci_pipeline.yml
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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
name: CI pipeline
on:
push:
branches:
- main
paths:
- src/**
- tests/**
- scripts/**
jobs:
build-and-test:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Detect tests for C++
id: detect_tests_cpp
run: |
TEST_RESULTS="$(python scripts/test_detector.py cpp)"
echo "Test Results:"
echo "$TEST_RESULTS"
echo "::set-output name=test_results::$TEST_RESULTS"
- name: Test C++ code
run: |
TEST_CASES=($(echo "${{steps.detect_tests_cpp.outputs.test_results}}" | tr ',' '\n'))
IFS=$','
for TEST_CASE in ${TEST_CASES[@]}; do
TEST_NAME=$(echo "$TEST_CASE" | cut -d ':' -f 1)
TEST_VALUE=$(echo "$TEST_CASE" | cut -d ':' -f 2)
echo "Running tests for $TEST_NAME with value $TEST_VALUE"
python scripts/builder.py "${TEST_NAME}.cpp"
python scripts/tester.py "${TEST_NAME}.cpp" "$TEST_VALUE"
done
- name: Detect tests for C
id: detect_tests_c
run: |
TEST_RESULTS="$(python scripts/test_detector.py c)"
echo "Test Results:"
echo "$TEST_RESULTS"
echo "::set-output name=test_results::$TEST_RESULTS"
- name: Test C code
run: |
TEST_CASES=($(echo "${{steps.detect_tests_c.outputs.test_results}}" | tr ',' '\n'))
IFS=$','
for TEST_CASE in ${TEST_CASES[@]}; do
TEST_NAME=$(echo "$TEST_CASE" | cut -d ':' -f 1)
TEST_VALUE=$(echo "$TEST_CASE" | cut -d ':' -f 2)
echo "Running tests for $TEST_NAME with value $TEST_VALUE"
python scripts/builder.py "${TEST_NAME}.c"
python scripts/tester.py "${TEST_NAME}.c" "$TEST_VALUE"
done
- name: Test manually
run: |
gcc @configs/options src/evaluate_game.c src/game.c -o src/evaluate_game.e
python scripts/tester.py evaluate_game.c 4 manual