mirror of
https://github.com/tw93/Mole.git
synced 2026-02-04 20:54:50 +00:00
format automate
This commit is contained in:
59
.github/workflows/quality.yml
vendored
59
.github/workflows/quality.yml
vendored
@@ -9,13 +9,16 @@ permissions:
|
||||
contents: write
|
||||
|
||||
jobs:
|
||||
shell-quality:
|
||||
name: Code Quality
|
||||
format:
|
||||
name: Auto Format
|
||||
runs-on: macos-latest
|
||||
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
ref: ${{ github.head_ref }}
|
||||
token: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
- name: Cache Homebrew
|
||||
uses: actions/cache@v4
|
||||
@@ -31,16 +34,56 @@ jobs:
|
||||
- name: Install tools
|
||||
run: brew install shfmt shellcheck
|
||||
|
||||
- name: Format check
|
||||
- name: Set up Go
|
||||
uses: actions/setup-go@v5
|
||||
with:
|
||||
go-version: '1.24'
|
||||
|
||||
- name: Format all code
|
||||
run: |
|
||||
echo "Checking shell script formatting..."
|
||||
echo "Formatting shell scripts..."
|
||||
./scripts/format.sh
|
||||
echo "Formatting Go code..."
|
||||
gofmt -w ./cmd
|
||||
echo "✓ All code formatted"
|
||||
|
||||
- name: Commit formatting changes
|
||||
run: |
|
||||
git config user.name "github-actions[bot]"
|
||||
git config user.email "github-actions[bot]@users.noreply.github.com"
|
||||
if [[ -n $(git status --porcelain) ]]; then
|
||||
echo "Code formatting issues found:"
|
||||
git diff
|
||||
exit 1
|
||||
git add .
|
||||
git commit -m "chore: auto format code"
|
||||
git push
|
||||
echo "✓ Formatting changes committed"
|
||||
else
|
||||
echo "✓ No formatting changes needed"
|
||||
fi
|
||||
echo "✓ All scripts properly formatted"
|
||||
|
||||
quality:
|
||||
name: Code Quality
|
||||
runs-on: macos-latest
|
||||
needs: format
|
||||
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
ref: ${{ github.head_ref }}
|
||||
|
||||
- name: Cache Homebrew
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: |
|
||||
~/Library/Caches/Homebrew
|
||||
/usr/local/Cellar/shfmt
|
||||
/usr/local/Cellar/shellcheck
|
||||
key: ${{ runner.os }}-brew-quality-${{ hashFiles('**/Brewfile') }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-brew-quality-
|
||||
|
||||
- name: Install tools
|
||||
run: brew install shfmt shellcheck
|
||||
|
||||
- name: ShellCheck
|
||||
run: |
|
||||
|
||||
10
.github/workflows/tests.yml
vendored
10
.github/workflows/tests.yml
vendored
@@ -49,16 +49,6 @@ jobs:
|
||||
go vet ./cmd/...
|
||||
echo "✓ Vet passed"
|
||||
|
||||
- name: Check formatting
|
||||
run: |
|
||||
echo "Checking Go formatting..."
|
||||
if [ -n "$(gofmt -l ./cmd)" ]; then
|
||||
echo "Go code is not formatted:"
|
||||
gofmt -d ./cmd
|
||||
exit 1
|
||||
fi
|
||||
echo "✓ Go code properly formatted"
|
||||
|
||||
integration-tests:
|
||||
name: Integration Tests
|
||||
runs-on: macos-latest
|
||||
|
||||
Reference in New Issue
Block a user