-
Notifications
You must be signed in to change notification settings - Fork 1
78 lines (67 loc) · 2.09 KB
/
cli-integration-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
name: CLI Integration test
on:
pull_request:
types:
- opened
- synchronize
- reopened
- closed
branches:
- main
jobs:
test:
# only run if not closed or closed with merge
if: ${{ github.event.pull_request.merged == true || github.event.pull_request.state != 'closed' }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
report_json_file: InfraPatch_Statistics.json
strategy:
matrix:
os:
- macos-latest
- ubuntu-latest
# - windows-latest Windows does currently not work because of pygohcl
runs-on: ${{ matrix.os }}
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Install Python
uses: actions/setup-python@v4
with:
python-version: "3.11"
- name: Install InfraPatch CLI
run: |
python -m pip install .
shell: bash
- name: Run InfraPatch report
shell: bash
run: infrapatch --debug report --dump-json-statistics
- name: Check report result
shell: pwsh
run: |
$report = Get-Content $env:report_json_file -Raw | ConvertFrom-Json
if ( -not $report.total_resources -gt 0 ) {
throw "Failed to get resources"
}
if ( $report.resources_patched -ne 0 ) {
throw "No resources should be patched"
}
if ( $report.errors -gt 0 ) {
throw "Errors have been detected"
}
- name: Run InfraPatch report
shell: bash
run: infrapatch --debug update --dump-json-statistics --confirm
- name: Check report result
shell: pwsh
run: |
$report = Get-Content $env:report_json_file -Raw | ConvertFrom-Json
if ( -not $report.total_resources -gt 0 ) {
throw "Failed to get resources"
}
if ( $report.resources_patched -gt 2 ) {
throw "No resources should be patched"
}
if ( $report.errors -gt 0 ) {
throw "Errors have been detected"
}