Skip to content

Commit c7ab05e

Browse files
committed
Update action workflow tests
1 parent 474c4c9 commit c7ab05e

File tree

2 files changed

+17
-8
lines changed

2 files changed

+17
-8
lines changed

.github/workflows/test-action.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ jobs:
1010
strategy:
1111
fail-fast: false
1212
matrix:
13-
os: ['ubuntu-24.04', 'ubuntu-22.04', 'ubuntu-20.04', 'macos-13', 'macos-15']
14-
swift-version: ['6.0.3', '6.0.2']
13+
os: ['ubuntu-24.04', 'ubuntu-22.04', 'macos-13', 'macos-15']
14+
swift-version: ['6.0.3', '6.1-DEVELOPMENT-SNAPSHOT-2025-03-07-a']
1515
steps:
1616
- name: Checkout Action
1717
uses: actions/checkout@v4

action.yml

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -128,12 +128,6 @@ runs:
128128
129129
echo "swift-version=${SWIFT_VERSION}" >> $GITHUB_OUTPUT
130130
131-
if [ "${{ inputs.swift-branch }}" == '' ]; then
132-
echo "swift-branch=swift-${SWIFT_VERSION}-release" >> $GITHUB_OUTPUT
133-
else
134-
echo "swift-branch=${{ inputs.swift-branch }}" >> $GITHUB_OUTPUT
135-
fi
136-
137131
# the swift-id is the basename of the host toolchain download
138132
SWIFT_VERSION_ID="swift-${SWIFT_VERSION}"
139133
if [[ ${SWIFT_VERSION} != *-* ]]; then
@@ -142,6 +136,21 @@ runs:
142136
fi
143137
echo "swift-id=${SWIFT_VERSION_ID}" >> $GITHUB_OUTPUT
144138
139+
SWIFT_BRANCH="${{ inputs.swift-branch }}"
140+
if [ "${SWIFT_BRANCH}" == '' ]; then
141+
# guess the branch based on the specified Swift version
142+
if [[ "${SWIFT_VERSION_ID}" == *-RELEASE ]]; then
143+
SWIFT_BRANCH="swift-${SWIFT_VERSION}-release""
144+
elif [[ "${SWIFT_VERSION_ID}" == swift-DEVELOPMENT-* ]]; then
145+
SWIFT_BRANCH="development"
146+
else
147+
# convert "6.1-DEVELOPMENT-SNAPSHOT-2025-03-07-a" into "swift-6.1-branch"
148+
BASE_VERSION=$(echo "${SWIFT_VERSION}" | tr '-' '\n' | head -n 1)
149+
SWIFT_BRANCH="swift-${BASE_VERSION}-branch"
150+
fi
151+
fi
152+
echo "swift-branch=${SWIFT_BRANCH}" >> $GITHUB_OUTPUT
153+
145154
- name: Cache Swift ${{ steps.setup.outputs.swift-version }} Host Toolchain
146155
uses: actions/cache@v4
147156
id: cache-swift

0 commit comments

Comments
 (0)