Skip to content
170 changes: 170 additions & 0 deletions .github/workflows/makefile.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,170 @@
name: Makefile CI

on:
push:
branches: [ "master" ]
pull_request:
branches: [ "master" ]

defaults:
run:
shell: bash

jobs:
test-and-build:
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0 # Needed for proper git versioning

- name: Setup Git for tests
run: |
git config --global user.name "GitHub Actions"
git config --global user.email "[email protected]"

- name: Install dependencies
uses: awalsh128/cache-apt-pkgs-action@v1
with:
packages: shellcheck help2man dpkg devscripts make
version: 1.0

- name: Make the script executable
run: chmod +x git-smart-squash

- name: Run syntax check
run: |
bash -n git-smart-squash
echo "✅ Syntax check passed"

- name: Run ShellCheck
run: |
if command -v shellcheck >/dev/null 2>&1; then
# Skip SC1090 (dynamic source paths)
shellcheck -e SC1090 -e SC2155 git-smart-squash
echo "✅ ShellCheck passed"
else
echo "⚠️ ShellCheck not available, skipping"
fi

- name: Run Makefile targets
run: |
make build
make test
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:
strategy:
matrix:
os: [ubuntu-latest, macos-latest]
include:
- os: ubuntu-latest
shell: bash
- os: macos-latest
shell: bash

runs-on: ${{ matrix.os }}

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Setup Git
run: |
git config --global user.name "GitHub Actions"
git config --global user.email "[email protected]"

- name: Install dependencies
run: |
if [[ "${{ matrix.os }}" == "ubuntu-latest" ]]; then
sudo apt-get update
sudo apt-get install -y shellcheck make
else
brew install shellcheck make
fi

- name: Make script executable
run: chmod +x git-smart-squash

- name: Basic functionality test
run: |
./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 update
sudo apt-get install -y shellcheck
shellcheck --severity=warning -e SC1090 -e SC2155 git-smart-squash

#- name: Check for secrets
# uses: gitleaks/[email protected]
# with:
# config-path: .gitleaks.toml
# continue-on-error: false # Fail build if secrets are found

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: Install build dependencies
run: |
sudo apt-get update
sudo apt-get install -y dpkg devscripts make

- 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
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ Perfect for maintaining clean, conventional commit histories in development work
## 📦 Installation
### Method 1: Direct Download
```
curl -L https://github.com/Forz70043/git-smart-squash/blob/master/git-smart-squash.sh -o /usr/local/bin/git-smart-squash
curl -L https://raw.githubusercontent.com/Forz70043/git-smart-squash/refs/heads/master/git-smart-squash.sh -o /usr/local/bin/git-smart-squash
chmod +x /usr/local/bin/git-smart-squash
```
### Method 2: Debian Package (Coming Soon)
Expand Down
Loading
Loading