-
Notifications
You must be signed in to change notification settings - Fork 3
131 lines (121 loc) · 3.58 KB
/
test.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
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
name: Test
on:
push:
branches: [ main ]
paths-ignore:
- '**.md'
- '**.MD'
pull_request:
branches: [ main ]
types: [opened, synchronize, reopened]
paths-ignore:
- '**.md'
- '**.MD'
workflow_dispatch:
jobs:
test:
runs-on: windows-2019
name: Test
env:
TEST1: Test1
TEST2: Test2
TEST3: ${{ secrets.TEST_SECRET }}
TEST_MAPPING_PATH: "C:\\map"
strategy:
matrix:
docker_container: ["mcr.microsoft.com/windows/servercore:ltsc2019"]
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Test_Run_Default
uses: ./
with:
image: ${{ matrix.docker_container }}
mapping_path: 'c:\map'
entrypoint: powershell.exe
env_names: TEST_MAPPING_PATH
run: >-
c:\map\test\run_test.ps1 -testPath "c:\map\test\run_default.Tests.ps1";
- name: Test_ExtraArgs
uses: ./
with:
image: ${{ matrix.docker_container }}
mapping_path: 'c:\map'
workspace_path: ${{ github.workspace }}
extra_args: --entrypoint cmd.exe
run: >-
echo "Hello world";
exit %ERRORLEVEL%;
- name: Test_Environment
uses: ./
with:
image: ${{ matrix.docker_container }}
entrypoint: powershell.exe
mapping_path: 'c:\map'
env_names: TEST1, TEST2, TEST3
run: >-
c:\map\test\run_test.ps1 -testPath "c:\map\test\environment.Tests.ps1";
- name: Test_WorkPath
uses: ./
with:
image: ${{ matrix.docker_container }}
mapping_path: 'c:\map'
work_path: 'c:\temp'
entrypoint: powershell.exe
memory: 3GB
run: >-
c:\map\test\run_test.ps1 -testPath "c:\map\test\work_path.Tests.ps1";
- name: Test_MappingPath
uses: ./
with:
image: ${{ matrix.docker_container }}
mapping_path: 'c:\mapping'
work_path: 'c:\temp'
entrypoint: powershell.exe
memory: 3GB
run: >-
c:\mapping\test\run_test.ps1 -testPath "c:\mapping\test\mapping_path.Tests.ps1";
- name: Test_WorkSpacePath
uses: ./
with:
image: ${{ matrix.docker_container }}
mapping_path: 'c:\map'
workspace_path: ${{ github.workspace }}/test
entrypoint: powershell.exe
memory: 3GB
env_names: TEST_MAPPING_PATH
run: >-
c:\map\run_test.ps1 -testPath "c:\map\workspace_path.Tests.ps1";
validate:
runs-on: ubuntu-latest
name: Validate
container: mcr.microsoft.com/powershell:latest
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Install
shell: pwsh
run: >-
Set-PSRepository -Name 'PSGallery' -InstallationPolicy Trusted;
Install-Module -Name Pester -Force -SkipPublisherCheck;
Update-Module -Name Pester -Force;
Install-Module -Name PSScriptAnalyzer -Force;
- name: Linter src
shell: pwsh
run: >-
Invoke-ScriptAnalyzer -Path src -EnableExit;
- name: Linter test
shell: pwsh
run: >-
Invoke-ScriptAnalyzer -Path test -EnableExit;
- name: Test-Action-Scripts
shell: pwsh
run: >-
cd src;
$config=New-PesterConfiguration;
$config.Run.Exit=$true;
Invoke-Pester -Configuration $config;