aboutsummaryrefslogtreecommitdiffstats
path: root/azure-pipelines.yml
diff options
context:
space:
mode:
Diffstat (limited to 'azure-pipelines.yml')
-rw-r--r--azure-pipelines.yml103
1 files changed, 0 insertions, 103 deletions
diff --git a/azure-pipelines.yml b/azure-pipelines.yml
deleted file mode 100644
index 730cffb6..00000000
--- a/azure-pipelines.yml
+++ /dev/null
@@ -1,103 +0,0 @@
-# https://aka.ms/yaml
-
-jobs:
- - job: test
- displayName: 'Test & Lint'
- pool:
- vmImage: ubuntu-16.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.9.x'
- addToPath: true
-
- - task: DockerCompose@0
- displayName: 'Setup Database'
- inputs:
- action: Run a specific service
- dockerComposeFile: docker-compose.yml
- projectName: pydis_web
- serviceName: postgres
- ports: '7777:5432'
-
- - script: |
- pip install pipenv
- pipenv install --dev --system
- pip install flake8-formatter-junit-xml
- displayName: 'Install Project Environment'
-
- # 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
- python3 manage.py migrate
- coverage run \
- manage.py test \
- --testrunner xmlrunner.extra.djangotestrunner.XMLTestRunner \
- --no-input
- env:
- CI: azure
- DATABASE_URL: postgres://pysite:pysite@localhost:7777/pysite
- METRICITY_DB_URL: postgres://pysite:pysite@localhost:7777/metricity
- displayName: 'Run Tests'
-
- - script: coverage report -m && coverage xml
- displayName: 'Generate Coverage Reports'
-
- - task: PublishTestResults@2
- condition: succeededOrFailed()
- displayName: 'Publish Test & Linting Results'
- inputs:
- testResultsFiles: '**/TEST-*.xml'
- testRunTitle: 'Site Test Results'
-
- - task: PublishCodeCoverageResults@1
- displayName: 'Publish Coverage Results'
- condition: succeededOrFailed()
- inputs:
- codeCoverageTool: Cobertura
- summaryFileLocation: '**/coverage.xml'
-
- - job: build
- displayName: 'Build & Push Container'
- dependsOn: test
- condition: and(succeeded(), ne(variables['Build.Reason'], 'PullRequest'), eq(variables['Build.SourceBranch'], 'refs/heads/master'))
-
- steps:
- - task: Docker@2
- displayName: 'Build & Push Container'
- inputs:
- containerRegistry: 'DockerHub'
- repository: 'pythondiscord/site'
- command: 'buildAndPush'
- Dockerfile: 'docker/Dockerfile'
- buildContext: '.'
- tags: 'latest'