Try to improve subprocess exception handling #846
This file contains 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
name: Lint | |
on: | |
push: | |
branches: | |
- '**' | |
pull_request: | |
branches: | |
- 'main' | |
jobs: | |
lint: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-python@v5 | |
with: | |
# Once codebase is updated, this can easily be changed to any specific version. | |
python-version: "3.13" | |
- name: Install Poetry | |
uses: snok/install-poetry@v1 | |
with: | |
version: 1.8.4 | |
virtualenvs-create: true | |
virtualenvs-in-project: true | |
- name: Get full Python version | |
id: full-python-version | |
run: echo "version=$(python -c "import sys; print('-'.join(str(v) for v in sys.version_info))")" >> $GITHUB_OUTPUT | |
- name: Load cached venv | |
id: cached-poetry-dependencies | |
uses: actions/cache@v4 | |
with: | |
path: .venv | |
key: venv-${{ runner.os }}-${{ steps.full-python-version.outputs.version }}-${{ hashFiles('**/poetry.lock')}}-v20210414 | |
- name: Install dependencies | |
run: poetry install | |
if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true' | |
- name: Activate venv | |
run: | | |
echo "VIRTUAL_ENV=$GITHUB_WORKSPACE/.venv" >> $GITHUB_ENV | |
echo "PYTHONPATH=$GITHUB_WORKSPACE" >> $GITHUB_ENV | |
echo "$GITHUB_WORKSPACE/.venv/bin" >> $GITHUB_PATH | |
- name: Debug paths | |
run: | | |
pwd | |
ls -al | |
# Add modules here as they're ready (remove them from the file-by-file | |
# checker below as you do so). | |
- name: mypy Static Type Checker (packages) | |
run: | | |
mypy \ | |
--follow-imports=skip \ | |
--exclude 'migrations/*' \ | |
-p cl.alerts \ | |
-p cl.audio \ | |
-p cl.citations \ | |
-p cl.corpus_importer \ | |
-p cl.lib \ | |
-p cl.opinion_page \ | |
-p cl.recap_rss \ | |
-p cl.settings \ | |
-p cl.simple_pages | |
# Add files here as they're ready | |
- name: mypy Static Type Checker (files) | |
run: | | |
mypy \ | |
--follow-imports=skip \ | |
--exclude 'migrations/*' \ | |
cl/api/api_permissions.py \ | |
cl/api/management/commands/cl_retry_webhooks.py \ | |
cl/api/models.py \ | |
cl/api/routers.py \ | |
cl/api/tasks.py \ | |
cl/api/tests.py \ | |
cl/api/utils.py \ | |
cl/api/views.py \ | |
cl/api/webhooks.py \ | |
cl/tests/utils.py \ | |
cl/users/email_handlers.py \ | |
cl/users/forms.py \ | |
cl/users/management/commands/cl_account_management.py \ | |
cl/users/management/commands/cl_delete_old_emails.py \ | |
cl/users/management/commands/cl_retry_failed_email.py \ | |
cl/users/tasks.py \ | |
cl/recap/management/commands/remove_appellate_entries_with_long_numbers.py \ | |
cl/search/management/commands/cl_index_parent_and_child_docs.py \ | |
cl/search/management/commands/sweep_indexer.py | |
- name: Flynt f-string Formatter | |
run: > | |
flynt . | |
--line-length=79 | |
--transform-concats | |
--fail-on-change | |
- name: Black Code Formatter | |
uses: psf/black@stable | |
lint-isort: | |
# This is an unfortunate necessity because the latest version of isort | |
# doesn't work with Python 3.10. To work around that, we simply run this | |
# in version 3.9, but someday we hope to simplify this again. | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-python@v5 | |
with: | |
python-version: "3.9" | |
- name: isort Import Sorter | |
uses: isort/isort-action@v1 |