From 435b5ea6f9281289d318aed5c608c1b81547562e Mon Sep 17 00:00:00 2001 From: Johan Ljunggren Date: Sun, 14 Feb 2021 10:35:26 +0100 Subject: [PATCH] Updated pipeline files to support change of default branch to main --- CHANGELOG.md | 4 ++++ GitVersion.yml | 20 +++++--------------- README.md | 6 +++--- azure-pipelines.yml | 8 ++++++-- source/DscResource.Test.psd1 | 2 +- tests/QA/module.tests.ps1 | 8 ++++---- 6 files changed, 23 insertions(+), 25 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e1c395d..0c976e8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +### Changed + +- Rename the default branch to `main` ([issue #104](https://github.com/dsccommunity/DscResource.Test/issues/104)). + ## [0.15.0] - 2021-02-09 ### Added diff --git a/GitVersion.yml b/GitVersion.yml index 3c0d952..8b152df 100644 --- a/GitVersion.yml +++ b/GitVersion.yml @@ -1,38 +1,28 @@ mode: ContinuousDelivery next-version: 0.1 -major-version-bump-message: '\s?(breaking|major|breaking\schange)' -minor-version-bump-message: '\s?(add|feature|minor)' +major-version-bump-message: '(breaking\schange|breaking|major)\b' +minor-version-bump-message: '(adds?|features?|minor)\b' patch-version-bump-message: '\s?(fix|patch)' no-bump-message: '\+semver:\s?(none|skip)' assembly-informational-format: '{NuGetVersionV2}+Sha.{Sha}.Date.{CommitDate}' branches: master: tag: preview + regex: ^main$ pull-request: tag: PR feature: tag: useBranchName increment: Minor - regex: f(eature(s)?)?[/-] + regex: f(eature(s)?)?[\/-] source-branches: ['master'] hotfix: tag: fix increment: Patch - regex: (hot)?fix(es)?[/-] + regex: (hot)?fix(es)?[\/-] source-branches: ['master'] ignore: sha: [] merge-message-formats: {} - -# feature: -# tag: useBranchName -# increment: Minor -# regex: f(eature(s)?)?[/-] -# source-branches: ['master'] -# hotfix: -# tag: fix -# increment: Patch -# regex: (hot)?fix(es)?[/-] -# source-branches: ['master'] diff --git a/README.md b/README.md index 8889075..dc68e17 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,8 @@ # DscResource.Test -[![Build Status](https://dev.azure.com/dsccommunity/DscResource.Test/_apis/build/status/dsccommunity.DscResource.Test?branchName=master)](https://dev.azure.com/dsccommunity/DscResource.Test/_build/latest?definitionId=3&branchName=master) -![Code Coverage](https://img.shields.io/azure-devops/coverage/dsccommunity/DscResource.Test/3/master) -[![Azure DevOps tests](https://img.shields.io/azure-devops/tests/dsccommunity/DscResource.Test/3/master)](https://dsccommunity.visualstudio.com/DscResource.Test/_test/analytics?definitionId=3&contextType=build) +[![Build Status](https://dev.azure.com/dsccommunity/DscResource.Test/_apis/build/status/dsccommunity.DscResource.Test?branchName=main)](https://dev.azure.com/dsccommunity/DscResource.Test/_build/latest?definitionId=3&branchName=main) +![Code Coverage](https://img.shields.io/azure-devops/coverage/dsccommunity/DscResource.Test/3/main) +[![Azure DevOps tests](https://img.shields.io/azure-devops/tests/dsccommunity/DscResource.Test/3/main)](https://dsccommunity.visualstudio.com/DscResource.Test/_test/analytics?definitionId=3&contextType=build) [![PowerShell Gallery (with prereleases)](https://img.shields.io/powershellgallery/vpre/DscResource.Test?label=DscResource.Test%20Preview)](https://www.powershellgallery.com/packages/DscResource.Test/) [![PowerShell Gallery](https://img.shields.io/powershellgallery/v/DscResource.Test?label=DscResource.Test)](https://www.powershellgallery.com/packages/DscResource.Test/) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index e8106ab..2485ed5 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -1,7 +1,7 @@ trigger: branches: include: - - master + - main paths: exclude: - CHANGELOG.md @@ -266,7 +266,7 @@ stages: and( succeeded(), or( - eq(variables['Build.SourceBranch'], 'refs/heads/master'), + eq(variables['Build.SourceBranch'], 'refs/heads/main'), startsWith(variables['Build.SourceBranch'], 'refs/tags/') ), contains(variables['System.TeamFoundationCollectionUri'], 'dsccommunity') @@ -291,6 +291,8 @@ stages: env: GitHubToken: $(GitHubToken) GalleryApiToken: $(GalleryApiToken) + ReleaseBranch: main + MainGitBranch: main - task: PowerShell@2 name: send_changelog_PR inputs: @@ -299,3 +301,5 @@ stages: pwsh: true env: GitHubToken: $(GitHubToken) + ReleaseBranch: main + MainGitBranch: main diff --git a/source/DscResource.Test.psd1 b/source/DscResource.Test.psd1 index b1d22b6..4c89ef3 100644 --- a/source/DscResource.Test.psd1 +++ b/source/DscResource.Test.psd1 @@ -90,7 +90,7 @@ Tags = @('DesiredStateConfiguration', 'DSC', 'DSCResourceKit', 'DSCResource') # A URL to the license for this module. - LicenseUri = 'https://github.com/dsccommunity/DscResource.Test/blob/master/LICENSE' + LicenseUri = 'https://github.com/dsccommunity/DscResource.Test/blob/main/LICENSE' # A URL to the main website for this project. ProjectUri = 'https://github.com/dsccommunity/DscResource.Test' diff --git a/tests/QA/module.tests.ps1 b/tests/QA/module.tests.ps1 index c285fb3..17aaec3 100644 --- a/tests/QA/module.tests.ps1 +++ b/tests/QA/module.tests.ps1 @@ -20,12 +20,12 @@ $allModuleFunctions = &$mut {Get-Command -Module $args[0] -CommandType Function !([bool](Get-Command git -EA SilentlyContinue) -and [bool](&(Get-Process -id $PID).Path -NoProfile -Command 'git rev-parse --is-inside-work-tree 2>$null')) ) { - # Get the list of changed files compared with master + # Get the list of changed files compared with branch main $HeadCommit = &git rev-parse HEAD - $MasterCommit = &git rev-parse origin/master - $filesChanged = &git @('diff', "$MasterCommit...$HeadCommit", '--name-only') + $defaultBranchCommit = &git rev-parse origin/main + $filesChanged = &git @('diff', "$defaultBranchCommit...$HeadCommit", '--name-only') - if($HeadCommit -ne $MasterCommit) { # if we're not testing same commit (i.e. master..master) + if($HeadCommit -ne $defaultBranchCommit) { # if we're not testing same commit (i.e. main..main) $filesChanged.Where{ (Split-Path $_ -Leaf) -match '^changelog' } | Should -Not -BeNullOrEmpty } }