Skip to content

Commit

Permalink
Build only latest Swift from push CI
Browse files Browse the repository at this point in the history
 - Also build container instead of using pre-built builder, to make the CI more flexible.
  • Loading branch information
xtremekforever committed Dec 23, 2024
1 parent 7abcf98 commit c8da321
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 78 deletions.
39 changes: 39 additions & 0 deletions .github/workflows/build-swift-latest.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: Build Swift Latest

on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]

env:
DISTRIBUTION: debian-bookworm

jobs:
build-latest:
strategy:
matrix:
version: ["6.0.3"]
env:
SWIFT_VERSION: ${{ matrix.version }}
SWIFT_TAG: swift-${{ matrix.version }}-RELEASE
name: Build Swift
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/checkout-swift
name: Fetch Swift Sources
with:
swift-tag: ${{ env.SWIFT_TAG }}
swift-workspace-cache: swift-${{ matrix.version }}-workspace
- name: Generate Builder Container
shell: bash
run: |
source ./swift-builder/swift-builder-common
./swift-builder/build-container.sh
- uses: ./.github/actions/build-for-distribution
name: Build & Publish Swift
with:
swift-tag: ${{ env.SWIFT_TAG }}
distribution: ${{ env.DISTRIBUTION }}
builder-tag: ${{ env.SWIFT_VERSION }}
74 changes: 0 additions & 74 deletions .github/workflows/build-swift-versions.yml

This file was deleted.

8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,14 +73,14 @@ After building the armv7 runtime using the `build.sh` script, you can generate a
using the `build-linux-cross-sdk.sh` script. You must provide the swift tag and distribution name:

```bash
./build-linux-cross-sdk.sh swift-5.10.1-RELEASE ubuntu-noble
./build-linux-cross-sdk.sh swift-6.0.3-RELEASE ubuntu-noble
```

By default, the SDK will be generated to be installed at a path of /opt/$SWIFT_TAG-$DISTRIBUTION-armv7, but this can be customized by providing a different install prefix to the script:

```bash
export SDK_INSTALL_PREFIX=/home/myuser/swift-sdks
./build-linux-cross-sdk.sh swift-5.10.1-RELEASE ubuntu-noble
./build-linux-cross-sdk.sh swift-6.0.3-RELEASE ubuntu-noble
```

## Continuous Integration & Releases
Expand All @@ -97,11 +97,11 @@ To use the SDK that is generated by the CI or published to the [Releases](https:
extract it to /opt:

```bash
sudo tar -xf swift-5.10.1-RELEASE-debian-bookworm-armv7-sdk.tar.gz -C /opt
sudo tar -xf swift-6.0.3-RELEASE-debian-bookworm-armv7-sdk.tar.gz -C /opt
```

Then, from a Swift package, use the `--destination` paramter to cross-compile it for the target:

```bash
swift build --destination /opt/swift-5.10.1-RELEASE-debian-bookworm-armv7/debian-bookworm.json
swift build --destination /opt/swift-6.0.3-RELEASE-debian-bookworm-armv7/debian-bookworm.json
```

0 comments on commit c8da321

Please sign in to comment.