-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
+44 - refactor again, try new matrix setup
- Loading branch information
Showing
1 changed file
with
94 additions
and
133 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,6 +14,7 @@ jobs: | |
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 | ||
|
@@ -24,106 +25,6 @@ jobs: | |
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: | ||
repository: 'SunSerega/OpenCL-Docs' | ||
path: './fork' | ||
token: ${{ secrets.POCGL_pretest_upstream_PAT }} | ||
|
||
- name: delete pretest ref | ||
run: | | ||
# $fork_dir = './fork' | ||
# $subm_fork_url = '[email protected]:KhronosGroup/OpenCL-Docs.git' | ||
# New-Item -ItemType Directory -Path $fork_dir | Out-Null | ||
# Push-Location $fork_dir | ||
# git init --bare | ||
# git remote add fork $subm_fork_url | ||
# git push fork --delete "pretest/123" | ||
Push-Location './fork' | ||
git push origin --delete "pretest/123" | ||
throw 'temp exit' | ||
# Get-Service ssh-agent | ||
# Get-Service ssh-agent | Select StartType | ||
# where.exe start-ssh-agent | ||
# start-ssh-agent | ||
# Write-Host "ssh:" | ||
# where.exe ssh | ||
# Write-Host "ssh-add:" | ||
# where.exe ssh-add | ||
# Write-Host '-----' | ||
Get-Service -Name ssh-agent | Set-Service -StartupType Manual | ||
Start-Service -Name ssh-agent | ||
git config --global core.sshCommand "'C:\\Windows\\System32\\OpenSSH\\ssh.exe'" | ||
# Set Key File Variable: | ||
New-Variable -Name Key -Value "$env:UserProfile\.ssh\id_rsa" | ||
$ssh_key = '${{ secrets.SSH_KEY }}' | ||
New-Item -ItemType Directory -Path (Split-Path $Key) | Out-Null | ||
$ssh_key | Set-Content $Key | ||
# Remove Inheritance: | ||
Icacls $Key /c /t /Inheritance:d | ||
# Set Ownership to Owner: | ||
# Key's within $env:UserProfile: | ||
Icacls $Key /c /t /Grant ${env:UserName}:F | ||
# Key's outside of $env:UserProfile: | ||
TakeOwn /F $Key | ||
Icacls $Key /c /t /Grant:r ${env:UserName}:F | ||
# Remove All Users, except for Owner: | ||
Icacls $Key /c /t /Remove:g Administrator "Authenticated Users" BUILTIN\Administrators BUILTIN Everyone System Users | ||
# Verify: | ||
Icacls $Key | ||
Write-Host "Adding key ${Key}:" | ||
# Test-Path "$env:UserProfile\.ssh\config" | ||
# Test-Path "C:\ProgramData\ssh\config" | ||
# Write-Host '~~~~~' | ||
# Get-ChildItem "$env:UserProfile\.ssh" | ||
# Write-Host '~~~~~' | ||
# Get-ChildItem "C:\ProgramData\ssh" | ||
# Write-Host '~~~~~' | ||
ssh-add $Key | ||
# Test-Path "$env:UserProfile\.ssh\config" | ||
# Test-Path "C:\ProgramData\ssh\config" | ||
# Write-Host '~~~~~' | ||
# Get-ChildItem "$env:UserProfile\.ssh" | ||
# Write-Host '~~~~~' | ||
# Get-ChildItem "C:\ProgramData\ssh | ||
# Write-Host '~~~~~' | ||
Set-Content -Path "$env:USERPROFILE\.ssh\config" -Value @" | ||
Host * | ||
IdentityFile ${Key} | ||
"@ | ||
Get-Content -Path "$env:USERPROFILE\.ssh\config" | ||
Set-Content -Path "$env:USERPROFILE\.ssh\allowed signers.dat" -Value @" | ||
[email protected] ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQDgO+2FgQHigb83TLVnjkHkwDVDKoOZPm2YlNl2ncZYkJjCWAK2+UV8uRsPwQwog0gWF4s37jRRj+Yzmt6bIjJl5xi9qqaM6A5zMV5ITfP8w8N5eQJAUbz5wQu5FzLzCLFCpXtG7234XHWKtD1nSsNEHXRa31unwuP3B15kumWdMZUxslNQpdffUmmIC5USQ0auL435P7UNEPDdP3H1JNb5v6m1xjTPWbSwpOMOFjdrekaWByYm9N+z0NlMgXON5nzXTqw/mY5mPdOu98CpKPrsqt9ktZTRmAqe4irYwbTf7EDvyPhj9qjhiYAw0GLR3S/NqwX7r5CfSTAwApfrLrKKuQPh5C9sbrZBeRIyM2k5XfF7g6PHYf8y1bWKALdPzmlytza3ZRjAsDZ1i6CUpjOWBxK2csqR400yk9lwn2I0NYmsR0V6sd3WHa1HGHcSj0jmq1nAVhDnF63ACV15Y3oNk02g6e6N2/gSVDpiDLt+pM34iRtX9AOJFOsgHGr5EzM= [email protected] | ||
"@ | ||
ssh -vvv -T [email protected] | ||
# Remove Variable: | ||
Remove-Variable -Name Key | ||
# - uses: webfactory/[email protected] | ||
# with: | ||
# ssh-private-key: ${{ secrets.SSH_KEY }} | ||
|
||
- name: checkout | ||
uses: actions/checkout@main | ||
with: | ||
|
@@ -136,62 +37,90 @@ jobs: | |
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" | ||
git ls-remote $subm_url | ||
$pr_nums = @() | ||
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 format: $ref_l" | ||
throw "Unexpected merge ref format: $ref_l" | ||
} | ||
$pr_num = $Matches[1] | ||
Write-Host "- Found PR $pr_num" | ||
$pr_nums += $pr_num | ||
$exec_list += "$pr_num;$subm_url" | ||
$subm_merge_pr_nums += $pr_num | ||
$exec_list += @{ | ||
'subm_url' = $subm_url; | ||
'pr_num' = $pr_num; | ||
} | ||
} | ||
$subm_fork_url = $subm_url -replace 'KhronosGroup','SunSerega' | ||
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 "Cannot form fork URL from: $subm_url" | ||
throw "Fork url [$subm_fork_url] = subm_url [$subm_url]" | ||
} | ||
$fork_dir = './fork' | ||
New-Item -ItemType Directory -Path $fork_dir | Out-Null | ||
Push-Location $fork_dir | ||
git init --bare | ||
git remote add fork $subm_fork_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 format: $ref_l" | ||
throw "Unexpected subm pretest ref format: $ref_l" | ||
} | ||
$pr_num = $Matches[1] | ||
Write-Host "- Found pretest branch for PR $pr_num" | ||
if ($pr_nums -contains $pr_num) { continue } | ||
Write-Host "pretest branch for PR $pr_num is no longer needed" | ||
git push fork --delete "pretest/$pr_num" | ||
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; | ||
'core_pretest_pr_nums' = $core_pretest_pr_nums; | ||
} | ||
} | ||
Pop-Location | ||
Remove-Item -Recurse $fork_dir | ||
} | ||
$json = $exec_list | ConvertTo-Json -Compress | ||
# Write-Host $json | ||
$json = $exec_list | ConvertTo-Json -Compress -AsArray | ||
Write-Host $json | ||
echo "exec_list=$json" >> $env:GITHUB_OUTPUT | ||
$json = $remove_list | ConvertTo-Json -Compress -AsArray | ||
Write-Host $json | ||
echo "remove_list=$json" >> $env:GITHUB_OUTPUT | ||
pretest-each: | ||
runs-on: windows-latest | ||
needs: enmr-PRs | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
exec_node: ${{ fromJson(needs.enmr-PRs.outputs.exec_list) }} | ||
matrix: ${{ fromJson(needs.enmr-PRs.outputs.exec_list) }} | ||
|
||
steps: | ||
- name: git config | ||
|
@@ -202,20 +131,52 @@ jobs: | |
git config --global user.email "[email protected]" | ||
# git config --global --add url.https://github.com/.insteadOf "[email protected]:" | ||
- uses: webfactory/[email protected] | ||
with: | ||
ssh-private-key: ${{ secrets.SSH_KEY }} | ||
|
||
- 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: | | ||
$exec_node = "${{ matrix.exec_node }}" | ||
$pr_num, $subm_url = $exec_node -split ';', 2 | ||
$subm_url = "${{ matrix.subm_url }}" | ||
$pr_num = "${{ matrix.pr_num }}" | ||
# Write-Host "Testing PR $pr_num from: $subm_url" | ||
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 | ||