Skip to content

Commit 3c07ac0

Browse files
Always use the current version of the scripts (Linux + Wasm) (#182)
* Always use the current version of the scripts (Linux + Wasm) This applies the changes previously made for Android to: - Linux - Linux Static SDK - Wasm SDK - Embedded Wasm SDK * Apply checkout fix for Amazon Linux 2 to the embedded wasm SDK build This was missed earlier.
1 parent 00b19f5 commit 3c07ac0

File tree

1 file changed

+93
-4
lines changed

1 file changed

+93
-4
lines changed

.github/workflows/swift_package_test.yml

Lines changed: 93 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -314,6 +314,27 @@ jobs:
314314
- name: Checkout repository
315315
uses: actions/checkout@v1
316316
if: ${{ matrix.os_version == 'amazonlinux2' }}
317+
- name: Checkout swiftlang/github-workflows repository
318+
if: ${{ matrix.os_version != 'amazonlinux2' && github.repository != 'swiftlang/github-workflows' }}
319+
uses: actions/checkout@v4
320+
with:
321+
repository: swiftlang/github-workflows
322+
path: github-workflows
323+
- name: Checkout swiftlang/github-workflows repository
324+
if: ${{ matrix.os_version == 'amazonlinux2' && github.repository != 'swiftlang/github-workflows' }}
325+
uses: actions/checkout@v1
326+
with:
327+
repository: swiftlang/github-workflows
328+
path: github-workflows
329+
ref: main
330+
- name: Determine script-root path
331+
id: script_path
332+
run: |
333+
if [ "${{ github.repository }}" = "swiftlang/github-workflows" ]; then
334+
echo "root=$GITHUB_WORKSPACE" >> $GITHUB_OUTPUT
335+
else
336+
echo "root=$GITHUB_WORKSPACE/github-workflows" >> $GITHUB_OUTPUT
337+
fi
317338
- name: Provide token
318339
if: ${{ inputs.needs_token }}
319340
run: |
@@ -322,7 +343,7 @@ jobs:
322343
if: ${{ inputs.enable_cross_pr_testing && github.event_name == 'pull_request' }}
323344
run: |
324345
apt-get update && apt-get install -y curl
325-
curl -s https://raw.githubusercontent.com/swiftlang/github-workflows/refs/heads/main/.github/workflows/scripts/cross-pr-checkout.swift > /tmp/cross-pr-checkout.swift
346+
cat ${{ steps.script_path.outputs.root }}/.github/workflows/scripts/cross-pr-checkout.swift > /tmp/cross-pr-checkout.swift
326347
swift /tmp/cross-pr-checkout.swift "${{ github.repository }}" "${{ github.event.number }}"
327348
- name: Set environment variables
328349
if: ${{ inputs.linux_env_vars }}
@@ -360,6 +381,27 @@ jobs:
360381
- name: Checkout repository
361382
uses: actions/checkout@v1
362383
if: ${{ matrix.os_version == 'amazonlinux2' }}
384+
- name: Checkout swiftlang/github-workflows repository
385+
if: ${{ matrix.os_version != 'amazonlinux2' && github.repository != 'swiftlang/github-workflows' }}
386+
uses: actions/checkout@v4
387+
with:
388+
repository: swiftlang/github-workflows
389+
path: github-workflows
390+
- name: Checkout swiftlang/github-workflows repository
391+
if: ${{ matrix.os_version == 'amazonlinux2' && github.repository != 'swiftlang/github-workflows' }}
392+
uses: actions/checkout@v1
393+
with:
394+
repository: swiftlang/github-workflows
395+
path: github-workflows
396+
ref: main
397+
- name: Determine script-root path
398+
id: script_path
399+
run: |
400+
if [ "${{ github.repository }}" = "swiftlang/github-workflows" ]; then
401+
echo "root=$GITHUB_WORKSPACE" >> $GITHUB_OUTPUT
402+
else
403+
echo "root=$GITHUB_WORKSPACE/github-workflows" >> $GITHUB_OUTPUT
404+
fi
363405
- name: Provide token
364406
if: ${{ inputs.needs_token }}
365407
run: |
@@ -390,7 +432,7 @@ jobs:
390432
echo "Unknown package manager (tried apt-get, dnf, yum)" >&2
391433
exit 1
392434
fi
393-
curl -s --retry 3 https://raw.githubusercontent.com/swiftlang/github-workflows/refs/heads/main/.github/workflows/scripts/install-and-build-with-sdk.sh | \
435+
cat ${{ steps.script_path.outputs.root }}/.github/workflows/scripts/install-and-build-with-sdk.sh | \
394436
bash -s -- --static --flags="$BUILD_FLAGS" --build-command="${{ inputs.linux_static_sdk_build_command }}" ${{ matrix.swift_version }}
395437
396438
wasm-sdk-build:
@@ -417,6 +459,27 @@ jobs:
417459
- name: Checkout repository
418460
uses: actions/checkout@v1
419461
if: ${{ matrix.os_version == 'amazonlinux2' }}
462+
- name: Checkout swiftlang/github-workflows repository
463+
if: ${{ matrix.os_version != 'amazonlinux2' && github.repository != 'swiftlang/github-workflows' }}
464+
uses: actions/checkout@v4
465+
with:
466+
repository: swiftlang/github-workflows
467+
path: github-workflows
468+
- name: Checkout swiftlang/github-workflows repository
469+
if: ${{ matrix.os_version == 'amazonlinux2' && github.repository != 'swiftlang/github-workflows' }}
470+
uses: actions/checkout@v1
471+
with:
472+
repository: swiftlang/github-workflows
473+
path: github-workflows
474+
ref: main
475+
- name: Determine script-root path
476+
id: script_path
477+
run: |
478+
if [ "${{ github.repository }}" = "swiftlang/github-workflows" ]; then
479+
echo "root=$GITHUB_WORKSPACE" >> $GITHUB_OUTPUT
480+
else
481+
echo "root=$GITHUB_WORKSPACE/github-workflows" >> $GITHUB_OUTPUT
482+
fi
420483
- name: Provide token
421484
if: ${{ inputs.needs_token }}
422485
run: |
@@ -447,7 +510,7 @@ jobs:
447510
echo "Unknown package manager (tried apt-get, dnf, yum)" >&2
448511
exit 1
449512
fi
450-
curl -s --retry 3 https://raw.githubusercontent.com/swiftlang/github-workflows/refs/heads/main/.github/workflows/scripts/install-and-build-with-sdk.sh | \
513+
cat ${{ steps.script_path.outputs.root }}/.github/workflows/scripts/install-and-build-with-sdk.sh | \
451514
bash -s -- --wasm --flags="$BUILD_FLAGS" --build-command="${{ inputs.wasm_sdk_build_command }}" ${{ matrix.swift_version }}
452515
453516
embedded-wasm-sdk-build:
@@ -470,6 +533,31 @@ jobs:
470533
run: clang --version
471534
- name: Checkout repository
472535
uses: actions/checkout@v4
536+
if: ${{ matrix.os_version != 'amazonlinux2' }}
537+
- name: Checkout repository
538+
uses: actions/checkout@v1
539+
if: ${{ matrix.os_version == 'amazonlinux2' }}
540+
- name: Checkout swiftlang/github-workflows repository
541+
if: ${{ matrix.os_version != 'amazonlinux2' && github.repository != 'swiftlang/github-workflows' }}
542+
uses: actions/checkout@v4
543+
with:
544+
repository: swiftlang/github-workflows
545+
path: github-workflows
546+
- name: Checkout swiftlang/github-workflows repository
547+
if: ${{ matrix.os_version == 'amazonlinux2' && github.repository != 'swiftlang/github-workflows' }}
548+
uses: actions/checkout@v1
549+
with:
550+
repository: swiftlang/github-workflows
551+
path: github-workflows
552+
ref: main
553+
- name: Determine script-root path
554+
id: script_path
555+
run: |
556+
if [ "${{ github.repository }}" = "swiftlang/github-workflows" ]; then
557+
echo "root=$GITHUB_WORKSPACE" >> $GITHUB_OUTPUT
558+
else
559+
echo "root=$GITHUB_WORKSPACE/github-workflows" >> $GITHUB_OUTPUT
560+
fi
473561
- name: Provide token
474562
if: ${{ inputs.needs_token }}
475563
run: |
@@ -500,7 +588,7 @@ jobs:
500588
echo "Unknown package manager (tried apt-get, dnf, yum)" >&2
501589
exit 1
502590
fi
503-
curl -s --retry 3 https://raw.githubusercontent.com/swiftlang/github-workflows/refs/heads/main/.github/workflows/scripts/install-and-build-with-sdk.sh | \
591+
cat ${{ steps.script_path.outputs.root }}/.github/workflows/scripts/install-and-build-with-sdk.sh | \
504592
bash -s -- --embedded-wasm --flags="$BUILD_FLAGS" ${{ matrix.swift_version }}
505593
506594
android-sdk-build:
@@ -540,6 +628,7 @@ jobs:
540628
with:
541629
repository: swiftlang/github-workflows
542630
path: github-workflows
631+
ref: main
543632
- name: Determine script-root path
544633
id: script_path
545634
run: |

0 commit comments

Comments
 (0)