File tree Expand file tree Collapse file tree 1 file changed +26
-11
lines changed
Expand file tree Collapse file tree 1 file changed +26
-11
lines changed Original file line number Diff line number Diff line change 77 branches : [ "main" ]
88
99jobs :
10- build :
11-
10+ build-and-run :
1211 runs-on : ubuntu-latest
1312
1413 steps :
15- - uses : actions/checkout@v4
16- - name : configure
17- run : ./configure
18- - name : make
19- run : make
20- - name : make check
21- run : make check
22- - name : make distcheck
23- run : make distcheck
14+ - name : Checkout repository
15+ uses : actions/checkout@v4
16+
17+ - name : Compile and Run all C programs in the 'program' folder
18+ run : |
19+ # Check if any .c files exist to avoid errors
20+ if ! ls program/*.c 1> /dev/null 2>&1; then
21+ echo "No .c files found in 'program' directory. Skipping."
22+ exit 0
23+ fi
24+
25+ # Loop through each .c file in the 'program' directory
26+ for c_file in program/*.c; do
27+ # Create a unique name for the executable from the C file name
28+ # For example, "program/app.c" becomes "app_executable"
29+ executable_name=$(basename "$c_file" .c)_executable
30+
31+ echo "---"
32+ echo "Compiling: $c_file"
33+ gcc "$c_file" -o "$executable_name"
34+
35+ echo "Running: ./${executable_name}"
36+ ./"$executable_name"
37+ echo "---"
38+ done
You can’t perform that action at this time.
0 commit comments