44 lines
987 B
YAML
44 lines
987 B
YAML
|
|
name: C/C++ CI
|
|
|
|
on:
|
|
push:
|
|
branches: [ "main" ]
|
|
pull_request:
|
|
branches: [ "main" ]
|
|
|
|
jobs:
|
|
build:
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
# Step 1: Checkout your code
|
|
- name: Checkout code
|
|
uses: actions/checkout@v4
|
|
|
|
# Step 2: Install build dependencies
|
|
- name: Install dependencies
|
|
run: sudo apt-get update && sudo apt-get install -y build-essential
|
|
|
|
# Step 3: Build your project
|
|
- name: Build
|
|
run: make -j$(nproc)
|
|
|
|
# Step 4: Run tests if available
|
|
- name: Run tests
|
|
run: |
|
|
if make -q check 2>/dev/null; then
|
|
make check
|
|
else
|
|
echo "No tests defined, skipping..."
|
|
fi
|
|
|
|
# Step 5: Optional: distribution check if Makefile has distcheck
|
|
- name: Distribution check
|
|
run: |
|
|
if make -q distcheck 2>/dev/null; then
|
|
make distcheck
|
|
else
|
|
echo "No distcheck target, skipping..."
|
|
fi
|