Skip to content
This repository was archived by the owner on Jul 8, 2026. It is now read-only.

dual direction options #1

dual direction options

dual direction options #1

name: Lint and Format
on:
push:
branches: [ main, develop, 'feature/*', 'release/*' ]
pull_request:
branches: [ main, develop ]
jobs:
# Python linting and formatting
python-lint:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.12'
- name: Cache Python packages
uses: actions/cache@v4
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-lint-${{ hashFiles('**/requirements.txt') }}
restore-keys: |
${{ runner.os }}-pip-
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install black flake8 mypy isort bandit safety
pip install -r manager/requirements.txt
- name: Run Black (code formatting)
run: |
black --check --diff manager/apps/
- name: Run isort (import sorting)
run: |
isort --check-only --diff manager/apps/
- name: Run flake8 (linting)
run: |
flake8 manager/apps/ --max-line-length=100 --extend-ignore=E203,W503
- name: Run mypy (type checking)
run: |
mypy manager/apps/marchproxy/ --ignore-missing-imports
- name: Run bandit (security linting)
run: |
bandit -r manager/apps/ -f json -o bandit-report.json || true
bandit -r manager/apps/
- name: Run safety (dependency security check)
run: |
safety check --json --output safety-report.json || true
safety check
# Go linting and formatting
go-lint:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: '1.22'
- name: Cache Go modules
uses: actions/cache@v4
with:
path: |
~/.cache/go-build
~/go/pkg/mod
key: ${{ runner.os }}-go-lint-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
- name: Install golangci-lint
run: |
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.59.1
- name: Run golangci-lint
working-directory: ./proxy
run: |
$(go env GOPATH)/bin/golangci-lint run --timeout=5m
- name: Run go fmt
working-directory: ./proxy
run: |
if [ -n "$(gofmt -l .)" ]; then
echo "Go code is not formatted. Please run 'gofmt -w .'"
gofmt -d .
exit 1
fi
- name: Run go vet
working-directory: ./proxy
run: |
go vet ./...
- name: Run go mod tidy check
working-directory: ./proxy
run: |
go mod tidy
if [ -n "$(git status --porcelain go.mod go.sum)" ]; then
echo "go.mod or go.sum is not tidy"
git diff go.mod go.sum
exit 1
fi
# Docker linting
docker-lint:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Run Hadolint on Manager Dockerfile
uses: hadolint/hadolint-action@v3.1.0
with:
dockerfile: manager/Dockerfile
format: sarif
output-file: hadolint-manager.sarif
no-fail: true
- name: Run Hadolint on Proxy Dockerfile
uses: hadolint/hadolint-action@v3.1.0
with:
dockerfile: proxy/Dockerfile
format: sarif
output-file: hadolint-proxy.sarif
no-fail: true
- name: Upload Hadolint SARIF files
uses: github/codeql-action/upload-sarif@v3
if: always()
with:
sarif_file: |
hadolint-manager.sarif
hadolint-proxy.sarif
# Shell script linting
shell-lint:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Run ShellCheck
uses: ludeeus/action-shellcheck@master
with:
scandir: './scripts'
format: sarif
output: shellcheck.sarif
- name: Upload ShellCheck SARIF
uses: github/codeql-action/upload-sarif@v3
if: always()
with:
sarif_file: shellcheck.sarif
# YAML linting
yaml-lint:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Run yamllint
uses: ibiqlik/action-yamllint@v3
with:
format: parsable
file_or_dir: |
.github/workflows/
docker-compose.yml
docker-compose.ci.yml