Skip to content

Commit

Permalink
Update PSRule version #24 #25 (#26)
Browse files Browse the repository at this point in the history
  • Loading branch information
BernieWhite authored Dec 22, 2021
1 parent 3157f03 commit 013409d
Show file tree
Hide file tree
Showing 8 changed files with 70 additions and 17 deletions.
10 changes: 6 additions & 4 deletions .azure-pipelines/azure-pipelines.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,26 +2,28 @@
# CI pipeline for PSRule.Rules.MSFT.OSS

variables:
version: '0.2.0'
version: '1.0.0'
buildConfiguration: 'Release'
disable.coverage.autogenerate: 'true'
imageName: 'ubuntu-20.04'

# Use build number format, i.e. 0.2.0-B2107001
# Use build number format, i.e. 1.0.0-B2112001
name: $(version)-B$(date:yyMM)$(rev:rrr)

trigger:
branches:
include:
- 'main'
- 'release/*'
tags:
include:
- 'v0.*'
- 'v1.*'

pr:
branches:
include:
- 'main'
- 'release/*'

stages:

Expand Down Expand Up @@ -152,7 +154,7 @@ stages:
- stage: Release
displayName: Release
dependsOn: [ 'Test', 'Analysis' ]
condition: and(succeeded(), startsWith(variables['Build.SourceBranch'], 'refs/tags/v0.'))
condition: and(succeeded(), startsWith(variables['Build.SourceBranch'], 'refs/tags/v1.'))
variables:
# Already run in build stage
skipComponentGovernanceDetection: 'true'
Expand Down
45 changes: 40 additions & 5 deletions .github/workflows/analyze.yaml
Original file line number Diff line number Diff line change
@@ -1,13 +1,26 @@
#
# Repository validation
# Repository analysis
#

# NOTES:
# This worflow uses PSRule, CodeQL, and DevSkim.
# You can read more about these linting tools and configuration options here:
# PSRule - https://aka.ms/ps-rule and https://github.com/Microsoft/PSRule.Rules.MSFT.OSS
# CodeQL - https://codeql.github.com/docs/codeql-overview/about-codeql/
# DevSkim - https://github.com/microsoft/DevSkim-Action and https://github.com/Microsoft/DevSkim

name: Analyze
on:
- pull_request
- push
push:
branches: [ main, 'release/*' ]
pull_request:
branches: [ main, 'release/*' ]
schedule:
- cron: '15 20 * * 0' # At 08:15 PM, on Sunday each week

jobs:
analyze:
name: Analyze repository
oss:
name: Analyze with PSRule
runs-on: ubuntu-latest
steps:

Expand All @@ -19,3 +32,25 @@ jobs:
uses: Microsoft/ps-rule@main
with:
source: src/PSRule.Rules.MSFT.OSS/

devskim:
name: Analyze with DevSkim
runs-on: ubuntu-latest
permissions:
actions: read
contents: read
security-events: write
steps:

- name: Checkout
uses: actions/[email protected]

- name: Run DevSkim scanner
uses: microsoft/DevSkim-Action@v1
with:
directory-to-scan: src/

- name: Upload results to security tab
uses: github/codeql-action/upload-sarif@v1
with:
sarif_file: devskim-results.sarif
9 changes: 9 additions & 0 deletions .vscode/tasks.json
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,15 @@
"type": "shell",
"command": "Invoke-Build BuildRuleDocs",
"problemMatcher": []
},
{
"type": "PSRule",
"problemMatcher": [
"$PSRule"
],
"inputPath": "${workspaceFolder}",
"path": "src/PSRule.Rules.MSFT.OSS/",
"label": "PSRule: Run analysis"
}
]
}
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,13 @@

## Unreleased

What's changed since v0.1.0:

- Updated rules:
- Updated rule documentation links. [#25](https://github.com/microsoft/PSRule.Rules.MSFT.OSS/issues/25)
- Engineering:
- Bump PSRule dependency to v1.10.0. [#24](https://github.com/microsoft/PSRule.Rules.MSFT.OSS/issues/24)

## v0.1.0

- Initial release.
Expand Down
8 changes: 4 additions & 4 deletions pipeline.build.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ if ($Env:SYSTEM_DEBUG -eq 'true') {
$VerbosePreference = 'Continue';
}

if ($Env:BUILD_SOURCEBRANCH -like '*/tags/*' -and $Env:BUILD_SOURCEBRANCHNAME -like 'v0.*') {
if ($Env:BUILD_SOURCEBRANCH -like '*/tags/*' -and $Env:BUILD_SOURCEBRANCHNAME -like 'v1.*') {
$Build = $Env:BUILD_SOURCEBRANCHNAME.Substring(1);
}

Expand Down Expand Up @@ -108,7 +108,7 @@ task VersionModule ModuleDependencies, {
$manifest = Test-ModuleManifest -Path $manifestPath;
$requiredModules = $manifest.RequiredModules | ForEach-Object -Process {
if ($_.Name -eq 'PSRule' -and $Configuration -eq 'Release') {
@{ ModuleName = 'PSRule'; ModuleVersion = '1.2.0' }
@{ ModuleName = 'PSRule'; ModuleVersion = '1.10.0' }
}
else {
@{ ModuleName = $_.Name; ModuleVersion = $_.Version }
Expand Down Expand Up @@ -155,8 +155,8 @@ task PSScriptAnalyzer NuGet, {

# Synopsis: Install PSRule
task PSRule NuGet, {
if ($Null -eq (Get-InstalledModule -Name PSRule -MinimumVersion 1.2.0 -ErrorAction Ignore)) {
Install-Module -Name PSRule -Repository PSGallery -MinimumVersion 1.2.0 -Scope CurrentUser -Force;
if ($Null -eq (Get-InstalledModule -Name PSRule -MinimumVersion 1.10.0 -ErrorAction Ignore)) {
Install-Module -Name PSRule -Repository PSGallery -MinimumVersion 1.10.0 -Scope CurrentUser -Force;
}
Import-Module -Name PSRule -Verbose:$False;
}
Expand Down
2 changes: 1 addition & 1 deletion ps-project.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ bugs:
url: https://github.com/Microsoft/PSRule.Rules.MSFT.OSS/issues

modules:
PSRule: ^1.2.0
PSRule: ^1.10.0

tasks:
clear:
Expand Down
4 changes: 2 additions & 2 deletions src/PSRule.Rules.MSFT.OSS/en/MSFT.OSS.Community.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,5 @@ Consider adding required files in addition to GitHub community health files.

## LINKS

- [Releasing projects](https://docs.opensource.microsoft.com/content/releasing/index.html)
- [Creating a default community health file](https://docs.github.com/en/free-pro-team@latest/github/building-a-strong-community/creating-a-default-community-health-file)
- [Releasing projects](https://docs.opensource.microsoft.com/releasing/)
- [Creating a default community health file](https://docs.github.com/en/communities/setting-up-your-project-for-healthy-contributions/creating-a-default-community-health-file)
2 changes: 1 addition & 1 deletion src/PSRule.Rules.MSFT.OSS/en/MSFT.OSS.License.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,4 @@ Consider adding standard license header to code files.

## LINKS

- [Copyright headers](https://docs.opensource.microsoft.com/content/releasing/copyright-headers.html)
- [Copyright headers](https://docs.opensource.microsoft.com/releasing/maintain/copyright-headers/)

0 comments on commit 013409d

Please sign in to comment.