Skip to content

Commit ecac3e3

Browse files
Always use the current version of the scripts (Windows) (#181)
This applies the changes previously made for Android to Windows
1 parent 3c07ac0 commit ecac3e3

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
@@ -683,6 +683,20 @@ jobs:
683683
steps:
684684
- name: Checkout repository
685685
uses: actions/checkout@v4
686+
- name: Checkout swiftlang/github-workflows repository
687+
if: ${{ github.repository != 'swiftlang/github-workflows' }}
688+
uses: actions/checkout@v4
689+
with:
690+
repository: swiftlang/github-workflows
691+
path: github-workflows
692+
- name: Determine script-root path
693+
id: script_path
694+
run: |
695+
if ("${{ github.repository }}" -eq "swiftlang/github-workflows") {
696+
echo "root=$env:GITHUB_WORKSPACE" >> $env:GITHUB_OUTPUT
697+
} else {
698+
echo "root=$env:GITHUB_WORKSPACE/github-workflows" >> $env:GITHUB_OUTPUT
699+
}
686700
- name: Provide token
687701
if: ${{ inputs.needs_token }}
688702
run: |
@@ -707,17 +721,10 @@ jobs:
707721
echo "image=$Image" >> "$env:GITHUB_OUTPUT"
708722
- name: Install Visual Studio Build Tools
709723
if: ${{ !inputs.enable_windows_docker }}
710-
run: |
711-
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
712-
. $env:TEMP\install-vsb.ps1
713-
del $env:TEMP\install-vsb.ps1
724+
run: . ${{ steps.script_path.outputs.root }}/.github/workflows/scripts/windows/install-vsb.ps1
714725
- name: Install Swift
715726
if: ${{ !inputs.enable_windows_docker }}
716-
run: |
717-
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
718-
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
719-
. $env:TEMP\install-swift-${{ matrix.swift_version }}.ps1
720-
del $env:TEMP\install-swift*.ps1
727+
run: . ${{ steps.script_path.outputs.root }}/.github/workflows/scripts/windows/swift/install-swift-${{ matrix.swift_version }}.ps1
721728
- name: Create test script
722729
run: |
723730
mkdir $env:TEMP\test-script
@@ -745,9 +752,8 @@ jobs:
745752
746753
if ("${{ inputs.enable_cross_pr_testing && github.event_name == 'pull_request' }}" -eq "true") {
747754
echo @'
748-
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
749755
# Running in script mode fails on Windows (https://github.com/swiftlang/swift/issues/77263), compile and run the script.
750-
Invoke-Program swiftc -sdk $env:SDKROOT $env:TEMP\cross-pr-checkout.swift -o $env:TEMP\cross-pr-checkout.exe
756+
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
751757
Invoke-Program $env:TEMP\cross-pr-checkout.exe "${{ github.repository }}" "${{ github.event.number }}"
752758
'@ >> $env:TEMP\test-script\run.ps1
753759
}

0 commit comments

Comments
 (0)