-
Notifications
You must be signed in to change notification settings - Fork 33
104 lines (88 loc) · 3.07 KB
/
testing_week_02.yml
File metadata and controls
104 lines (88 loc) · 3.07 KB
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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
name: Testing Tasks Week 02
on:
workflow_dispatch:
inputs:
tasks:
description: 'Select tasks to test'
required: true
type: choice
default: 'all'
options:
- all
- swap_ptr
- func_array
- longest
- last_of_us
- little_big
- pretty_array
schedule:
- cron: '59 20 11 12 *' # UTC: 20:59 = 23:59 MSK 11 December
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: Determine tasks to run
id: get-tasks
run: |
if [[ "${{ github.event_name }}" = "schedule" ]] ||
[[ "${{ github.event.inputs.tasks }}" = "all" ]]; then
# Find all tasks
TASKS=()
for dir in 02_week/tasks/*/; do
task=$(basename "$dir")
TASKS+=("$task")
done
echo "tasks=${TASKS[*]}" >> $GITHUB_OUTPUT
else
# Используем указанную задачу
echo "tasks=${{ github.event.inputs.tasks }}" >> $GITHUB_OUTPUT
fi
- name: Build and run tests for selected tasks
run: |
echo "Event: ${{ github.event_name }}"
echo "Tasks to test: '${{ steps.get-tasks.outputs.tasks }}'"
IFS=' ' read -ra tasks <<< "${{ steps.get-tasks.outputs.tasks }}"
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 selected tasks ==="
for task in "${tasks[@]}"; do
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
else
echo "❌ test_$task FAILED"
failed_count+=1
fi
else
echo "❌ test_$task build FAILED"
failed_count+=1
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