chore(ci): improve C/C++ CI workflow for reliability and clarity
This commit is contained in:
1 file changed
+30
-10
+30
-10
@@ -1,3 +1,4 @@
|
|||||||
|
|
||||||
name: C/C++ CI
|
name: C/C++ CI
|
||||||
|
|
||||||
on:
|
on:
|
||||||
@@ -8,16 +9,35 @@ on:
|
|||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
build:
|
||||||
|
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
# Step 1: Checkout your code
|
||||||
- name: configure
|
- name: Checkout code
|
||||||
run: ./configure
|
uses: actions/checkout@v4
|
||||||
- name: make
|
|
||||||
run: make
|
# Step 2: Install build dependencies
|
||||||
- name: make check
|
- name: Install dependencies
|
||||||
run: make check
|
run: sudo apt-get update && sudo apt-get install -y build-essential
|
||||||
- name: make distcheck
|
|
||||||
run: make distcheck
|
# 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
|
||||||
Reference in new issue
Block a user