Skip to content

Auto-sync: 2026-02-17 04:41 #158

Auto-sync: 2026-02-17 04:41

Auto-sync: 2026-02-17 04:41 #158

Workflow file for this run

name: Testing Tasks
on: [push]
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install compiler and CMake
run: sudo apt install -y cmake build-essential g++-14 libgtest-dev libgmock-dev
- name: Configure project
run: cmake -B build
- name: Build and run tests for changed tasks
run: |
# Проверяем, есть ли предыдущий коммит
if git rev-parse HEAD~1 > /dev/null 2>&1; then
changed_files=$(git diff --name-only HEAD~1 HEAD)
else
changed_files=$(git ls-files)
fi
echo "Changed files:"
echo "$changed_files"
tasks=("addition" "rms" "print_bits" "check_flags" "length_lit" "quadratic" "char_changer"
"swap_ptr" "func_array" "longest" "last_of_us" "little_big" "pretty_array"
"data_stats" "unique" "range" "minmax" "find_all" "os_overload" "easy_compare" "filter" "enum_operators"
"stack" "queue" "ring_buffer" "phasor"
"tracer" "string_view" "cow_string" "simple_vector"
"unique_ptr" "smart_ptr" "simple_list"
)
declare -i passed_count=0
declare -i failed_count=0
declare -i task_count=0
# task name arrays
passed_tasks=()
failed_tasks=()
echo "=== Starting tests for changed tasks ==="
for task in "${tasks[@]}"; do
if echo "$changed_files" | grep -q "tasks/$task/"; then
task_count+=1
echo "=== Processing $task ==="
if cmake --build build --target test_$task; then
echo "✅ test_$task built successfully"
if ./build/tasks/test_$task; then
echo "✅ test_$task PASSED"
passed_count+=1
passed_tasks+=("$task")
else
echo "❌ test_$task FAILED"
failed_count+=1
failed_tasks+=("$task")
fi
else
echo "❌ test_$task build FAILED"
failed_count+=1
failed_tasks+=("$task")
fi
fi
done
echo "=== Test Results Summary ==="
echo "Total tasks in list: ${#tasks[@]}"
echo "Processed: $task_count"
echo "✅ Passed: $passed_count [$(echo ${passed_tasks[@]} | tr ' ' ', ')]"
echo "❌ Failed: $failed_count [$(echo ${failed_tasks[@]} | tr ' ' ', ')]"
if [ $failed_count -gt 0 ]; then
echo "❌ Some tasks failed!"
exit 1
elif [ $task_count -eq 0 ]; then
echo "No tasks were processed (no changes)"
exit 0
else
echo "✅ All processed tasks passed!"
exit 0
fi