Skip to content

Commit

Permalink
initial minor version (#2)
Browse files Browse the repository at this point in the history
  • Loading branch information
MariusStorhaug authored Feb 11, 2024
1 parent 748b99d commit 3d50eca
Show file tree
Hide file tree
Showing 8 changed files with 201 additions and 2 deletions.
25 changes: 25 additions & 0 deletions .github/linters/.markdown-lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
###########################
## Markdown Linter rules ##
###########################

# Linter rules doc:
# - https://github.com/DavidAnson/markdownlint

###############
# Rules by id #
###############
MD004: false # Unordered list style
MD007:
indent: 2 # Unordered list indentation
MD013:
line_length: 808 # Line length
MD026:
punctuation: ".,;:!。,;:" # List of not allowed
MD029: false # Ordered list item prefix
MD033: false # Allow inline HTML
MD036: false # Emphasis used instead of a heading

#################
# Rules by tags #
#################
blank_lines: false # Error on blank lines
17 changes: 17 additions & 0 deletions .github/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# https://docs.github.com/en/repositories/releasing-projects-on-github/automatically-generated-release-notes#configuring-automatically-generated-release-notes

changelog:
categories:
- title: Breaking Changes
labels:
- Major
- Breaking
- title: New Features
labels:
- Minor
- Feature
- Improvement
- Enhancement
- title: Other Changes
labels:
- '*'
23 changes: 23 additions & 0 deletions .github/workflows/Action-Test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: Verify Action

on:
workflow_call:
push:
paths:
- action.yml
- .github/workflows/Action-Test.yml
- scripts/**

jobs:
DefaultTest:
name: Test Action - [Default]
runs-on: ubuntu-latest
steps:
- name: Checkout repo
uses: actions/checkout@v4

- name: Initialize environment
uses: PSModule/Initialize-PSModule@main

- name: Test local action
uses: ./
27 changes: 27 additions & 0 deletions .github/workflows/Auto-Release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: Auto-Release

on:
pull_request:
branches:
- main
types:
- closed
- opened
- reopened
- synchronize
- labeled

concurrency:
group: ${{ github.workflow }}

jobs:
Auto-Release:
runs-on: ubuntu-latest
steps:
- name: Checkout Code
uses: actions/checkout@v4

- name: Auto-Release
uses: PSModule/Auto-Release@v1
env:
GH_TOKEN: ${{ github.token }} # Used for GitHub CLI authentication
17 changes: 17 additions & 0 deletions .github/workflows/Linter.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
name: Linter

on:
pull_request:

jobs:
Lint:
name: Lint code base
runs-on: ubuntu-latest
steps:
- name: Checkout repo
uses: actions/checkout@v4

- name: Lint code base
uses: github/super-linter@latest
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
11 changes: 11 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
## Ignore Visual Studio Code temporary files, build results, and
## files generated by popular Visual Studio Code add-ons.
##
## Get latest from https://github.com/github/gitignore/blob/master/Global/VisualStudioCode.gitignore
.vscode/*
!.vscode/settings.json
!.vscode/extensions.json
*.code-workspace

# Local History for Visual Studio Code
.history/
13 changes: 11 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,11 @@
# test
Action that is used to test PowerShell modules
# Test-Module

Action that is used to test PowerShell modules.

## Tools

- [PSScriptAnalyzer | PS Gallery](https://www.powershellgallery.com/packages/PSScriptAnalyzer/)
- [PowerShell Core | Microsoft Learn](https://learn.microsoft.com/en-us/powershell/module/microsoft.powershell.core/test-modulemanifest)
- [PowerShellGet | Microsoft Learn](https://learn.microsoft.com/en-us/powershell/module/PowerShellGet/test-scriptfileinfo)
- [pester.dev](https://www.pester.dev)
- [Pester | GitHub](https://github.com/Pester/Pester)
70 changes: 70 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
name: 'Test-PSModule'
description: 'Test a PowerShell module before publishing the module to the PowerShell Gallery.'
branding:
icon: activity
color: blue

inputs:
Name:
description: 'The name of the module to build.'
required: false
default: '*'
Path:
description: 'The path to the module to build.'
required: false
default: 'outputs'
CustomTestsPath:
description: 'The path to the custom tests to run.'
required: false
default: $null
ErrorAction:
description: 'The action to take if an error occurs.'
required: false
default: 'Stop'
Verbose:
description: 'Enable verbose output.'
required: false
default: 'true'
WhatIf:
description: 'Run in WhatIf mode.'
required: false
default: 'false'

runs:
using: 'composite'
steps:
- name: Run Test-PSModule
shell: pwsh
run: |
# Test-PSModule
$ErrorActionPreference = '${{ inputs.ErrorAction }}'
Write-Host '::group::Initializing...'
Write-Output '-------------------------------------------'
Write-Output 'Action inputs:'
$params = @{
Name = "${{ inputs.Name }}"
Path = Join-Path $env:GITHUB_WORKSPACE '${{ inputs.Path }}'
Verbose = [System.Convert]::ToBoolean('${{ inputs.Verbose }}')
WhatIf = [System.Convert]::ToBoolean('${{ inputs.WhatIf }}')
ErrorAction = $ErrorActionPreference
}
if (-not [string]::IsNullOrEmpty("${{ inputs.CustomTestsPath }}")) {
$params['CustomTestsPath'] = Join-Path $env:GITHUB_WORKSPACE "${{ inputs.CustomTestsPath }}"
}
$params.GetEnumerator() | Sort-Object -Property Name
Write-Host '::endgroup::'
try {
$failedTests = Test-PSModule @params
} catch {
Write-Host "::error::$_"
exit 1
}
if ($ErrorActionPreference -like '*Continue') {
Write-Host '::warning::Errors were ignored.'
return
}

0 comments on commit 3d50eca

Please sign in to comment.