Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
82 changes: 39 additions & 43 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,9 @@ env:
MODULE_NAME: Alt3.Docusaurus.PowerShell

jobs:
# compile the module
build:
name: Build Module
runs-on: windows-latest
steps:
- name: Checkout
Expand All @@ -30,70 +32,85 @@ jobs:
with:
useConfigFile: true

- name: Install-RequiredModules
- name: Install required modules
uses: PoshCode/Actions/install-requiredmodules@v1
with:
requiredModules-path: ${{github.workspace}}/Dev/RequiredModules.psd1

- name: Build Module
- name: Build module
id: build
uses: PoshCode/actions/build-module@v1
with:
path: ${{github.workspace}}/Source
version: ${{ steps.gitversion.outputs.LegacySemVerPadded }}
destination: ${{github.workspace}}/output

- name: Upload Build Output
- name: Upload artifact Modules
uses: actions/upload-artifact@v2
with:
name: Modules
path: ${{github.workspace}}/output

- name: Upload Tests
- name: Upload artifact PesterTests
uses: actions/upload-artifact@v2
with:
name: PesterTests
path: ${{github.workspace}}/Tests

- name: Upload RequiredModules.psd1
- name: Upload artifact RequiredModules
uses: actions/upload-artifact@v2
with:
name: RequiredModules
path: ${{github.workspace}}/Dev/RequiredModules.psd1

- name: Upload PSScriptAnalyzerSettings.psd1
- name: Upload artifact PSScriptAnalyzer
uses: actions/upload-artifact@v2
with:
name: ScriptAnalyzer
name: PSScriptAnalyzer
path: ${{github.workspace}}/PSScriptAnalyzerSettings.psd1

# ensure code formatting
lint:
name: Linting
needs: build
name: Run PSScriptAnalyzer
runs-on: ubuntu-latest
steps:
- name: Download Build Output
uses: actions/download-artifact@v2
- name: Download artifacts
uses: actions/download-artifact@v3

- name: Invoke-ScriptAnalyzer
- name: Display structure of downloaded artifacts
run: ls -R

- name: Run PSScriptAnalyzer
uses: devblackops/github-action-psscriptanalyzer@master
with:
rootPath: Modules/${{env.MODULE_NAME}}
repoToken: ${{ secrets.GITHUB_TOKEN }}
settingsPath: ScriptAnalyzer/PSScriptAnalyzerSettings.psd1
settingsPath: PSScriptAnalyzer/PSScriptAnalyzerSettings.psd1

# run pester tests
test:
name: Pester Tests
needs: build
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [windows-2019, ubuntu-18.04, ubuntu-20.04, macOS-10.15, macos-11] # https://github.com/actions/virtual-environments
os:
- windows-2019 # https://github.com/actions/virtual-environments
- windows-2022
- ubuntu-18.04
- ubuntu-20.04
- macos-11
- macos-12
steps:
- name: Download Build Output
uses: actions/download-artifact@v2
- name: Download artifacts
uses: actions/download-artifact@v3

- name: Display structure of downloaded artifacts
run: ls -R

- name: Install-RequiredModules
- name: Install required modules
uses: PoshCode/Actions/install-requiredmodules@v1
with:
requiredModules-path: ${{github.workspace}}/Dev/RequiredModules.psd1
Expand All @@ -105,34 +122,13 @@ jobs:
moduleUnderTest: ${{env.MODULE_NAME}}
additionalModulePaths: ${{github.workspace}}/Modules

- name: Publish Test Results artifact
uses: zyborg/dotnet-tests-report@v1
with:
test_results_path: results.xml

- name: Upload Test Results artifact
- name: Upload artifact PesterResults
uses: actions/upload-artifact@v2
if: matrix.os == 'windows-2022' # only execute on this OS
with:
name: Pester Results
name: PesterResults
path: ${{github.workspace}}/*.xml

coverage:
needs: [test]
name: Code Coverage
runs-on: ubuntu-latest
steps:
- name: Download Pester Results
uses: actions/download-artifact@v2
with:
name: Pester Results

- name: Show Code Coverage in PR
id: jacoco
uses: madrapps/jacoco-report@v1.2
with:
paths: coverage.xml
token: ${{ secrets.GITHUB_TOKEN }}

# -----------------------------------------------------------------------------
# Publishing stage:
# - is skipped completely UNLESS on the main branch
Expand All @@ -145,7 +141,7 @@ jobs:
publish:
name: Publish
runs-on: windows-latest
needs: [lint, coverage]
needs: [test, lint]
if: ${{ github.ref == 'refs/heads/main' && contains(github.event.head_commit.message, '[release]')}}

steps:
Expand All @@ -165,8 +161,8 @@ jobs:
with:
useConfigFile: true

- name: Download Build Output
uses: actions/download-artifact@v2
- name: Download Artifacts
uses: actions/download-artifact@v3

- name: Publish to PSGallery
uses: ./.github/actions/psgallery-publisher
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
[![Build](https://github.com/alt3/Docusaurus.PowerShell/actions/workflows/main.yml/badge.svg)](https://github.com/alt3/Docusaurus.PowerShell/actions/workflows/main.yml)
[![Netlify](https://img.shields.io/netlify/0f0b21b3-3caf-40a6-aaf8-4bc926523a0f?label=Netlify&style=flat-square)](https://app.netlify.app/sites/docusaurus-powershell/deploys/5da9a382df61220008fb04c0)
[![PowerShell Gallery](https://img.shields.io/powershellgallery/dt/Alt3.Docusaurus.PowerShell?style=flat-square)](https://www.powershellgallery.com/packages/Alt3.Docusaurus.PowerShell)
![Code Coverage](https://img.shields.io/codecov/c/github/alt3/Docusaurus.Powershell?style=flat-square)
[![Contributor Covenant](https://img.shields.io/badge/Contributor%20Covenant-v2.0%20adopted-ff69b4.svg?style=flat-square)](https://www.contributor-covenant.org/version/2/0/code_of_conduct)

# Docusaurus.PowerShell
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ Describe "Integration test to ensure that indentation is fixed for lines ending
(Get-Content -Path $test.MdxFile -Raw) -match "`r`n" | Should -Be $False
}

It "Content of generated $($test.Name) mdx file is identical to that of expected fixture" {
It "Content of generated mdx file is identical to that of expected fixture" {
$generatedMdx | Should -BeExactly $expectedMdx
}
}