Skip to content

Commit

Permalink
Merge branch 'main' into bewhite/repo-config
Browse files Browse the repository at this point in the history
  • Loading branch information
BernieWhite authored Feb 5, 2023
2 parents 4f6ae81 + 5462f35 commit 68a7978
Show file tree
Hide file tree
Showing 320 changed files with 23,024 additions and 7,715 deletions.
98 changes: 29 additions & 69 deletions .azure-pipelines/azure-pipelines.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,23 +2,19 @@
# CI pipeline for PSRule

variables:
version: '2.1.0'
version: '2.5.0'
buildConfiguration: 'Release'
disable.coverage.autogenerate: 'true'
imageName: 'ubuntu-20.04'
imageName: 'ubuntu-22.04'

# Use build number format, i.e. 2.1.0-B2203001
# Use build number format, i.e. 2.5.0-B2203001
name: $(version)-B$(date:yyMM)$(rev:rrr)

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

pr:
branches:
Expand Down Expand Up @@ -115,7 +111,7 @@ stages:

- job: Secret_Scan
pool:
vmImage: 'windows-2019'
vmImage: 'windows-2022'
displayName: Secret scan

steps:
Expand All @@ -142,84 +138,48 @@ stages:

- template: jobs/test.yaml
parameters:
name: ubuntu_20_04_coverage
imageName: 'ubuntu-20.04'
name: ubuntu_22_04_coverage
imageName: 'ubuntu-22.04'
displayName: 'PowerShell coverage'
coverage: 'true'
publishResults: 'false'

- template: jobs/test.yaml
parameters:
name: macOS_10_15
displayName: 'PowerShell 7.2 - macOS-10.15'
imageName: 'macOS-10.15'
name: macOS_11
displayName: 'PowerShell 7.2 - macOS-11'
imageName: 'macOS-11'

- template: jobs/test.yaml
parameters:
name: ps_5_1_windows_2019
displayName: 'PowerShell 5.1 - Windows 2019'
imageName: 'windows-2019'
name: ps_5_1_windows_2022
displayName: 'PowerShell 5.1 - Windows 2022'
imageName: 'windows-2022'
pwsh: 'false'

- template: jobs/test.yaml
parameters:
name: ps_7_2_windows_2019
displayName: 'PowerShell 7.2 - Windows 2019'
imageName: 'windows-2019'
name: ps_7_2_windows_2022
displayName: 'PowerShell 7.2 - Windows 2022'
imageName: 'windows-2022'

# - template: jobs/testContainer.yaml
# parameters:
# name: alpine_3_14
# displayName: 'PowerShell 7.2 - alpine-3.14'
# imageName: mcr.microsoft.com/powershell/test-deps
# imageTag: alpine-3.14

- template: jobs/testContainer.yaml
parameters:
name: alpine_3_14
displayName: 'PowerShell 7.2 - alpine-3.14'
imageName: mcr.microsoft.com/powershell/test-deps
imageTag: alpine-3.14
name: ps_7_2_ubuntu_22_04
displayName: 'PowerShell 7.2 - ubuntu-22.04'
imageName: mcr.microsoft.com/powershell
imageTag: 7.2-ubuntu-22.04

- template: jobs/testContainer.yaml
parameters:
name: ps_7_2_ubuntu_20_04
displayName: 'PowerShell 7.2 - ubuntu-20.04'
name: ps_7_3_ubuntu_22_04
displayName: 'PowerShell 7.3 - ubuntu-22.04'
imageName: mcr.microsoft.com/powershell
imageTag: 7.2.2-ubuntu-20.04

# Release pipeline
# - stage: Release
# displayName: Release
# dependsOn: [ 'Test', 'Analysis' ]
# condition: and(succeeded(), or(startsWith(variables['Build.SourceBranch'], 'refs/tags/v1.'), startsWith(variables['Build.SourceBranch'], 'refs/tags/v2.')))
# jobs:
# - job:
# displayName: Live
# pool:
# vmImage: $(imageName)
# variables:
# isPreRelease: $[contains(variables['Build.SourceBranchName'], '-B')]
# steps:

# # Download module from build
# - task: DownloadPipelineArtifact@2
# displayName: 'Download module'
# inputs:
# artifact: PSRule
# path: $(Build.SourcesDirectory)/out/modules/PSRule

# # Install pipeline dependencies
# - powershell: ./.azure-pipelines/pipeline-deps.ps1
# displayName: 'Install dependencies'

# # Install pipeline dependencies and build module
# - powershell: Invoke-Build Release -ApiKey $(apiKey)
# displayName: 'Publish module'

# # Update GitHub release
# - task: GitHubRelease@1
# displayName: 'GitHub release'
# inputs:
# gitHubConnection: 'AzureDevOps-PSRule'
# repositoryName: '$(Build.Repository.Name)'
# action: edit
# tag: '$(Build.SourceBranchName)'
# releaseNotesSource: inline
# releaseNotesInline: 'See [change log](https://github.com/Microsoft/PSRule/blob/main/CHANGELOG.md)'
# assetUploadMode: replace
# addChangeLog: false
# isPreRelease: $(isPreRelease)
imageTag: 7.3-ubuntu-22.04
10 changes: 10 additions & 0 deletions .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.

# Visual Studio Code image with .NET

# NOTE:
# See here for image contents: https://github.com/microsoft/vscode-dev-containers/tree/v0.245.2/containers/dotnet/.devcontainer/base.Dockerfile

ARG VARIANT="6.0-bullseye-slim"
FROM mcr.microsoft.com/vscode/devcontainers/dotnet:0-${VARIANT}
4 changes: 4 additions & 0 deletions .devcontainer/container-build.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
# This is run during container creation.

# Install Python 3 dependencies
sudo apt install python3-pip -y
sudo python3 -m pip install --upgrade pip
sudo python3 -m pip install wheel

Expand All @@ -19,3 +20,6 @@ if ($Null -eq (Get-InstalledModule -Name PowerShellGet -MinimumVersion 2.2.1 -Er
if ($Null -eq (Get-InstalledModule -Name InvokeBuild -MinimumVersion 5.4.0 -ErrorAction Ignore)) {
Install-Module InvokeBuild -MinimumVersion 5.4.0 -Scope CurrentUser -Force;
}

Import-Module ./scripts/dependencies.psm1;
Install-Dependencies -Dev;
2 changes: 1 addition & 1 deletion .devcontainer/container-start.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
# This is run during container startup.

# Install Python packages
# pip install -r requirements-docs.txt
pip install -r requirements-docs.txt

# Restore .NET packages
dotnet restore
46 changes: 27 additions & 19 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -1,25 +1,33 @@
{
"name": "PSRule dev",
"settings": {
"$schema": "https://raw.githubusercontent.com/devcontainers/spec/main/schemas/devContainer.schema.json",
"name": "PSRule dev",
"customizations": {
"vscode": {
"settings": {
"terminal.integrated.defaultProfile.linux": "pwsh",
"terminal.integrated.profiles.linux": {
"pwsh": {
"path": "/bin/pwsh"
}
"pwsh": {
"path": "/opt/microsoft/powershell/7/pwsh"
}
}
},
"extensions": [
"ms-azure-devops.azure-pipelines",
"davidanson.vscode-markdownlint",
"bewhite.psrule-vscode-preview",
},
"extensions": [
"ms-dotnettools.csharp",
"eamodio.gitlens",
"github.vscode-pull-request-github",
"streetsidesoftware.code-spell-checker"
],
"features": {
"github-cli": "latest"
},
"onCreateCommand": "/bin/pwsh -f .devcontainer/container-build.ps1",
"postStartCommand": "/bin/pwsh -f .devcontainer/container-start.ps1"
"bewhite.psrule-vscode-preview"
]
}
},
"features": {
"github-cli": "latest",
"powershell": "latest"
},
"onCreateCommand": "/opt/microsoft/powershell/7/pwsh -f .devcontainer/container-build.ps1",
"postStartCommand": "/opt/microsoft/powershell/7/pwsh -f .devcontainer/container-start.ps1",
"build": {
"dockerfile": "Dockerfile",
"args": {
"VARIANT": "6.0-bullseye-slim"
}
},
"remoteUser": "vscode"
}
26 changes: 25 additions & 1 deletion .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ root = true
[*]
charset = utf-8
indent_style = space
insert_final_newline = true

# Source code
[*.{cs,ps1,psd1,psm1}]
Expand Down Expand Up @@ -44,4 +45,27 @@ csharp_prefer_simple_default_expression = true:suggestion
# Prefer "var" everywhere
csharp_style_var_for_built_in_types = true:suggestion
csharp_style_var_when_type_is_apparent = true:suggestion
csharp_style_var_elsewhere = true:suggestion
csharp_style_var_elsewhere = true:suggestion

# Define the 'private_fields' symbol group:
dotnet_naming_symbols.private_fields.applicable_kinds = field
dotnet_naming_symbols.private_fields.applicable_accessibilities = private

# Define the 'private_static_fields' symbol group
dotnet_naming_symbols.private_static_fields.applicable_kinds = field
dotnet_naming_symbols.private_static_fields.applicable_accessibilities = private
dotnet_naming_symbols.private_static_fields.required_modifiers = static

# Define the 'underscored' naming style
dotnet_naming_style.underscored.capitalization = pascal_case
dotnet_naming_style.underscored.required_prefix = _

# Private instance fields must use pascal case with a leading '_'
dotnet_naming_rule.private_fields_underscored.symbols = private_fields
dotnet_naming_rule.private_fields_underscored.style = underscored
dotnet_naming_rule.private_fields_underscored.severity = error

# Exclude private static fields from underscored style
dotnet_naming_rule.private_static_fields_none.symbols = private_static_fields
dotnet_naming_rule.private_static_fields_none.style = underscored
dotnet_naming_rule.private_static_fields_none.severity = none
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ Steps to reproduce the issue:
**Module in use and version:**

- Module: PSRule
- Version: **[e.g. 2.0.0]**
- Version: **[e.g. 2.4.0]**

Captured output from `$PSVersionTable`:

Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/analyze.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ on:
- cron: '24 22 * * 0' # At 10:24 PM, on Sunday each week
workflow_dispatch:

permissions: {}

jobs:
oss:
name: Analyze with PSRule
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/dependencies.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ on:
env:
WORKING_BRANCH: dependencies/powershell-bump

permissions: {}

jobs:
dependencies:
name: Bump dependencies
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/docs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ on:
- main
workflow_dispatch:

permissions: {}

jobs:
deploy:
name: Publish docs
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/first-interaction.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ name: First interaction

on: [pull_request_target, issues]

permissions: {}

jobs:
greeting:
name: Greeting
Expand Down
4 changes: 3 additions & 1 deletion .github/workflows/stale.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ on:
- cron: '30 1 * * *'
workflow_dispatch:

permissions: {}

jobs:
issue:
name: Close stale issues
Expand All @@ -20,7 +22,7 @@ jobs:
issues: write
steps:

- uses: actions/stale@v5
- uses: actions/stale@v7
with:
stale-issue-message: >
This issue has been automatically marked as stale because it has not had
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,4 @@ BenchmarkDotNet.Artifacts/
.sonarqube/
TestResults/
*.diagsession
**/.DS_Store
2 changes: 1 addition & 1 deletion .markdownlint.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
"no-reversed-links": true,
"no-multiple-blanks": true,
"line-length": {
"line_length": 100,
"line_length": 120,
"code_blocks": false,
"tables": false,
"headers": true
Expand Down
Loading

0 comments on commit 68a7978

Please sign in to comment.