Skip to content

Commit

Permalink
feat(ci): add test, lint and release jobs (#1)
Browse files Browse the repository at this point in the history
* feat(ci): add test & lint jobs

* fix(ci): release asset test to account for slight differences in paths

fix typo in module name

* feat(ci): include modules in lint path filter

* feat(ci): add release-please job
  • Loading branch information
scottmckendry committed May 23, 2024
1 parent a9c2589 commit 474d495
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 1 deletion.
40 changes: 40 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: CI
on:
push:

jobs:
test:
runs-on: windows-latest
steps:
- uses: actions/checkout@v4
- run: |
Invoke-Pester -PassThru
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- shell: pwsh
run: |
Set-PSRepository PSGallery -InstallationPolicy Trusted
Install-Module PSScriptAnalyzer
- shell: pwsh
run: |
Invoke-ScriptAnalyzer -Path *.ps* -Recurse -Outvariable issues
$errors = $issues.Where({$_.Severity -eq 'Error'})
$warnings = $issues.Where({$_.Severity -eq 'Warning'})
if ($errors) {
Write-Error "There were $($errors.Count) errors and $($warnings.Count) warnings total." -ErrorAction Stop
} else {
Write-Output "There were $($errors.Count) errors and $($warnings.Count) warnings total."
}
release:
runs-on: ubuntu-latest
needs: [test, lint]
if: github.ref == 'refs/heads/main'
steps:
- uses: google-github-actions/release-please-action@v4
with:
token: ${{ secrets.REPO_TOKEN }}
release-type: simple
2 changes: 1 addition & 1 deletion ps-arch-wsl/ps-arch-wsl.Tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Describe "Get-ReleaseAsset" {
InModuleScope ps-arch-wsl {
$foundAsset = Get-ReleaseAsset -Repository "yuk7/ArchWSL" -AssetFilter "cer"
$latestCertificateInTemp = Get-ChildItem $env:Temp | Where-Object { $_.FullName -like "*.cer" } | Sort-Object -Property CreationTime -Descending
$foundAsset | Should -Be $latestCertificateInTemp[0].FullName
$foundAsset.Split("\")[-1] | Should -Be $latestCertificateInTemp[0].FullName.Split("\")[-1]
}
}

Expand Down

0 comments on commit 474d495

Please sign in to comment.