ARO-RP/.pipelines/ci.yml

76 строки
2.4 KiB
YAML

# Azure DevOps Pipeline running CI
trigger:
- master
variables:
- template: vars.yml
jobs:
- job: "Python_Unit_Tests"
pool:
vmImage: "ubuntu-latest"
strategy:
matrix:
Python27:
python.version: "2.7"
Python35:
python.version: "3.5"
steps:
- task: UsePythonVersion@0
inputs:
versionSpec: "$(python.version)"
- template: ./templates/template-setup-golang-env.yml
parameters:
gobin: ${{ variables.GOBIN }}
gopath: ${{ variables.GOPATH }}
goroot: ${{ variables.GOROOT }}
modulePath: ${{ variables.modulePath }}
- script: |
set -x
sudo ln -s $USEPYTHONVERSION_PYTHONLOCATION/bin/python$(python.version) /usr/bin/python$(python.version)
pip install virtualenv
make test-python
displayName: "🧪Run Python Unit Tests : $(python.version)"
workingDirectory: "${{ variables.modulePath }}"
- job: "Golang_Unit_Tests"
pool:
vmImage: "ubuntu-latest"
steps:
- template: ./templates/template-setup-golang-env.yml
parameters:
gobin: ${{ variables.GOBIN }}
gopath: ${{ variables.GOPATH }}
goroot: ${{ variables.GOROOT }}
modulePath: ${{ variables.modulePath }}
- script: |
set -xe
make test-go
[[ -z "$(git status -s)" ]]
workingDirectory: "${{ variables.modulePath }}"
displayName: "🧪Run Golang Unit Tests"
- script: |
go run ./vendor/github.com/jstemmer/go-junit-report/go-junit-report.go < uts.txt > report.xml
go run ./vendor/github.com/axw/gocov/gocov/*.go convert cover.out > coverage.json
go run ./vendor/github.com/AlekSi/gocov-xml/gocov-xml.go < coverage.json > coverage.xml
workingDirectory: "${{ variables.modulePath }}"
displayName: "⚙️ Process Reports"
condition: succeededOrFailed()
- task: PublishTestResults@2
displayName: "📊 Publish tests results"
inputs:
testResultsFiles: $(System.DefaultWorkingDirectory)/**/report.xml
condition: succeededOrFailed()
- task: PublishCodeCoverageResults@1
displayName: "📈 Publish code coverage"
inputs:
codeCoverageTool: Cobertura
summaryFileLocation: "$(System.DefaultWorkingDirectory)/**/coverage.xml"
failIfCoverageEmpty: false
condition: succeededOrFailed()