diff options
| author | 2020-03-11 23:27:45 +0000 | |
|---|---|---|
| committer | 2020-03-11 23:27:45 +0000 | |
| commit | 6b9c586221ea8fe8fda179a715467d423d80f569 (patch) | |
| tree | bc52278b61b200fba402c4480d5460d188594dfd /azure-pipelines.yml | |
| parent | Merge branch 'master' into spoiler-check (diff) | |
| parent | Merge pull request #822 from python-discord/bug/mod/792/null-attachments (diff) | |
Merge branch 'master' into spoiler-check
Diffstat (limited to 'azure-pipelines.yml')
| -rw-r--r-- | azure-pipelines.yml | 28 |
1 files changed, 24 insertions, 4 deletions
diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 874364a6f..16d1b7a2a 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -9,16 +9,18 @@ jobs: - job: test displayName: 'Lint & Test' pool: - vmImage: ubuntu-16.04 + vmImage: ubuntu-18.04 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' + versionSpec: '3.8.x' addToPath: true - script: pip install pipenv @@ -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 |