Skip to content

Commit

Permalink
Configuration - Refactor workflow to use PowerShell for fetching late…
Browse files Browse the repository at this point in the history
…st run ID and update artifact paths
  • Loading branch information
dpasukhi committed Oct 26, 2024
1 parent 4ddac24 commit f1dad4b
Showing 1 changed file with 26 additions and 20 deletions.
46 changes: 26 additions & 20 deletions .github/workflows/build-and-test-multiplatform.yml
Original file line number Diff line number Diff line change
Expand Up @@ -420,14 +420,13 @@ jobs:
- name: Get latest workflow run ID from target branch
id: get_run_id
run: |
workflow_name="Build and Test OCCT on Multiple Platforms"
target_branch="${{ github.event.pull_request.base.ref }}"
echo "Fetching latest run ID for workflow: $workflow_name on branch: $target_branch"
response=$(curl -s \
-H "Accept: application/vnd.github.v3+json" \
"https://api.github.com/repos/${{ github.repository }}/actions/runs?branch=$target_branch&status=success&event=pull_request")
latest_run_id=$(echo "$response" | jq -r --arg workflow_name "$workflow_name" '.workflow_runs[] | select(.name==$workflow_name) | .id' | head -n 1)
echo "latest_run_id=$latest_run_id" >> $GITHUB_ENV
$workflow_name = "Build and Test OCCT on Multiple Platforms"
$target_branch = "${{ github.event.pull_request.base.ref }}"
Write-Host "Fetching latest run ID for workflow: $workflow_name on branch: $target_branch"
$response = Invoke-RestMethod -Uri "https://api.github.com/repos/${{ github.repository }}/actions/runs?branch=$target_branch&status=success&event=pull_request" -Headers @{Accept = "application/vnd.github.v3+json"}
$latest_run_id = ($response.workflow_runs | Where-Object { $_.name -eq $workflow_name } | Select-Object -First 1).id
Write-Host "latest_run_id=$latest_run_id" | Out-File -FilePath $env:GITHUB_ENV -Append
shell: pwsh

- name: Download test results from target branch
uses: actions/[email protected]
Expand Down Expand Up @@ -519,14 +518,13 @@ jobs:
- name: Get latest workflow run ID from target branch
id: get_run_id
run: |
workflow_name="Build and Test OCCT on Multiple Platforms"
target_branch="${{ github.event.pull_request.base.ref }}"
echo "Fetching latest run ID for workflow: $workflow_name on branch: $target_branch"
response=$(curl -s \
-H "Accept: application/vnd.github.v3+json" \
"https://api.github.com/repos/${{ github.repository }}/actions/runs?branch=$target_branch&status=success&event=pull_request")
latest_run_id=$(echo "$response" | jq -r --arg workflow_name "$workflow_name" '.workflow_runs[] | select(.name==$workflow_name) | .id' | head -n 1)
echo "latest_run_id=$latest_run_id" >> $GITHUB_ENV
$workflow_name = "Build and Test OCCT on Multiple Platforms"
$target_branch = "${{ github.event.pull_request.base.ref }}"
Write-Host "Fetching latest run ID for workflow: $workflow_name on branch: $target_branch"
$response = Invoke-RestMethod -Uri "https://api.github.com/repos/${{ github.repository }}/actions/runs?branch=$target_branch&status=success&event=pull_request" -Headers @{Accept = "application/vnd.github.v3+json"}
$latest_run_id = ($response.workflow_runs | Where-Object { $_.name -eq $workflow_name } | Select-Object -First 1).id
Write-Host "latest_run_id=$latest_run_id" | Out-File -FilePath $env:GITHUB_ENV -Append
shell: pwsh

- name: Download test results from target branch
uses: actions/[email protected]
Expand Down Expand Up @@ -632,13 +630,15 @@ jobs:
uses: actions/[email protected]
with:
name: results-macos-x64
path: install
path: install/bin
github-token: ${{ secrets.GITHUB_TOKEN }}
run-id: ${{ env.latest_run_id }}

- name: Compare test results
run: |
cd install
cd bin
source env.sh
for dir in results/*; do export RESULTS_SUBFOLDER=$dir; done
for dir in results-macos-x64/*; do export RESULTS_MACOS_SUBFOLDER=$dir; done
./DRAWEXE -v -c testdiff $RESULTS_SUBFOLDER $RESULTS_MACOS_SUBFOLDER
Expand Down Expand Up @@ -732,13 +732,15 @@ jobs:
uses: actions/[email protected]
with:
name: results-macos-gcc-x64
path: install
path: install/bin
github-token: ${{ secrets.GITHUB_TOKEN }}
run-id: ${{ env.latest_run_id }}

- name: Compare test results
run: |
cd install
cd bin
source env.sh
for dir in results/*; do export RESULTS_SUBFOLDER=$dir; done
for dir in results-macos-gcc-x64/*; do export RESULTS_MACOS_GCC_SUBFOLDER=$dir; done
./DRAWEXE -v -c testdiff $RESULTS_SUBFOLDER $RESULTS_MACOS_GCC_SUBFOLDER
Expand Down Expand Up @@ -841,13 +843,15 @@ jobs:
uses: actions/[email protected]
with:
name: results-linux-clang-x64
path: install
path: install/bin
github-token: ${{ secrets.GITHUB_TOKEN }}
run-id: ${{ env.latest_run_id }}

- name: Compare test results
run: |
cd install
cd bin
source env.sh
for dir in results/*; do export RESULTS_SUBFOLDER=$dir; done
for dir in results-linux-clang-x64/*; do export RESULTS_LINUX_CLANG_SUBFOLDER=$dir; done
./DRAWEXE -v -c testdiff $RESULTS_SUBFOLDER $RESULTS_LINUX_CLANG_SUBFOLDER
Expand Down Expand Up @@ -950,13 +954,15 @@ jobs:
uses: actions/[email protected]
with:
name: results-linux-gcc-x64
path: install
path: install/bin
github-token: ${{ secrets.GITHUB_TOKEN }}
run-id: ${{ env.latest_run_id }}

- name: Compare test results
run: |
cd install
cd bin
source env.sh
for dir in results/*; do export RESULTS_SUBFOLDER=$dir; done
for dir in results-linux-gcc-x64/*; do export RESULTS_LINUX_GCC_SUBFOLDER=$dir; done
./DRAWEXE -v -c testdiff $RESULTS_SUBFOLDER $RESULTS_LINUX_GCC_SUBFOLDER
Expand Down

0 comments on commit f1dad4b

Please sign in to comment.