Skip to content

CI: Create makefile.yml #3

CI: Create makefile.yml

CI: Create makefile.yml #3

Workflow file for this run

name: Makefile CI
on:
push:
branches: [ "master" ]
pull_request:
branches: [ "master" ]
jobs:
test-and-build:
runs-on: ubuntu-latest
strategy:
matrix:
shell: [bash]
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0 # Fetch all history for proper git operations
- name: Setup Git for tests
run: |
git config --global user.name "GitHub Actions"
git config --global user.email "actions@github.com"
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y shellcheck help2man dpkg devscripts
- name: Make the script executable
run: chmod +x git-smart-squash
- name: Run syntax check
run: |
# Check bash syntax
bash -n git-smart-squash
echo "✅ Syntax check passed"
- name: Run ShellCheck
run: |
if command -v shellcheck >/dev/null 2>&1; then
shellcheck git-smart-squash
echo "✅ ShellCheck passed"
else
echo "⚠️ ShellCheck not available, skipping"
fi
- name: Run build
run: make build
- name: Run tests
run: make test
- name: Run lint
run: make lint
- name: Build Debian package
run: make deb
- name: Build distribution tarball
run: make dist
- name: Test installation
run: |
make install DESTDIR=./test-install
echo "✅ Installation test passed"
- name: Verify help command works
run: |
./git-smart-squash --help
echo "✅ Help command works"
- name: Upload build artifacts
uses: actions/upload-artifact@v4
with:
name: build-artifacts
path: |
dist/
build/
retention-days: 7
multi-platform-test:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macos-latest]
include:
- os: ubuntu-latest
shell: bash
- os: macos-latest
shell: bash
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Git
run: |
git config --global user.name "GitHub Actions"
git config --global user.email "actions@github.com"
- name: Install dependencies (Ubuntu)
if: matrix.os == 'ubuntu-latest'
run: |
sudo apt-get update
sudo apt-get install -y shellcheck make
- name: Install dependencies (macOS)
if: matrix.os == 'macos-latest'
run: |
brew install shellcheck make
- name: Make executable
run: chmod +x git-smart-squash
- name: Basic functionality test
run: |
# Test basic script functionality
./git-smart-squash --help
echo "✅ Basic functionality verified on ${{ matrix.os }}"
- name: Syntax check
run: |
bash -n git-smart-squash
echo "✅ Syntax check passed on ${{ matrix.os }}"
security-scan:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Run ShellCheck security scan
run: |
sudo apt-get install -y shellcheck
shellcheck --severity=warning git-smart-squash
- name: Check for secrets
uses: gitleaks/gitleaks-action@v2
with:
config-path: .gitleaks.toml
release:
runs-on: ubuntu-latest
if: startsWith(github.ref, 'refs/tags/v')
needs: [test-and-build, multi-platform-test]
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Build release artifacts
run: |
make deb
make dist
- name: Create GitHub Release
uses: softprops/action-gh-release@v1
with:
files: |
dist/*.deb
dist/*.tar.gz
generate_release_notes: true