Skip to content

updated CI#4

updated CI#4 #5

Workflow file for this run

name: Cub3D CI
on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y gcc make xorg libxext-dev libbsd-dev valgrind
- name: Prepare MiniLibX
run: |
if [ -d "minilibx-linux-master" ]; then
cd minilibx-linux-master
[ -f configure ] && chmod +x configure
[ -f configure.inc ] && chmod +x configure.inc
cd ..
fi
- name: Compile project
run: |
make re
[ -f "cub3D" ] || (echo "Compilation failed" && exit 1)
- name: Setup test maps
run: |
mkdir -p maps
# Minimal valid map
echo -e "NO textures/wall.xpm\nSO textures/wall.xpm\nWE textures/wall.xpm\nEA textures/wall.xpm\nF 220,100,0\nC 135,206,235\n111\n1P1\n111" > maps/valid.cub
# Invalid map (missing textures)
echo -e "invalid content" > maps/invalid.cub
- name: Validate map handling
run: |
echo "Testing invalid map (should fail)..."
if ./cub3D maps/invalid.cub 2>&1 | grep -q "Error"; then
echo "✓ Invalid map correctly rejected"
else
echo "✗ Invalid map not rejected" && exit 1
fi
echo "Testing valid map (should pass)..."
if ./cub3D maps/valid.cub 2>&1 | grep -q "Error"; then
echo "✗ Valid map rejected" && exit 1
else
echo "✓ Valid map accepted"
fi
- name: Memory check
run: |
mkdir -p logs
timeout 10 valgrind --leak-check=full --show-leak-kinds=all \
--error-exitcode=1 --track-origins=yes \
--log-file=logs/valgrind.log \
./cub3D maps/valid.cub || true
cat logs/valgrind.log
- name: Upload diagnostics
if: always()
uses: actions/upload-artifact@v4
with:
name: diagnostics
path: logs/
retention-days: 1