aboutsummaryrefslogtreecommitdiffstats
path: root/azure-pipelines.yml
diff options
context:
space:
mode:
authorGravatar Eivind Teig <[email protected]>2020-03-30 11:54:50 +0200
committerGravatar GitHub <[email protected]>2020-03-30 11:54:50 +0200
commitfb2de332c8b95c04e1ce7b41cd8336b594d13524 (patch)
tree18b44c5b1ad5cea36a8f179fae9c301263e61b11 /azure-pipelines.yml
parentAdd tests for `HushDurationConverter`. (diff)
parentMerge pull request #849 from ks129/webhook-match (diff)
Merge branch 'master' into hush-cog
Diffstat (limited to 'azure-pipelines.yml')
-rw-r--r--azure-pipelines.yml24
1 files changed, 22 insertions, 2 deletions
diff --git a/azure-pipelines.yml b/azure-pipelines.yml
index 35dea089a..16d1b7a2a 100644
--- a/azure-pipelines.yml
+++ b/azure-pipelines.yml
@@ -13,10 +13,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.8.x'
addToPath: true
@@ -27,8 +29,26 @@ jobs:
- script: pipenv install --dev --deploy --system
displayName: 'Install project using pipenv'
- - script: python -m flake8
- 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)
+
+ - script: pre-commit run --all-files
+ displayName: 'Run pre-commit hooks'
- script: BOT_API_KEY=foo BOT_SENTRY_DSN=blah BOT_TOKEN=bar WOLFRAM_API_KEY=baz REDDIT_CLIENT_ID=spam REDDIT_SECRET=ham coverage run -m xmlrunner
displayName: Run tests