Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
matthewige committed Dec 13, 2024
1 parent 5901583 commit e467487
Showing 1 changed file with 15 additions and 10 deletions.
25 changes: 15 additions & 10 deletions .github/workflows/reusable-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -89,14 +89,19 @@ jobs:
TEST_TIMEOUT: 3600 # 1 hour timeout for tests.

steps:
- name: Log runson
run: |
echo "Running on ${{input.environment}}
echo ""
- name: Harden Runner
uses: step-security/harden-runner@0080882f6c36860b6ba35c610c98ce87d4e2f26f # v2.10.2
with:
egress-policy: audit

- name: Configure runner (Move to setup script directly later)
id: configure-runner
if: (inputs.self-hosted-runner)
if: (inputs.self-hosted-runner == true)
run: |
powershell.exe "cd C:\bin\CloudTestWorker\ProvisioningScript; dir; .\Setup_orig.ps1"
# powershell.exe "Get-NetAdapter"
Expand Down Expand Up @@ -125,7 +130,7 @@ jobs:

# Perform shallow checkout for self-hosted runner.
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
if: (inputs.self-hosted-runner) && (steps.skip_check.outputs.should_skip != 'true')
if: (inputs.self-hosted-runner == true) && (steps.skip_check.outputs.should_skip != 'true')
with:
ref: ${{ github.event.workflow_run.head_branch }}

Expand Down Expand Up @@ -174,7 +179,7 @@ jobs:
- name: Set up OpenCppCoverage and add to PATH
id: set_up_opencppcoverage
if: (inputs.code_coverage == true) && !(inputs.self-hosted-runner) && (steps.skip_check.outputs.should_skip != 'true')
if: (inputs.code_coverage == true) && (inputs.self-hosted-runner != true) && (steps.skip_check.outputs.should_skip != 'true')
run: |
choco install -y --requirechecksum=true --checksum=2295A733DA39412C61E4F478677519DD0BB1893D88313CE56B468C9E50517888 --checksum-type=sha256 OpenCppCoverage
echo "C:\Program Files\OpenCppCoverage" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
Expand All @@ -191,7 +196,7 @@ jobs:
New-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows\Windows Error Reporting\LocalDumps" -Name "DumpFolder" -Value "$dump_path" -PropertyType ExpandString -ErrorAction SilentlyContinue
- name: Remove existing artifacts
if: (inputs.self-hosted-runner) && (steps.skip_check.outputs.should_skip != 'true')
if: (inputs.self-hosted-runner == true) && (steps.skip_check.outputs.should_skip != 'true')
run: |
Remove-Item -Path ${{github.workspace}}\${{env.BUILD_PLATFORM}}\${{env.BUILD_CONFIGURATION}} -Recurse -Force -ErrorAction SilentlyContinue
Expand Down Expand Up @@ -248,14 +253,14 @@ jobs:
.\export_program_info_sample.exe
- name: Run pre test command
if: steps.skip_check.outputs.should_skip != 'true' && !(inputs.self-hosted-runner)
if: steps.skip_check.outputs.should_skip != 'true' && (inputs.self-hosted-runner != true)
id: run_pre_test_command
working-directory: ./${{env.BUILD_PLATFORM}}/${{env.BUILD_CONFIGURATION}}
run: |
${{env.PRE_COMMAND}}
- name: Run pre test command on self-hosted runner
if: steps.skip_check.outputs.should_skip != 'true' && (inputs.self-hosted-runner)
if: steps.skip_check.outputs.should_skip != 'true' && (inputs.self-hosted-runner == true)
id: run_pre_test_command_self_hosted
working-directory: ./${{env.BUILD_PLATFORM}}/${{env.BUILD_CONFIGURATION}}
run: |
Expand Down Expand Up @@ -297,14 +302,14 @@ jobs:
OpenCppCoverage.exe -q --sources %CD% --excluded_sources %CD%\external\Catch2 --export_type cobertura:ebpf_for_windows.xml --working_dir ${{env.BUILD_PLATFORM}}\${{env.BUILD_CONFIGURATION}} -- powershell .\Run-Test.ps1 ${{env.DUMP_PATH}} ${{env.TEST_TIMEOUT}} ${{env.TEST_COMMAND}}
- name: Run test on self-hosted runner
if: (inputs.code_coverage == false) && (steps.skip_check.outputs.should_skip != 'true') && (inputs.self-hosted-runner) && (inputs.fault_injection != true)
if: (inputs.code_coverage == false) && (steps.skip_check.outputs.should_skip != 'true') && (inputs.self-hosted-runner == true) && (inputs.fault_injection != true)
id: run_test_self_hosted
working-directory: ./${{env.BUILD_PLATFORM}}/${{env.BUILD_CONFIGURATION}}
run: |
${{env.TEST_COMMAND}} -LogFileName ${{ runner.name }}.log -SelfHostedRunnerName ${{ runner.name }}
- name: Run test without Code Coverage
if: (inputs.code_coverage == false) && (steps.skip_check.outputs.should_skip != 'true') && (inputs.self-hosted-runner) && (inputs.fault_injection != true)
if: (inputs.code_coverage == false) && (steps.skip_check.outputs.should_skip != 'true') && (inputs.self-hosted-runner == true) && (inputs.fault_injection != true)
id: run_test_without_code_coverage
working-directory: ./${{env.BUILD_PLATFORM}}/${{env.BUILD_CONFIGURATION}}
shell: cmd
Expand All @@ -314,15 +319,15 @@ jobs:
- name: Run post test command
# Run the post test command even if the workflow has failed.
if: (success() || failure()) && (steps.skip_check.outputs.should_skip != 'true') && (inputs.self-hosted-runner)
if: (success() || failure()) && (steps.skip_check.outputs.should_skip != 'true') && (inputs.self-hosted-runner == true)
id: run_post_test_command
working-directory: ./${{env.BUILD_PLATFORM}}/${{env.BUILD_CONFIGURATION}}
run: |
${{env.POST_COMMAND}}
- name: Run post test command on self-hosted runner
# Run the post test command even if the workflow has failed.
if: (success() || failure()) && (steps.skip_check.outputs.should_skip != 'true') && (inputs.self-hosted-runner)
if: (success() || failure()) && (steps.skip_check.outputs.should_skip != 'true') && (inputs.self-hosted-runner == true)
id: run_post_test_command_self_hosted
working-directory: ./${{env.BUILD_PLATFORM}}/${{env.BUILD_CONFIGURATION}}
run: |
Expand Down

0 comments on commit e467487

Please sign in to comment.