Skip to content

Commit

Permalink
Rename master->main
Browse files Browse the repository at this point in the history
  • Loading branch information
vsalvino committed Mar 4, 2021
1 parent b3c0268 commit 7e68ba8
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 17 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ Status
| | |
|------------------------|----------------------|
| Python Package | [![PyPI - Python Version](https://img.shields.io/pypi/pyversions/django-sass)](https://pypi.org/project/django-sass/) [![PyPI - Django Version](https://img.shields.io/pypi/djversions/django-sass)](https://pypi.org/project/django-sass/) [![PyPI - Wheel](https://img.shields.io/pypi/wheel/django-sass)](https://pypi.org/project/django-sass/) [![PyPI - Downloads](https://img.shields.io/pypi/dm/django-sass)](https://pypi.org/project/django-sass/) [![PyPI](https://img.shields.io/pypi/v/django-sass)](https://pypi.org/project/django-sass/) |
| Build | [![Build Status](https://dev.azure.com/coderedcorp/cr-github/_apis/build/status/django-sass?branchName=master)](https://dev.azure.com/coderedcorp/cr-github/_build/latest?definitionId=10&branchName=master) [![Azure DevOps tests (branch)](https://img.shields.io/azure-devops/tests/coderedcorp/cr-github/10/master)](https://dev.azure.com/coderedcorp/cr-github/_build/latest?definitionId=10&branchName=master) [![Azure DevOps coverage (branch)](https://img.shields.io/azure-devops/coverage/coderedcorp/cr-github/10/master)](https://dev.azure.com/coderedcorp/cr-github/_build/latest?definitionId=10&branchName=master) |
| Build | [![Build Status](https://dev.azure.com/coderedcorp/cr-github/_apis/build/status/django-sass?branchName=main)](https://dev.azure.com/coderedcorp/cr-github/_build/latest?definitionId=10&branchName=main) [![Azure DevOps tests (branch)](https://img.shields.io/azure-devops/tests/coderedcorp/cr-github/10/main)](https://dev.azure.com/coderedcorp/cr-github/_build/latest?definitionId=10&branchName=main) [![Azure DevOps coverage (branch)](https://img.shields.io/azure-devops/coverage/coderedcorp/cr-github/10/main)](https://dev.azure.com/coderedcorp/cr-github/_build/latest?definitionId=10&branchName=main) |


Installation
Expand Down
2 changes: 1 addition & 1 deletion azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@


trigger:
- master
- main


stages:
Expand Down
30 changes: 15 additions & 15 deletions ci/compare-codecov.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<#
.SYNOPSIS
Compares code coverage percent of local coverage.xml file to master branch
Compares code coverage percent of local coverage.xml file to main branch
(Azure Pipeline API).
.PARAMETER wd
Expand Down Expand Up @@ -41,25 +41,25 @@ $ApiBase = "https://dev.azure.com/$org/$project"


# Get list of all recent builds.
$masterBuildJson = (
Invoke-WebRequest "$ApiBase/_apis/build/builds?branchName=refs/heads/master&api-version=5.1"
$mainBuildJson = (
Invoke-WebRequest "$ApiBase/_apis/build/builds?branchName=refs/heads/main&api-version=5.1"
).Content | ConvertFrom-Json

# Get the latest matching build ID from the list of builds.
foreach ($build in $masterBuildJson.value) {
foreach ($build in $mainBuildJson.value) {
if ($build.definition.name -eq $pipeline_name) {
$masterLatestId = $build.id
$mainLatestId = $build.id
break
}
}

# Retrieve code coverage for this build ID.
$masterCoverageJson = (
Invoke-WebRequest "$ApiBase/_apis/test/codecoverage?buildId=$masterLatestId&api-version=5.1-preview.1"
$mainCoverageJson = (
Invoke-WebRequest "$ApiBase/_apis/test/codecoverage?buildId=$mainLatestId&api-version=5.1-preview.1"
).Content | ConvertFrom-Json
foreach ($cov in $masterCoverageJson.coverageData.coverageStats) {
foreach ($cov in $mainCoverageJson.coverageData.coverageStats) {
if ($cov.label -eq "Lines") {
$masterlinerate = [math]::Round(($cov.covered / $cov.total) * 100, 2)
$mainlinerate = [math]::Round(($cov.covered / $cov.total) * 100, 2)
}
}

Expand All @@ -84,21 +84,21 @@ $branchlinerate = [math]::Round([decimal]$BranchXML.coverage.'line-rate' * 100,


Write-Output ""
Write-Output "Master line coverage rate: $masterlinerate%"
Write-Output "Branch line coverage rate: $branchlinerate%"
Write-Output "Main coverage rate: $mainlinerate%"
Write-Output "Branch coverage rate: $branchlinerate%"

if ($masterlinerate -eq 0) {
if ($mainlinerate -eq 0) {
$change = "Infinite"
}
else {
$change = [math]::Abs($branchlinerate - $masterlinerate)
$change = [math]::Abs($branchlinerate - $mainlinerate)
}

if ($branchlinerate -gt $masterlinerate) {
if ($branchlinerate -gt $mainlinerate) {
Write-Host "Coverage increased by $change% 😀" -ForegroundColor Green
exit 0
}
elseif ($branchlinerate -eq $masterlinerate) {
elseif ($branchlinerate -eq $mainlinerate) {
Write-Host "Coverage has not changed." -ForegroundColor Green
exit 0
}
Expand Down

0 comments on commit 7e68ba8

Please sign in to comment.