mosaic-zero / .github /workflows /code-quality.yml
raylim's picture
Fix GitHub Actions workflows to handle SSH private repository access
8d082ea unverified
name: Code Quality
on:
push:
branches: [ main, dev ]
pull_request:
branches: [ main, dev ]
workflow_dispatch:
jobs:
format-check:
name: Check Code Formatting
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up SSH key for private repos
uses: webfactory/ssh-agent@v0.9.0
with:
ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY }}
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.10"
- name: Install uv
uses: astral-sh/setup-uv@v4
with:
enable-cache: true
- name: Install dependencies
run: |
uv sync
- name: Check formatting with black
run: |
make format-check
- name: Format Summary
if: always()
run: |
echo "## Code Formatting :art:" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "Status: ${{ job.status }}" >> $GITHUB_STEP_SUMMARY
if [ "${{ job.status }}" == "failure" ]; then
echo "" >> $GITHUB_STEP_SUMMARY
echo "Run \`make format\` to auto-fix formatting issues." >> $GITHUB_STEP_SUMMARY
fi
lint:
name: Lint Code
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up SSH key for private repos
uses: webfactory/ssh-agent@v0.9.0
with:
ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY }}
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.10"
- name: Install uv
uses: astral-sh/setup-uv@v4
with:
enable-cache: true
- name: Install dependencies
run: |
uv sync
- name: Lint with pylint
run: |
make lint
continue-on-error: true # Don't fail CI on pylint warnings
- name: Lint Summary
if: always()
run: |
echo "## Linting Results :mag:" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "Status: ${{ job.status }}" >> $GITHUB_STEP_SUMMARY