63 lines
1.6 KiB
YAML
63 lines
1.6 KiB
YAML
name: CI
|
|
|
|
on:
|
|
push:
|
|
branches: [master]
|
|
pull_request:
|
|
branches: [master]
|
|
workflow_dispatch:
|
|
|
|
jobs:
|
|
validate:
|
|
runs-on: dotfiles
|
|
container:
|
|
image: python:3-slim
|
|
steps:
|
|
- name: Checkout
|
|
run: |
|
|
apt-get update -qq && apt-get install -y -qq git >/dev/null
|
|
git clone --depth 1 --branch "${GITHUB_REF_NAME}" \
|
|
"https://oauth2:${{ github.token }}@${GITHUB_SERVER_URL#https://}/${GITHUB_REPOSITORY}.git" .
|
|
|
|
- name: Python syntax check
|
|
run: |
|
|
echo "Checking Python syntax..."
|
|
failed=0
|
|
for f in *.py; do
|
|
if python3 -m py_compile "$f" 2>&1; then
|
|
echo "OK $f"
|
|
else
|
|
echo "FAIL $f"
|
|
failed=1
|
|
fi
|
|
done
|
|
exit $failed
|
|
|
|
- name: Import validation
|
|
run: |
|
|
echo "Verifying module imports..."
|
|
failed=0
|
|
for mod in comboparse config dbs job misc mysqlite network_stats stats translations; do
|
|
if python3 -c "import sys; sys.path.insert(0,'.'); import $mod; print('OK $mod')"; then
|
|
:
|
|
else
|
|
echo "FAIL $mod"
|
|
failed=1
|
|
fi
|
|
done
|
|
exit $failed
|
|
|
|
- name: YAML lint
|
|
run: |
|
|
echo "Checking YAML files for tabs..."
|
|
failed=0
|
|
for f in compose.master.yml compose.worker.yml .gitea/workflows/ci.yml; do
|
|
if grep -qP '\t' "$f"; then
|
|
echo "FAIL $f: contains tabs"
|
|
failed=1
|
|
else
|
|
echo "OK $f"
|
|
fi
|
|
done
|
|
exit $failed
|