add partial solutions #277
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
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 |