-
Notifications
You must be signed in to change notification settings - Fork 1
72 lines (64 loc) · 2.18 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
64
65
66
67
68
69
70
71
72
name: CI pipeline
on:
push:
branches:
- main
paths:
- src/**
- tests/**
- scripts/**
- .github/workflows/**
pull_request:
branches:
- main
paths:
- src/**
- tests/**
- scripts/**
- .github/workflows/**
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_NUMBER=$(echo "$TEST_CASE" | cut -d ':' -f 2)
echo "Running $TEST_NUMBER+1 tests for $TEST_NAME"
python scripts/builder.py "${TEST_NAME}.cpp"
python scripts/tester.py "${TEST_NAME}.cpp" "$TEST_NUMBER"
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_NUMBER=$(echo "$TEST_CASE" | cut -d ':' -f 2)
echo "Running $TEST_NUMBER+1 tests for $TEST_NAME"
python scripts/builder.py "${TEST_NAME}.c"
python scripts/tester.py "${TEST_NAME}.c" "$TEST_NUMBER"
done
- name: Test manually
run: |
gcc @configs/options src/lab2/evaluate_game.c src/lab2/game.c -o src/lab2/evaluate_game.e
python scripts/tester.py lab2/evaluate_game.c 4 manual