aboutsummaryrefslogtreecommitdiffstats
path: root/azure-pipelines.yml
blob: e423b2876c894b6c2708d4142f38a26ffe3f88af (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
# https://aka.ms/yaml

jobs:
- job: test
  displayName: 'Lint'

  pool:
    vmImage: 'Ubuntu-16.04'

  steps:
  - task: UsePythonVersion@0
    displayName: 'Set Python version'
    inputs:
      versionSpec: '3.6.x'
      addToPath: true

  - script: pip3 install pipenv
    displayName: 'Install pipenv'

  - script: pipenv install --dev --deploy --system
    displayName: 'Install project using pipenv'

  - script: python3 -m flake8 --format junit-xml --output-file test-lint.xml
    displayName: 'Run linter'

  - task: PublishTestResults@2
    condition: succeededOrFailed()
    inputs:
      testResultsFiles: '**/test-*.xml'
      testRunTitle: 'Snekbox Flake8 Lint Results'

- job: build
  displayName: 'Build'
  dependsOn: test
  condition: and(succeeded(), ne(variables['Build.Reason'], 'PullRequest'))

  steps:
  - task: Docker@1
    displayName: 'Login: Docker Hub'

    inputs:
      containerregistrytype: 'Container Registry'
      dockerRegistryEndpoint: 'DockerHub'
      command: 'login'

  - script: docker build -t pythondiscord/snekbox:latest -f docker/Dockerfile .
    displayName: 'Build Final Image'

  - script: docker push pythondiscord/snekbox:latest
    displayName: 'Push Image to Dockerhub'