Skip to content

Fix: Add _POSIX_C_SOURCE for strdup compatibility #6

Fix: Add _POSIX_C_SOURCE for strdup compatibility

Fix: Add _POSIX_C_SOURCE for strdup compatibility #6

Workflow file for this run

name: CI
on:
push:
branches: [ main, develop ]
pull_request:
branches: [ main ]
jobs:
build-and-test:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macos-latest]
compiler: [gcc, clang]
exclude:
# macOS uses clang by default
- os: macos-latest
compiler: gcc
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Setup compiler
if: runner.os == 'Linux'
run: |
echo "Setting up ${{ matrix.compiler }} on Linux"
sudo apt-get update -qq
if [ "${{ matrix.compiler }}" = "gcc" ]; then
sudo apt-get install -y gcc build-essential
elif [ "${{ matrix.compiler }}" = "clang" ]; then
sudo apt-get install -y clang
fi
${{ matrix.compiler }} --version
- name: Build
env:
CC: ${{ matrix.compiler }}
run: |
echo "CC is set to: $CC"
echo "Running make..."
make
echo "Build completed"
- name: Run tests
env:
CC: ${{ matrix.compiler }}
run: |
echo "CC is set to: $CC"
echo "Running make test..."
make test
echo "Tests completed"
- name: Clean
run: make clean
code-quality:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Check for trailing whitespace
run: |
! git grep -I --line-number --perl-regexp '\s+$' -- '*.c' '*.h'
- name: Check line count (keep it minimal!)
run: |
total_lines=$(find src -name "*.c" -o -name "*.h" | xargs wc -l | tail -1 | awk '{print $1}')
echo "Total lines of code: $total_lines"
if [ "$total_lines" -gt 1200 ]; then
echo "Error: Code exceeds 1200 lines (found $total_lines)"
echo "Moop is about minimalism!"
exit 1
fi