@@ -11,30 +11,74 @@ permissions:
1111 pull-requests : write
1212
1313jobs :
14- test :
14+ setup :
15+ runs-on : ubuntu-latest
16+ outputs :
17+ swift-versions : ${{ steps.set-matrix.outputs.swift-versions }}
18+ env :
19+ # Define Swift versions - add new versions here
20+ SWIFT_VERSIONS : |
21+ 6.0.3
22+ 6.1.0
23+ steps :
24+ - id : set-matrix
25+ run : |
26+ # Convert multi-line string to JSON array (jq is pre-installed on GitHub runners)
27+ VERSIONS=$(echo "$SWIFT_VERSIONS" | jq -R -s -c 'split("\n") | map(select(length > 0))')
28+ echo "swift-versions=$VERSIONS" >> $GITHUB_OUTPUT
29+
30+ test-macos :
31+ needs : setup
1532 strategy :
1633 matrix :
17- os : [macos-latest, ubuntu-latest]
18- swift-version :
19- - 6.0.3
20- - 6.1.0
34+ swift-version : ${{ fromJson(needs.setup.outputs.swift-versions) }}
35+ runs-on : macos-latest
36+ name : Test (macOS, Swift ${{ matrix.swift-version }})
37+ steps :
38+ - uses : actions/checkout@v4
2139
22- runs-on : ${{ matrix.os }}
23- name : Test (${{ matrix.os }}, Swift ${{ matrix.swift-version }})
40+ - name : Setup Swift
41+ uses : swift-actions/setup-swift@v2
42+ with :
43+ swift-version : ${{ matrix.swift-version }}
2444
45+ - name : Build
46+ run : swift build -v
47+
48+ - name : Run tests
49+ run : swift test -v
50+
51+ test-ubuntu :
52+ needs : setup
53+ strategy :
54+ matrix :
55+ swift-version : ${{ fromJson(needs.setup.outputs.swift-versions) }}
56+ runs-on : ubuntu-latest
57+ name : Test (Ubuntu, Swift ${{ matrix.swift-version }})
2558 steps :
2659 - uses : actions/checkout@v4
2760
28- - name : Setup Swift on Linux
29- if : matrix.os == 'ubuntu-latest'
61+ - name : Setup Swift
30623163 with :
3264 toolchain : ${{ matrix.swift-version }}
33- - name : Setup Swift on macOS
34- if : matrix.os == 'macos-latest'
35- uses : swift-actions/setup-swift@v2
36- with :
37- swift-version : ${{ matrix.swift-version }}
65+
66+ - name : Build
67+ run : swift build -v
68+
69+ - name : Run tests
70+ run : swift test -v
71+
72+ test-alpine :
73+ needs : setup
74+ strategy :
75+ matrix :
76+ swift-version : ${{ fromJson(needs.setup.outputs.swift-versions) }}
77+ runs-on : ubuntu-latest
78+ container : swift:${{ matrix.swift-version }}-alpine
79+ name : Test (Alpine, Swift ${{ matrix.swift-version }})
80+ steps :
81+ - uses : actions/checkout@v4
3882
3983 - name : Build
4084 run : swift build -v
0 commit comments