+46 #63
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: Upstream pretest | |
on: | |
push: | |
schedule: | |
- cron: '0 0 * * *' | |
workflow_dispatch: | |
permissions: | |
contents: write | |
jobs: | |
enmr-PRs: | |
runs-on: windows-latest | |
outputs: | |
exec_list: ${{ steps.make_exec_list.outputs.exec_list }} | |
remove_list: ${{ steps.make_exec_list.outputs.remove_list }} | |
steps: | |
- name: git config | |
run: | | |
git config --global core.autocrlf false | |
git config --global user.name "sun pack bot" | |
git config --global user.email "[email protected]" | |
git config --global --add url.https://github.com/.insteadOf "[email protected]:" | |
- name: checkout | |
uses: actions/checkout@main | |
with: | |
sparse-checkout-cone-mode: false | |
sparse-checkout: | | |
.gitmodules | |
- name: make exec list | |
id: make_exec_list | |
run: | | |
$exec_list = @() | |
$remove_list = @() | |
foreach ($subm_key in git config --file .gitmodules --name-only --get-regexp '^submodule\..+\.url$') { | |
$subm_url = git config --file .gitmodules --get $subm_key | |
Write-Host "URL: $subm_url" | |
if ($subm_url -notmatch '^git@github\.com:([\w\-]+)/([\w\-]+)\.git$') { | |
throw "Unexpected subm_url format: $subm_url" | |
} | |
$subm_owner = $Matches[1] | |
$subm_name = $Matches[2] | |
$subm_merge_pr_nums = @() | |
foreach ($ref_l in git ls-remote $subm_url 'refs/pull/*/merge') { | |
if ($ref_l -notmatch '^[0-9a-f]+\s+refs/pull/(\d+)/merge$') { | |
throw "Unexpected merge ref format: $ref_l" | |
} | |
$pr_num = $Matches[1] | |
Write-Host "- Found PR $pr_num" | |
$subm_merge_pr_nums += $pr_num | |
$exec_list += @{ | |
'subm_url' = $subm_url; | |
'pr_num' = $pr_num; | |
} | |
} | |
if ($subm_owner -ne 'KhronosGroup') { | |
throw 'Unexpected original owner of submodule: $subm_owner' | |
} | |
$subm_fork_url = "[email protected]:SunSerega/${subm_name}.git" | |
if ($subm_fork_url -eq $subm_url) { | |
throw "Fork url [$subm_fork_url] = subm_url [$subm_url]" | |
} | |
$subm_pretest_pr_nums = @() | |
foreach ($ref_l in git ls-remote $subm_fork_url 'refs/heads/pretest/*') { | |
if ($ref_l -notmatch '^[0-9a-f]+\s+refs/heads/pretest/(.+)$') { | |
throw "Unexpected subm pretest ref format: $ref_l" | |
} | |
$pr_num = $Matches[1] | |
Write-Host "- Found subm pretest branch for PR $pr_num" | |
if ($subm_merge_pr_nums -contains $pr_num) { continue } | |
$subm_pretest_pr_nums += $pr_num | |
} | |
$core_pretest_pr_nums = @() | |
foreach ($ref_l in git ls-remote origin "refs/heads/subm_pretest/$subm_owner/$subm_name/*") { | |
if ($ref_l -notmatch "^[0-9a-f]+\s+refs/heads/subm_pretest/$subm_owner/$subm_name/(.+)$") { | |
throw "Unexpected core pretest ref format: $ref_l" | |
} | |
$pr_num = $Matches[1] | |
Write-Host "- Found core pretest branch for PR $pr_num" | |
if ($subm_merge_pr_nums -contains $pr_num) { continue } | |
$core_pretest_pr_nums += $pr_num | |
} | |
if ($subm_pretest_pr_nums -or $core_pretest_pr_nums) { | |
$remove_list += @{ | |
'repo' = "SunSerega/$subm_name"; | |
'subm_pretest_pr_nums' = $subm_pretest_pr_nums -join ','; | |
'core_pretest_pr_nums' = $core_pretest_pr_nums -join ','; | |
} | |
} | |
} | |
$json = ConvertTo-Json -Compress $exec_list | |
Write-Host $json | |
echo "exec_list=$json" >> $env:GITHUB_OUTPUT | |
$json = ConvertTo-Json -Compress $remove_list | |
Write-Host $json | |
echo "remove_list=$json" >> $env:GITHUB_OUTPUT | |
pretest-each: | |
runs-on: windows-latest | |
needs: enmr-PRs | |
strategy: | |
fail-fast: false | |
matrix: ${{ fromJson(needs.enmr-PRs.outputs.exec_list) }} | |
steps: | |
- name: git config | |
run: | | |
git config --global core.autocrlf false | |
git config --global user.name "sun pack bot" | |
git config --global user.email "[email protected]" | |
# git config --global --add url.https://github.com/.insteadOf "[email protected]:" | |
- name: checkout | |
uses: actions/checkout@main | |
# - name: checkout fork | |
# uses: actions/checkout@main | |
# with: | |
# repository: 'SunSerega/OpenCL-Docs' | |
# path: './fork' | |
# token: ${{ secrets.POCGL_pretest_upstream_PAT }} | |
# sparse-checkout: '<NOTHING>' | |
- name: pretest | |
run: | | |
$subm_url = "${{ matrix.subm_url }}" | |
$pr_num = "${{ matrix.pr_num }}" | |
Write-Host "Testing PR $pr_num from: $subm_url" | |
# aaaaa | |
remove-old-pretest: | |
runs-on: windows-latest | |
needs: enmr-PRs | |
strategy: | |
fail-fast: false | |
matrix: ${{ fromJson(needs.enmr-PRs.outputs.remove_list) }} | |
steps: | |
- name: write matrix info | |
run: | | |
Write-Host "repo: ${{ matrix.repo }}" | |
Write-Host "subm_pretest_pr_nums: ${{ matrix.subm_pretest_pr_nums }}" | |
Write-Host "core_pretest_pr_nums: ${{ matrix.core_pretest_pr_nums }}" | |
- name: checkout fork | |
uses: actions/checkout@main | |
with: | |
repository: ${{ matrix.repo }} | |
token: ${{ secrets.POCGL_pretest_upstream_PAT }} | |
sparse-checkout-cone-mode: false | |
sparse-checkout: '<NOTHING>' | |
- name: remove old pretest branches | |
run: | | |
# aaaaa | |