diff options
author | 2020-09-18 03:33:35 +1000 | |
---|---|---|
committer | 2020-09-18 03:33:35 +1000 | |
commit | 357b20145b2784d9334b941fc25bcb8ce7b64c11 (patch) | |
tree | ccd446b4841ad69ae22fdc91f4c246823e0f811e /azure-pipelines.yml | |
parent | Add new test for deleted message context log_url. (diff) | |
parent | Merge pull request #390 from python-discord/allow_blank_or_null_for_nominatio... (diff) |
Merge branch 'master' into admin-api-pages-improvements
# Conflicts:
# pydis_site/apps/api/admin.py
Diffstat (limited to 'azure-pipelines.yml')
-rw-r--r-- | azure-pipelines.yml | 26 |
1 files changed, 24 insertions, 2 deletions
diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 0331e67f..f273dad3 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -8,10 +8,12 @@ jobs: variables: PIP_CACHE_DIR: .cache/pip + PRE_COMMIT_HOME: $(Pipeline.Workspace)/pre-commit-cache steps: - task: UsePythonVersion@0 displayName: 'Set Python Version' + name: PythonVersion inputs: versionSpec: '3.7.x' addToPath: true @@ -31,8 +33,28 @@ jobs: pip install flake8-formatter-junit-xml displayName: 'Install Project Environment' - - script: flake8 --format junit-xml --output-file TEST-lint.xml - displayName: 'Run Linter' + # Create an executable shell script which replaces the original pipenv binary. + # The shell script ignores the first argument and executes the rest of the args as a command. + # It makes the `pipenv run flake8` command in the pre-commit hook work by circumventing + # pipenv entirely, which is too dumb to know it should use the system interpreter rather than + # creating a new venv. + - script: | + printf '%s\n%s' '#!/bin/bash' '"${@:2}"' > $(PythonVersion.pythonLocation)/bin/pipenv \ + && chmod +x $(PythonVersion.pythonLocation)/bin/pipenv + displayName: 'Mock pipenv binary' + + - task: Cache@2 + displayName: 'Restore pre-commit environment' + inputs: + key: pre-commit | "$(PythonVersion.pythonLocation)" | .pre-commit-config.yaml + restoreKeys: | + pre-commit | "$(PythonVersion.pythonLocation)" + path: $(PRE_COMMIT_HOME) + + # flake8 runs so it can generate the XML output. pre-commit will run it again to show stdout. + # flake8 standalone runs first to avoid any fixes pre-commit hooks may make. + - script: flake8 --format junit-xml --output-file TEST-lint.xml; pre-commit run --all-files + displayName: 'Run pre-commit hooks' - script: | python3 manage.py makemigrations --check |