diff --git a/.github/workflows/python-checks.yaml b/.github/workflows/python-checks.yaml new file mode 100644 index 0000000..a968533 --- /dev/null +++ b/.github/workflows/python-checks.yaml @@ -0,0 +1,55 @@ +name: CI + +on: + push: + branches: [ main ] + pull_request: + branches: [ main ] + +jobs: + format: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: Set up Python 3.12.8 + uses: actions/setup-python@v5 + with: + python-version: '3.12.8' + - name: Install Black + run: pip install black + - name: Apply Black formatting + run: black . + - name: Commit formatting changes + run: | + git config --local user.email "action@github.com" + git config --local user.name "GitHub Action" + git add -A + git commit -m "Apply Black formatting" || echo "No changes to commit" + + lint: + needs: format + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: Set up Python 3.12.8 + uses: actions/setup-python@v5 + with: + python-version: '3.12.8' + - name: Install Ruff + run: pip install ruff + - name: Run Ruff linting + run: ruff check . + + typecheck: + needs: format + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: Set up Python 3.12.8 + uses: actions/setup-python@v5 + with: + python-version: '3.12.8' + - name: Install mypy + run: pip install mypy + - name: Run type checks + run: mypy . diff --git a/test-ci.py b/test-ci.py new file mode 100644 index 0000000..6458eb4 --- /dev/null +++ b/test-ci.py @@ -0,0 +1,5 @@ +def greet(name: int) -> str: + print("Hello, " + name + "!") + return 42 + +greet("world")