Skip to content

Commit 0752109

Browse files
committed
Add step to build for Alpine Linux using Static Linux SDK
1 parent 543a476 commit 0752109

1 file changed

Lines changed: 43 additions & 10 deletions

File tree

.github/workflows/ci.yml

Lines changed: 43 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -71,28 +71,61 @@ jobs:
7171
- name: Run tests
7272
run: swift test -v
7373

74-
test-alpine:
75-
name: Test (Alpine, Swift ${{ matrix.swift-version }})
74+
build-for-alpine:
75+
name: Build for Alpine (Ubuntu, Swift ${{ matrix.swift-version }})
7676
needs: setup
7777
strategy:
7878
matrix:
7979
swift-version: ${{ fromJson(needs.setup.outputs.swift-versions) }}
8080
runs-on: ubuntu-latest
81-
timeout-minutes: 5
82-
container: alpine:latest
8381
steps:
8482
- uses: actions/checkout@v4
8583

86-
- name: Install system dependencies
87-
run: apk add --no-cache bash curl jq gnupg
88-
8984
- name: Setup Swift
9085
uses: vapor/swiftly-action@v0.2
9186
with:
9287
toolchain: ${{ matrix.swift-version }}
9388

94-
- name: Build
95-
run: swift build -v
89+
- name: Install Static Linux SDK
90+
run: |
91+
# Install the static Linux SDK for musl target
92+
swift sdk install --swift-version $SWIFT_VERSION static-linux
9693
97-
- name: Run tests
94+
# Verify installation
95+
swift sdk list
96+
97+
- name: Build for x86_64-musl
98+
run: swift build --swift-sdk x86_64-swift-linux-musl -v
99+
100+
- name: Run tests (host)
98101
run: swift test -v
102+
103+
- name: Upload build artifacts
104+
uses: actions/upload-artifact@v3
105+
with:
106+
name: alpine-binaries-${{ matrix.swift-version }}
107+
path: .build/x86_64-swift-linux-musl/debug
108+
109+
test-alpine:
110+
name: Test (Alpine, Swift ${{ matrix.swift-version }})
111+
needs: [setup, build-for-alpine]
112+
strategy:
113+
matrix:
114+
swift-version: ${{ fromJson(needs.setup.outputs.swift-versions) }}
115+
runs-on: ubuntu-latest
116+
timeout-minutes: 5
117+
container: alpine:latest
118+
steps:
119+
- uses: actions/checkout@v4
120+
121+
- name: Download compiled binaries
122+
uses: actions/download-artifact@v3
123+
with:
124+
name: alpine-binaries-${{ matrix.swift-version }}
125+
path: .build/debug
126+
127+
- name: Set permissions
128+
run: chmod +x .build/debug/*
129+
130+
- name: Run tests
131+
run: .build/debug/MCPTests

0 commit comments

Comments
 (0)