orkestra/azure-pipelines.yml

106 строки
2.7 KiB
YAML

# Starter pipeline
# Start with a minimal pipeline that you can customize to build and deploy your code.
# Add steps that build, run tests, deploy, and more:
# https://aka.ms/yaml
variables:
isMain: $[eq(variables['Build.SourceBranch'], 'refs/heads/main')]
trigger:
- main
pr:
branches:
include:
- main
stages:
- stage: Golang
jobs:
- job: orkestra
pool:
vmImage: 'ubuntu-latest'
steps:
- task: GoTool@0
displayName: Setup Go 1.15.2
inputs:
version: '1.15.2'
- task: Go@0
displayName: Setup Go dependencies
inputs:
command: 'get'
arguments: '-d'
workingDirectory: '$(System.DefaultWorkingDirectory)'
- task: Bash@3
name: "setup_kubebuilder"
inputs:
targetType: 'filePath'
filePath: '$(System.DefaultWorkingDirectory)/scripts/setup-kubebuilder.sh'
- task: Bash@3
name: "setup_required_dependencies"
inputs:
targetType: 'filePath'
filePath: '$(System.DefaultWorkingDirectory)/scripts/setup-envtest.sh'
- script: |
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.33.0
export PATH=$PATH:$(go env GOPATH)/bin
golangci-lint --version
golangci-lint run
displayName: 'Code Scan using golangci-lint'
- script: |
make test
displayName: 'Run tests'
- stage: Docker
jobs:
- job: orkestra
pool:
vmImage: 'ubuntu-latest'
steps:
- task: Docker@2
displayName: Login to Docker Hub
inputs:
command: login
containerRegistry: AzureOrkestraDockerHubConnection
- task: Docker@2
displayName: Build
inputs:
command: build
repository: azureorkestra/orkestra
tags: |
$(Build.BuildNumber)
latest
condition: succeeded()
- task: Docker@2
displayName: Push
inputs:
command: push
repository: azureorkestra/orkestra
tags: |
$(Build.BuildNumber)
latest
condition: and(succeeded(),eq(variables.isMain, true))
- stage: Release
jobs:
- job: orkestra
pool:
vmImage: 'ubuntu-latest'
steps:
- task: GitHubRelease@0
displayName: 'Create GitHub Release'
inputs:
tagPattern: v*
gitHubConnection: GithubAzureOrkestra
repositoryName: Azure/Orkestra
assets: $(Build.ArtifactStagingDirectory)/README.md
isDraft: true
condition: and(succeeded(),eq(variables.isMain, true))