Skip to content

Commit b6e1b04

Browse files
committed
added CI
1 parent ab69fb9 commit b6e1b04

1 file changed

Lines changed: 52 additions & 0 deletions

File tree

.github/workflows/build.yml

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
name: Cub3D CI
2+
3+
on:
4+
push:
5+
branches: [ "main" ]
6+
pull_request:
7+
branches: [ "main" ]
8+
9+
jobs:
10+
build:
11+
runs-on: ubuntu-latest
12+
13+
steps:
14+
- uses: actions/checkout@v3
15+
16+
- name: Install dependencies
17+
run: |
18+
sudo apt-get update
19+
sudo apt-get install -y gcc make xorg libxext-dev libbsd-dev valgrind
20+
21+
- name: Compile project
22+
run: |
23+
make re
24+
ls -la cub3D
25+
26+
- name: Basic map validation
27+
run: |
28+
./cub3D maps/invalid_map.cub 2>&1 | grep "Error" && exit 1 || echo "Map validation working"
29+
./cub3D maps/valid_map.cub 2>&1 | grep "Error" && exit 1 || echo "Valid map accepted"
30+
31+
- name: Run with Valgrind (leak check)
32+
run: |
33+
valgrind --leak-check=full --show-leak-kinds=all --error-exitcode=1 \
34+
--track-origins=yes --log-file=valgrind.log \
35+
./cub3D maps/valid_map.cub
36+
cat valgrind.log
37+
38+
- name: Output verification
39+
run: |
40+
timeout 5 ./cub3D maps/valid_map.cub > output.log 2>&1 &
41+
sleep 3
42+
grep "Initialization complete" output.log || (echo "Startup failed" && exit 1)
43+
killall cub3D
44+
45+
- name: Save artifacts on failure
46+
if: failure()
47+
uses: actions/upload-artifact@v3
48+
with:
49+
name: debug-logs
50+
path: |
51+
output.log
52+
valgrind.log

0 commit comments

Comments
 (0)