Build #480
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# | |
# Repository build and analysis | |
# | |
# NOTES: | |
# This workflow uses PSRule, 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 | |
# DevSkim - https://github.com/microsoft/DevSkim-Action and https://github.com/Microsoft/DevSkim | |
name: Build | |
on: | |
push: | |
branches: [main, 'release/*', 'dependencies/*'] | |
pull_request: | |
branches: [main, 'release/*'] | |
schedule: | |
- cron: '42 18 * * 0' # At 6:42 PM, on Sunday each week | |
workflow_dispatch: | |
permissions: {} | |
jobs: | |
test: | |
name: Tests | |
runs-on: ubuntu-latest | |
permissions: | |
contents: read | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Register repository | |
shell: pwsh | |
run: |- | |
$Null = New-Item -Path out/repo -Type Directory -Force; | |
Invoke-WebRequest -Uri 'https://www.powershellgallery.com/api/v2/package/PSRule/1.11.1' -OutFile out/repo/PSRule.1.11.1.nupkg; | |
Invoke-WebRequest -Uri 'https://www.powershellgallery.com/api/v2/package/PSRule.Rules.MSFT.OSS/1.0.1' -OutFile out/repo/PSRule.Rules.MSFT.OSS.1.0.1.nupkg; | |
Save-Module -Name PSRule.Rules.MSFT.OSS -Repository PSGallery -Path out/repo/; | |
Register-PSRepository -SourceLocation out/repo -Name Local -InstallationPolicy Trusted; | |
- name: Run PSRule v1 | |
uses: ./ | |
with: | |
inputType: repository | |
modules: PSRule.Rules.MSFT.OSS | |
repository: Local | |
version: '1.11.1' | |
- name: Run PSRule v2 | |
uses: ./ | |
with: | |
inputType: repository | |
modules: PSRule.Rules.MSFT.OSS | |
outcome: Problem | |
- name: Unregister repository | |
shell: pwsh | |
if: always() | |
run: |- | |
Unregister-PSRepository -Name Local -ErrorAction Ignore; | |
run: | |
name: Analyze repository | |
runs-on: ubuntu-latest | |
needs: 'test' | |
permissions: | |
contents: read | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Run PSRule self analysis | |
uses: ./ | |
with: | |
inputType: repository | |
outputFormat: Markdown | |
outputPath: reports/report.md | |
modules: PSRule.Rules.MSFT.OSS | |
prerelease: true | |
- name: PSRule results | |
uses: actions/upload-artifact@v4 | |
if: always() | |
with: | |
name: PSRule-results | |
path: reports/report.md | |
oss: | |
name: Analyze with PSRule | |
runs-on: ubuntu-latest | |
permissions: | |
contents: read | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Run PSRule analysis | |
uses: microsoft/ps-rule@main | |
with: | |
modules: PSRule.Rules.MSFT.OSS | |
prerelease: true | |
devskim: | |
name: Analyze with DevSkim | |
runs-on: ubuntu-latest | |
permissions: | |
actions: read | |
contents: read | |
security-events: write | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Run DevSkim scanner | |
uses: microsoft/DevSkim-Action@v1 | |
with: | |
directory-to-scan: . | |
- name: Upload results to security tab | |
uses: github/codeql-action/upload-sarif@v3 | |
with: | |
sarif_file: devskim-results.sarif |