-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* feat(dev_requirements): Add pytest * refac(workspace_settings): Specify python interpreter path * refac(cicd): Combine actions in composition action and add unit tests. * fix(cicd): Remove custom arg from pytest. * fix(cicd): Add missing requirements for pytest * feat(tasks): Add task to install all dependencies. * feat(pytest_typehint): Add extension for pytest hints. * feat(tests): Add initial test. * ruff format * fix(pytest): Set pythonpath * fix(cicd): Pass python version to sub actions with input. * fix(cicd): Add input for sub actions * fix(cicd): Read python version from project file instead of env. * fix(cicd): python version var assignment
- Loading branch information
Showing
12 changed files
with
335 additions
and
195 deletions.
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,62 +1,55 @@ | ||
name: "GitHub Action integration test" | ||
|
||
permissions: | ||
contents: write | ||
pull-requests: write | ||
|
||
on: | ||
pull_request: | ||
branches: | ||
- main | ||
workflow_dispatch: | ||
|
||
jobs: | ||
integration-test: | ||
env: | ||
report_json_file: InfraPatch_Statistics.json | ||
|
||
name: "Run GitHub Action integration test" | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
|
||
- name: Run in report only mode | ||
uses: ./ | ||
with: | ||
report_only: true | ||
|
||
- name: Run in update mode | ||
id: update | ||
uses: ./ | ||
with: | ||
report_only: false | ||
target_branch_name: "feat/infrapatch_test_${{ github.run_number }}" | ||
|
||
- name: Check update 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 ( -not ( $report.resources_patched -gt 3 ) ) { | ||
throw "No resources should be patched" | ||
} | ||
if ( $report.errors -gt 0 ) { | ||
throw "Errors have been detected" | ||
} | ||
- name: Delete created branch$ | ||
if: always() | ||
uses: dawidd6/action-delete-branch@v3 | ||
with: | ||
github_token: ${{github.token}} | ||
branches: ${{ steps.update.outputs.target_branch }} | ||
soft_fail: true | ||
|
||
|
||
|
||
|
||
|
||
|
||
name: "GitHub Action integration test" | ||
|
||
on: | ||
workflow_call: | ||
|
||
jobs: | ||
integration-test: | ||
env: | ||
report_json_file: InfraPatch_Statistics.json | ||
|
||
name: "Run GitHub Action integration test" | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
|
||
- name: Run in report only mode | ||
uses: ./ | ||
with: | ||
report_only: true | ||
|
||
- name: Run in update mode | ||
id: update | ||
uses: ./ | ||
with: | ||
report_only: false | ||
target_branch_name: "feat/infrapatch_test_${{ github.run_number }}" | ||
|
||
- name: Check update 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 ( -not ( $report.resources_patched -gt 3 ) ) { | ||
throw "No resources should be patched" | ||
} | ||
if ( $report.errors -gt 0 ) { | ||
throw "Errors have been detected" | ||
} | ||
- name: Delete created branch$ | ||
if: always() | ||
uses: dawidd6/action-delete-branch@v3 | ||
with: | ||
github_token: ${{github.token}} | ||
branches: ${{ steps.update.outputs.target_branch }} | ||
soft_fail: true | ||
|
||
|
||
|
||
|
||
|
||
|
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
157 changes: 79 additions & 78 deletions
157
.github/workflows/cli-integration-test.yml → .github/workflows/cli_integration_test.yml
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,78 +1,79 @@ | ||
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 update | ||
shell: bash | ||
run: infrapatch --debug update --dump-json-statistics --confirm | ||
|
||
- name: Check update 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 ( -not ( $report.resources_patched -gt 3 ) ) { | ||
throw "No resources should be patched" | ||
} | ||
if ( $report.errors -gt 0 ) { | ||
throw "Errors have been detected" | ||
} | ||
name: CLI Integration test | ||
|
||
on: | ||
workflow_call: | ||
|
||
jobs: | ||
cli_integration_test: | ||
name: CLI Integration 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: Get Python Version | ||
id: get_python_verion | ||
run: | | ||
python_version=$(cat python_version.txt) | ||
echo "Using Python version $python_version" | ||
echo "::set-output name=python_version::$(echo $python_version)" | ||
- name: Install Python | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: ${{ steps.get_python_verion.outputs.python_version }} | ||
|
||
- 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 update | ||
shell: bash | ||
run: infrapatch --debug update --dump-json-statistics --confirm | ||
|
||
- name: Check update 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 ( -not ( $report.resources_patched -gt 3 ) ) { | ||
throw "No resources should be patched" | ||
} | ||
if ( $report.errors -gt 0 ) { | ||
throw "Errors have been detected" | ||
} | ||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
name: InfraPatch Checks | ||
|
||
permissions: | ||
contents: write | ||
pull-requests: write | ||
|
||
on: | ||
pull_request: | ||
types: | ||
- opened | ||
- synchronize | ||
- reopened | ||
- closed | ||
branches: | ||
- main | ||
|
||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
jobs: | ||
|
||
check_code: | ||
uses: ./.github/workflows/check_format_and_lint.yml | ||
|
||
unit_tests: | ||
needs: check_code | ||
uses: ./.github/workflows/unit_tests.yml | ||
|
||
cli_integration_test: | ||
needs: unit_tests | ||
uses: ./.github/workflows/cli_integration_test.yml | ||
|
||
github_action_integration_test: | ||
needs: unit_tests | ||
uses: ./.github/workflows/action_integration_test.yml | ||
|
Oops, something went wrong.