Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
UniverseCitiz3n committed Jan 19, 2021
2 parents e039b96 + f825841 commit 02900b6
Show file tree
Hide file tree
Showing 6 changed files with 76 additions and 2 deletions.
18 changes: 18 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: Publish PowerShell Module

on:
release:
types: [published]

jobs:
publish-to-gallery:
runs-on: windows-latest
steps:
- uses: actions/checkout@v2
- name: Build and publish
env:
NUGET_KEY: ${{ secrets.NUGET_KEY }}
shell: pwsh
run: |
.\build\build.ps1
Publish-Module -Path .\Intune-App-Sandbox -NuGetApiKey $env:NUGET_KEY -Verbose
32 changes: 32 additions & 0 deletions .github/workflows/psgallery.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: Test PowerShell on Windows
on: push

jobs:
tests:
name: Pester test and ScriptAnalyzer
runs-on: windows-latest
steps:
- name: Check out repository code
uses: actions/checkout@v2
- name: Perform a Pester test from the Tests.ps1 file
shell: pwsh
run: |
Invoke-Pester .\tests\Unit.Tests.ps1 -Passthru
- name: Install PSScriptAnalyzer module
if: success()
shell: pwsh
run: |
Set-PSRepository PSGallery -InstallationPolicy Trusted
Install-Module PSScriptAnalyzer -ErrorAction Stop
- name: Lint with PSScriptAnalyzer
if: success()
shell: pwsh
run: |
Invoke-ScriptAnalyzer -Path .\Intune-App-Sandbox\Public\*.ps1 -Recurse -Outvariable issues -ExcludeRule PSAvoidUsingWriteHost,PSUseShouldProcessForStateChangingFunctions
$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."
}
2 changes: 1 addition & 1 deletion Intune-App-Sandbox/Public/Add-SandboxShell.ps1
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
function Add-SandboxShell {
function Add-SandboxShell {
<#
.SYNOPSIS
This tool is for testing Powershell Script which is packed using Win32 Content Prep Tool for installing software using Win32 Deployment profile in Intune.
Expand Down
2 changes: 1 addition & 1 deletion Intune-App-Sandbox/Public/Update-SandboxShell.ps1
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
function Update-SandboxShell {
function Update-SandboxShell {
<#
.SYNOPSIS
This tool is for testing Powershell Script which is packed using Win32 Content Prep Tool for installing software using Win32 Deployment profile in Intune.
Expand Down
13 changes: 13 additions & 0 deletions build/build.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
$Global:ErrorActionPreference = 'Stop'
$Global:VerbosePreference = 'SilentlyContinue'

### Prepare NuGet / PSGallery
if (!(Get-PackageProvider | Where-Object { $_.Name -eq 'NuGet' })) {
"Installing NuGet"
Install-PackageProvider -Name NuGet -force | Out-Null
}
"Preparing PSGallery repository"
Import-PackageProvider -Name NuGet -force | Out-Null
if ((Get-PSRepository -Name PSGallery).InstallationPolicy -ne 'Trusted') {
Set-PSRepository -Name PSGallery -InstallationPolicy Trusted
}
11 changes: 11 additions & 0 deletions tests/Unit.Tests.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
Describe "CHECK CONFIGURATION FILES ARE PRESENT" {
It "Check configuration files are present" {
(Get-ChildItem .\Intune-App-Sandbox\Configuration\* -Recurse | Measure-Object).Count | Should -Be 8
}
$Files = ('intunewin-Box-icon.ico', 'IntuneWinAppUtil.exe', 'IntuneWinAppUtilDecoder.exe', 'Invoke-IntunewinUtil.ps1', 'Invoke-Test.ps1', 'New-ToastNotification.ps1', 'sandbox.ico', 'toast.xml')
foreach ($item in $Files) {
It "Checking for $item" {
Test-Path .\Intune-App-Sandbox\Configuration\$item | Should -Be $true
}
}
}

0 comments on commit 02900b6

Please sign in to comment.