Skip to content

Commit

Permalink
Split out jobs, use matrix, build sswg-incubated-packages only
Browse files Browse the repository at this point in the history
  • Loading branch information
xtremekforever committed Dec 22, 2024
1 parent 4d5463d commit 8bf573a
Show file tree
Hide file tree
Showing 5 changed files with 45 additions and 36 deletions.
6 changes: 6 additions & 0 deletions .github/actions/build-and-test-sdk/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,3 +27,9 @@ runs:
${{ inputs.swift-version }} \
${{ inputs.distribution-name }} \
${{ inputs.distribution-version }}
- uses: actions/upload-artifact@v4
name: Publish SDK
with:
name: ${{ inputs.swift-version }}-${{ inputs.distribution-name }}-${{ inputs.distribution-version }}-${{ inputs.target-arch }}
path: |
swift-sdk-generator/Bundles/*.artifactbundle.tar.gz
65 changes: 34 additions & 31 deletions .github/workflows/develop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,44 +10,47 @@ on:

env:
SWIFT_VERSION: 6.0.3
DISTRIBUTION_NAME: ubuntu
DISTRIBUTION_VERSION: jammy

jobs:
build-and-test:
name: Build & Test
build-sdk-generator:
name: Build SDK Generator
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
- uses: swift-actions/setup-swift@v2
- name: Swift Version
shell: bash
run: swift --version
- name: Build SDK Generator
shell: bash
run: ./build-generator.sh
- uses: actions/cache/save@v4
with:
key: swift-sdk-generator
path: swift-sdk-generator

build-sdks:
strategy:
matrix:
target-arch: ["x86_64", "aarch64", "armv7"]
name: Build & Test SDKs
runs-on: ubuntu-22.04
needs: [build-sdk-generator]
steps:
- uses: actions/checkout@v4
- uses: swift-actions/setup-swift@v2
- name: Swift Version
shell: bash
run: swift --version
- name: Build SDK Generator
shell: bash
run: ./build-generator.sh
- uses: ./.github/actions/build-and-test-sdk
name: Cross SDK for x86_64
- name: Restore SDK Generator
uses: actions/cache/restore@v4
with:
swift-version: ${{ env.SWIFT_VERSION }}
distribution-name: ubuntu
distribution-version: jammy
target-arch: x86_64
key: swift-sdk-generator
path: swift-sdk-generator
fail-on-cache-miss: true
- uses: ./.github/actions/build-and-test-sdk
name: Cross SDK for aarch64
name: Build, Test Publish
with:
swift-version: ${{ env.SWIFT_VERSION }}
distribution-name: ubuntu
distribution-version: jammy
target-arch: aarch64
- uses: ./.github/actions/build-and-test-sdk
name: Cross SDK for armv7
with:
swift-version: ${{ env.SWIFT_VERSION }}
distribution-name: ubuntu
distribution-version: jammy
target-arch: armv7
- uses: actions/upload-artifact@v4
name: Publish SDKs
with:
name: ${{ env.SWIFT_VERSION }}-generated-sdks
path: |
swift-sdk-generator/Bundles/*.artifactbundle.tar.gz
distribution-name: ${{ env.DISTRIBUTION_NAME }}
distribution-version: ${{ env.DISTRIBUTION_VERSION }}
target-arch: ${{ matrix.target-arch }}
5 changes: 1 addition & 4 deletions build-generator.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,5 @@ fi
# Build
swift build -c release

# Deploy
sudo cp .build/release/swift-sdk-generator /usr/local/bin

# Test
swift-sdk-generator --help
swift-sdk-generator/.build/release/swift-sdk-generator --help
4 changes: 3 additions & 1 deletion build-sdk.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ set -e

TARGET_ARCH=${TARGET_ARCH:=x86_64}

SDK_GENERATOR_PATH=./swift-sdk-generator/.build/release/swift-sdk-generator

SWIFT_VERSION=$1
SWIFT_VERSION=$(echo $SWIFT_VERSION | xargs)
if [ -z $SWIFT_VERSION ]; then
Expand Down Expand Up @@ -76,7 +78,7 @@ docker build \
.

echo "Building Swift ${SWIFT_VERSION} ${DISTRIBUTION_NAME}-${GENERATOR_DISTRIBUTION_VERSION} SDK for ${TARGET_ARCH}..."
swift-sdk-generator make-linux-sdk \
${SDK_GENERATOR_PATH} make-linux-sdk \
--swift-version ${SWIFT_VERSION}-RELEASE \
--with-docker \
--from-container-image ${IMAGE_TAG} \
Expand Down
1 change: 1 addition & 0 deletions test-sdk.sh
Original file line number Diff line number Diff line change
Expand Up @@ -42,5 +42,6 @@ docker run --rm \
${BUILDER_TAG} \
/bin/bash -c "swift build \
--package-path test-project \
--target sswg-incubated-packages \
--experimental-swift-sdks-path swift-sdk-generator/Bundles \
--experimental-swift-sdk ${SDK_NAME} ${EXTRA_FLAGS}"

0 comments on commit 8bf573a

Please sign in to comment.