mirror of
https://github.com/rangermix/TwitchDropsMiner.git
synced 2026-05-26 07:08:04 +00:00
95 lines
2.1 KiB
YAML
95 lines
2.1 KiB
YAML
name: validation
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- main
|
|
pull_request:
|
|
workflow_dispatch:
|
|
|
|
env:
|
|
PYTHON_VERSION: '>=3.10'
|
|
|
|
jobs:
|
|
lint:
|
|
name: Code Quality (Ruff & Mypy)
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
- name: Checkout code
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Set up Python
|
|
uses: actions/setup-python@v5
|
|
with:
|
|
python-version: ${{env.PYTHON_VERSION}}
|
|
|
|
- name: Install dependencies
|
|
run: |
|
|
python -m pip install --upgrade pip
|
|
pip install .
|
|
pip install ruff mypy
|
|
|
|
- name: Run Ruff linter
|
|
run: |
|
|
ruff check --fix src/
|
|
echo "✅ Ruff checks passed!"
|
|
|
|
- name: Run Mypy type checker
|
|
run: |
|
|
mypy src/
|
|
echo "✅ Mypy checks passed!"
|
|
continue-on-error: true # Don't fail CI on mypy errors yet
|
|
|
|
validate:
|
|
name: Validate Language Files
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
- name: Checkout code
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Set up Python
|
|
uses: actions/setup-python@v5
|
|
with:
|
|
python-version: ${{env.PYTHON_VERSION}}
|
|
|
|
- name: Validate language files
|
|
run: |
|
|
failed=()
|
|
for file in "lang/"*.json; do
|
|
if err="$(python -m json.tool "${file}" 2>&1 >/dev/null)"; then
|
|
echo "[OK] ${file}"
|
|
else
|
|
echo "[ERROR] ${file} ${err}"
|
|
failed+=("${file}")
|
|
fi
|
|
done
|
|
if [ "${#failed[@]}" -gt 0 ]; then
|
|
echo -e "\nFailed to validate the following language file(s): ${failed[@]}"
|
|
exit 1
|
|
fi
|
|
|
|
docker:
|
|
name: Docker Build Validation
|
|
runs-on: ubuntu-latest
|
|
permissions:
|
|
contents: read
|
|
needs: [lint, validate]
|
|
|
|
steps:
|
|
- name: Checkout code
|
|
uses: actions/checkout@v5
|
|
|
|
- name: Set up Docker Buildx
|
|
uses: docker/setup-buildx-action@v3
|
|
|
|
- name: Build Docker image
|
|
uses: docker/build-push-action@v6
|
|
with:
|
|
context: .
|
|
platforms: linux/amd64,linux/arm64
|
|
push: false
|
|
cache-from: type=gha
|
|
cache-to: type=gha,mode=max
|