Skip to content

Commit 7f1738e

Browse files
committed
WIP: Always use the current version of the scripts (Windows)
This applies the changes previously made for Android to Windows
1 parent 457d77c commit 7f1738e

File tree

1 file changed

+17
-11
lines changed

1 file changed

+17
-11
lines changed

.github/workflows/swift_package_test.yml

Lines changed: 17 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -575,6 +575,20 @@ jobs:
575575
steps:
576576
- name: Checkout repository
577577
uses: actions/checkout@v4
578+
- name: Checkout swiftlang/github-workflows repository
579+
if: ${{ github.repository != 'swiftlang/github-workflows' }}
580+
uses: actions/checkout@v4
581+
with:
582+
repository: swiftlang/github-workflows
583+
path: github-workflows
584+
- name: Determine script-root path
585+
id: script_path
586+
run: |
587+
if ("${{ github.repository }}" -eq "swiftlang/github-workflows") {
588+
echo "root=$env:GITHUB_WORKSPACE" >> $env:GITHUB_OUTPUT
589+
} else {
590+
echo "root=$env:GITHUB_WORKSPACE/github-workflows" >> $env:GITHUB_OUTPUT
591+
}
578592
- name: Provide token
579593
if: ${{ inputs.needs_token }}
580594
run: |
@@ -599,17 +613,10 @@ jobs:
599613
echo "image=$Image" >> "$env:GITHUB_OUTPUT"
600614
- name: Install Visual Studio Build Tools
601615
if: ${{ !inputs.enable_windows_docker }}
602-
run: |
603-
Invoke-WebRequest -Uri https://raw.githubusercontent.com/swiftlang/github-workflows/refs/heads/main/.github/workflows/scripts/windows/install-vsb.ps1 -OutFile $env:TEMP\install-vsb.ps1
604-
. $env:TEMP\install-vsb.ps1
605-
del $env:TEMP\install-vsb.ps1
616+
run: . ${{ steps.script_path.outputs.root }}/.github/workflows/scripts/windows/install-vsb.ps1
606617
- name: Install Swift
607618
if: ${{ !inputs.enable_windows_docker }}
608-
run: |
609-
Invoke-WebRequest -Uri https://raw.githubusercontent.com/swiftlang/github-workflows/refs/heads/main/.github/workflows/scripts/windows/swift/install-swift.ps1 -OutFile $env:TEMP\install-swift.ps1
610-
Invoke-WebRequest -Uri https://raw.githubusercontent.com/swiftlang/github-workflows/refs/heads/main/.github/workflows/scripts/windows/swift/install-swift-${{ matrix.swift_version }}.ps1 -OutFile $env:TEMP\install-swift-${{ matrix.swift_version }}.ps1
611-
. $env:TEMP\install-swift-${{ matrix.swift_version }}.ps1
612-
del $env:TEMP\install-swift*.ps1
619+
run: . ${{ steps.script_path.outputs.root }}/.github/workflows/scripts/windows/swift/install-swift-${{ matrix.swift_version }}.ps1
613620
- name: Create test script
614621
run: |
615622
mkdir $env:TEMP\test-script
@@ -637,9 +644,8 @@ jobs:
637644
638645
if ("${{ inputs.enable_cross_pr_testing && github.event_name == 'pull_request' }}" -eq "true") {
639646
echo @'
640-
Invoke-WebRequest https://raw.githubusercontent.com/swiftlang/github-workflows/refs/heads/main/.github/workflows/scripts/cross-pr-checkout.swift -OutFile $env:TEMP\cross-pr-checkout.swift
641647
# Running in script mode fails on Windows (https://github.com/swiftlang/swift/issues/77263), compile and run the script.
642-
Invoke-Program swiftc -sdk $env:SDKROOT $env:TEMP\cross-pr-checkout.swift -o $env:TEMP\cross-pr-checkout.exe
648+
Invoke-Program swiftc -sdk $env:SDKROOT ${{ steps.script_path.outputs.root }}/.github/workflows/scripts/cross-pr-checkout.swift -o $env:TEMP\cross-pr-checkout.exe
643649
Invoke-Program $env:TEMP\cross-pr-checkout.exe "${{ github.repository }}" "${{ github.event.number }}"
644650
'@ >> $env:TEMP\test-script\run.ps1
645651
}

0 commit comments

Comments
 (0)