init action #8
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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" | |
} | |