-
Notifications
You must be signed in to change notification settings - Fork 7
85 lines (82 loc) · 2.86 KB
/
CI.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
# This is a basic workflow to help you get started with Actions
name: CI
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
release:
types: [ published ]
jobs:
Build:
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v3
- name: Setup PowerShell module cache
uses: actions/cache@v3
id: cacher
with:
path: "~/.local/share/powershell/Modules"
key: crescendo-1.1-preview-cache
- name: Install Crescendo
if: steps.cacher.outputs.cache-hit != 'true'
shell: pwsh
run: Install-Module Microsoft.PowerShell.Crescendo -AllowPrerelease -RequiredVersion 1.1.0-Preview01 -Force
- name: Build the module with Crescendo
shell: pwsh
run: ./build.ps1
- name: Bundle up module
uses: actions/upload-artifact@v3
with:
name: module
path: ./src/
Test:
needs: Build
runs-on: windows-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v3
- name: Download module
uses: actions/download-artifact@v3
with:
name: module
path: C:\Users\runneradmin\Documents\PowerShell\Modules\Cobalt\
- name: Install WinGet
shell: pwsh
run: .\Install-WinGet.ps1
- name: Test with Pester
run: |
# Codepage 437 being the default input and output OEM code page for US-English systems
# Maybe one day we can all use UTF-8 by default and be done with this nonsense: https://stackoverflow.com/questions/57131654/using-utf-8-encoding-chcp-65001-in-command-prompt-windows-powershell-window/57134096#57134096
# Required for simulated the encoding used by interactive terminals
[Console]::InputEncoding = [Console]::OutputEncoding = [System.Text.Encoding]::GetEncoding(437)
Invoke-Pester -Configuration (New-PesterConfiguration -Hashtable @{
Run = @{
Exit = $true
}
Output = @{
Verbosity = 'Detailed'
}
})
- name: Upload WinGet logs
if: always()
uses: actions/upload-artifact@v3
with:
name: WinGet-logs
path: C:\Users\runneradmin\AppData\Local\Packages\Microsoft.DesktopAppInstaller*\LocalState\DiagOutputDir\
Publish:
needs: Test
if: github.event_name == 'release' && github.event.action == 'published'
runs-on: ubuntu-latest
steps:
- name: Download module
uses: actions/download-artifact@v3
with:
name: module
path: '~/.local/share/powershell/Modules/Cobalt'
- name: Publish Module
env:
NUGET_KEY: ${{ secrets.NUGET_KEY }}
shell: pwsh
run: Write-Output "Publishing..."; Publish-Module -Name Cobalt -NuGetApiKey $env:NUGET_KEY -Exclude @('Cobalt.ps1')