feat: use clone to fetch remote repositories #17908
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Copyright © Michal Čihař <[email protected]> | |
| # | |
| # SPDX-License-Identifier: CC0-1.0 | |
| name: mypy | |
| on: | |
| push: | |
| branches-ignore: | |
| - renovate/** | |
| - weblate | |
| pull_request: | |
| permissions: | |
| contents: read | |
| jobs: | |
| mypy: | |
| runs-on: ubuntu-24.04 | |
| steps: | |
| - uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # v6.0.0 | |
| with: | |
| fetch-depth: 2 | |
| persist-credentials: false | |
| - name: Get changed files | |
| if: github.event_name == 'pull_request' | |
| id: changed-files | |
| uses: tj-actions/changed-files@24d32ffd492484c1d75e0c0b894501ddb9d30d62 # v47.0.0 | |
| with: | |
| files: '**.py' | |
| - name: List all changed files | |
| if: github.event_name == 'pull_request' | |
| env: | |
| ALL_CHANGED_FILES: ${{ steps.changed-files.outputs.all_changed_files }} | |
| run: | | |
| touch changed-files.txt | |
| for file in ${ALL_CHANGED_FILES}; do | |
| echo "$file" >> changed-files.txt | |
| done | |
| cat changed-files.txt | |
| - name: Install apt dependencies | |
| run: sudo ./ci/apt-install | |
| - name: Setup Python | |
| id: setup_python | |
| uses: actions/setup-python@83679a892e2d95755f2dac6acb0bfd1e9ac5d548 # v6.1.0 | |
| with: | |
| python-version: '3.14' | |
| - uses: astral-sh/setup-uv@1e862dfacbd1d6d858c55d9b792c756523627244 # v7.1.4 | |
| with: | |
| save-cache: ${{ github.ref == 'refs/heads/main' }} | |
| cache-suffix: ${{ steps.setup_python.outputs.python-version }} | |
| version: 0.9.13 | |
| - name: Install deps | |
| env: | |
| CI_DATABASE: postgresql | |
| run: uv sync --no-binary-package lxml --no-binary-package xmlsec --all-extras --group types | |
| - name: Run mypy | |
| env: | |
| CI_DATABASE: postgresql | |
| run: | | |
| set +e | |
| uv run --no-sync mypy --show-column-numbers weblate scripts/*.py ./*.py | ./scripts/filter-mypy.sh | tee mypy.log | |
| # Temporary hack until we have mypy fully passing | |
| mypy_err="$?" | |
| if [ "$mypy_err" -ne 0 ] && [ "$mypy_err" -ne 1 ] ; then | |
| exit "$mypy_err" | |
| fi | |
| if [ ! -s mypy.log ] ; then | |
| echo "mypy log not found!" | |
| exit 1 | |
| fi | |
| # Use summary as step summary | |
| tail -n1 mypy.log >> "$GITHUB_STEP_SUMMARY" | |
| # Remove summary and .venv hints from the log | |
| cp mypy.log mypy.log.tmp | |
| head -n-1 mypy.log.tmp | grep -v '^\.venv/' > mypy.log | |
| rm mypy.log.tmp | |
| - name: Enforced mypy | |
| # TODO: Enforce mypy to pass on certain modules, this should eventually grow to complete codebase | |
| env: | |
| EXCLUDED_MODULES: accounts/|addons/|api/|auth/|billing/|fonts/|formats/|checks/|lang/|machinery/|metrics/|screenshots/|trans/(admin|autofixes|autotranslate|context_processors|debug|feeds|forms|guide|management|mixins|models|tests|views|widgets)|utils/|vcs/ | |
| run: | | |
| echo "::add-matcher::.github/matchers/mypy.json" | |
| if grep --silent --invert-match --extended-regexp "^weblate/($EXCLUDED_MODULES)" mypy.log ; then | |
| grep --invert-match --extended-regexp "^weblate/($EXCLUDED_MODULES)" mypy.log | |
| exit 1 | |
| fi | |
| echo "::remove-matcher owner=mypy::" | |
| - name: Report mypy | |
| run: | | |
| echo "::add-matcher::.github/matchers/mypy.json" | |
| if [ -f changed-files.txt ] ; then | |
| if grep --silent --fixed-strings --file=changed-files.txt mypy.log ; then | |
| grep --fixed-strings --file=changed-files.txt mypy.log | |
| fi | |
| else | |
| cat mypy.log | |
| fi | |
| echo "::remove-matcher owner=mypy::" |