Skip to content

Commit

Permalink
Updated pipeline files to support change of default branch to main
Browse files Browse the repository at this point in the history
  • Loading branch information
johlju committed Feb 14, 2021
1 parent 3ae6780 commit 435b5ea
Show file tree
Hide file tree
Showing 6 changed files with 23 additions and 25 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
20 changes: 5 additions & 15 deletions GitVersion.yml
Original file line number Diff line number Diff line change
@@ -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']
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -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/)

Expand Down
8 changes: 6 additions & 2 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
trigger:
branches:
include:
- master
- main
paths:
exclude:
- CHANGELOG.md
Expand Down Expand Up @@ -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')
Expand All @@ -291,6 +291,8 @@ stages:
env:
GitHubToken: $(GitHubToken)
GalleryApiToken: $(GalleryApiToken)
ReleaseBranch: main
MainGitBranch: main
- task: PowerShell@2
name: send_changelog_PR
inputs:
Expand All @@ -299,3 +301,5 @@ stages:
pwsh: true
env:
GitHubToken: $(GitHubToken)
ReleaseBranch: main
MainGitBranch: main
2 changes: 1 addition & 1 deletion source/DscResource.Test.psd1
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down
8 changes: 4 additions & 4 deletions tests/QA/module.tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
}
Expand Down

0 comments on commit 435b5ea

Please sign in to comment.