diff --git a/.github/actions/build-for-distribution/action.yml b/.github/actions/build-for-distribution/action.yml index 13d1c0e..4dcf4ea 100644 --- a/.github/actions/build-for-distribution/action.yml +++ b/.github/actions/build-for-distribution/action.yml @@ -1,9 +1,12 @@ -name: Build Swift for a given armv7 distribution +name: Build Swift for a given distribution description: This wraps all the functionality of other actions to build Swift for a given distribution inputs: swift-tag: description: The Swift tag version that is being built required: true + swift-target-arch: + description: The target architecture to build Swift for (e.g., armv6 or armv7) + required: true swift-workspace-cache: description: The name of the Swift workspace directory to restore required: true @@ -27,6 +30,7 @@ runs: name: Build Swift + SDK using Sysroot with: swift-tag: ${{ inputs.swift-tag }} - sysroot-name: sysroot-${{ inputs.distribution }}-armv7 + sysroot-name: sysroot-${{ inputs.distribution }} + swift-target-arch: ${{ inputs.swift-target-arch }} distribution: ${{ inputs.distribution }} builder-tag: ${{ inputs.builder-tag }} diff --git a/.github/actions/build-with-sysroot/action.yml b/.github/actions/build-with-sysroot/action.yml index 7bc23a3..31c8ee6 100644 --- a/.github/actions/build-with-sysroot/action.yml +++ b/.github/actions/build-with-sysroot/action.yml @@ -1,4 +1,4 @@ -name: Build Swift with a provided armv7 sysroot for a given sysroot +name: Build Swift with a provided sysroot and for a target architecture description: This contains the functionality to build/restore a sysroot, build Swift, and build an SDK inputs: swift-tag: @@ -7,6 +7,9 @@ inputs: sysroot-name: description: The name of the sysroot to use to build Swift required: true + swift-target-arch: + description: The target architecture to build Swift for (e.g., armv6 or armv7) + required: true distribution: description: The name of the distribution to build for required: true @@ -29,20 +32,22 @@ runs: run: | docker run --rm --user runner --workdir ${{ github.workspace }} -v $HOME:$HOME \ -e SWIFT_VERSION=${{ inputs.swift-tag }} \ - -e INSTALL_TAR=$(pwd)/${{ inputs.swift-tag }}-${{ inputs.distribution }}-armv7-install.tar.gz \ + -e INSTALL_TAR=$(pwd)/${{ inputs.swift-tag }}-${{ inputs.distribution }}-${{ inputs.swift-target-arch }}-install.tar.gz \ -e STAGING_DIR=$(pwd)/${{ inputs.sysroot-name }} \ + -e SWIFT_TARGET_ARCH=${{ inputs.swift-target-arch }} -e SKIP_FETCH_SOURCES=1 \ xtremekforever/swift-builder:${{ inputs.builder-tag }} \ /bin/bash ./build.sh - name: Build SDK for Linux shell: bash run: | - INSTALLABLE_SDK_PACKAGE=$(pwd)/${{ inputs.swift-tag }}-${{ inputs.distribution }}-armv7-sdk.tar.gz SYSROOT=${{ inputs.sysroot-name }} \ + INSTALLABLE_SDK_PACKAGE=$(pwd)/${{ inputs.swift-tag }}-${{ inputs.distribution }}-${{ inputs.swift-target-arch }}-sdk.tar.gz \ + SYSROOT=${{ inputs.sysroot-name }} \ ./build-linux-cross-sdk.sh ${{ inputs.swift-tag }} ${{ inputs.distribution }} - name: Test SDK for Linux shell: bash env: - SDK_NAME: ${{ inputs.swift-tag }}-${{ inputs.distribution }}-armv7 + SDK_NAME: ${{ inputs.swift-tag }}-${{ inputs.distribution }}-${{ inputs.swift-target-arch }} run: | docker run --rm --user runner --workdir ${{ github.workspace }} -v $HOME:$HOME -v ${{ github.workspace }}/artifacts:/opt \ xtremekforever/swift-builder:${{ inputs.builder-tag }} \ @@ -54,8 +59,8 @@ runs: - uses: actions/upload-artifact@v4 name: Publish with: - name: ${{ inputs.swift-tag }}-${{ inputs.distribution }}-armv7 + name: ${{ inputs.swift-tag }}-${{ inputs.distribution }}-${{ inputs.swift-target-arch }} path: | ${{ inputs.sysroot-name }}.tar.gz - ${{ inputs.swift-tag }}*-armv7-install.tar.gz - ${{ inputs.swift-tag }}*-armv7-sdk.tar.gz + ${{ inputs.swift-tag }}*-${{ inputs.swift-target-arch }}-install.tar.gz + ${{ inputs.swift-tag }}*-${{ inputs.swift-target-arch }}-sdk.tar.gz diff --git a/.github/workflows/build-swift-latest.yml b/.github/workflows/build-swift-latest.yml index e9ba708..1d74224 100644 --- a/.github/workflows/build-swift-latest.yml +++ b/.github/workflows/build-swift-latest.yml @@ -2,18 +2,19 @@ name: Build Swift Latest on: push: - branches: [ "main" ] + branches: [ "main", "feature/armv6" ] pull_request: branches: [ "main" ] env: - DISTRIBUTION: debian-bookworm + DISTRIBUTION: raspios-bookworm jobs: build-latest: strategy: matrix: version: ["6.0.3"] + swift-target-arch: ["armv6", "armv7"] env: SWIFT_VERSION: ${{ matrix.version }} SWIFT_TAG: swift-${{ matrix.version }}-RELEASE @@ -35,5 +36,6 @@ jobs: name: Build & Publish Swift with: swift-tag: ${{ env.SWIFT_TAG }} + swift-target-arch: ${{ matrix.swift-target-arch }} distribution: ${{ env.DISTRIBUTION }} builder-tag: ${{ env.SWIFT_VERSION }} diff --git a/build-sysroot.sh b/build-sysroot.sh index 3f23f46..51a198f 100755 --- a/build-sysroot.sh +++ b/build-sysroot.sh @@ -10,9 +10,8 @@ DISTRIUBTION_VERSION=$2 SYSROOT=$3 if [ -z $SYSROOT ]; then - SYSROOT=sysroot-$DISTRIBUTION_NAME-$DISTRIUBTION_VERSION + SYSROOT=$(pwd)/sysroot-$DISTRIBUTION_NAME-$DISTRIUBTION_VERSION fi -SYSROOT=$(pwd)/$SYSROOT DISTRIBUTION="$DISTRIBUTION_NAME:$DISTRIUBTION_VERSION" @@ -97,14 +96,14 @@ if [ ! -z $EXTRA_PACKAGES ]; then INSTALL_DEPS_CMD="$INSTALL_DEPS_CMD && apt-get install -y $EXTRA_PACKAGES --no-optional" fi -if [[ $DISTRIBUTION_NAME = "debian" ]]; then +# This is for supporting armv6 +if [[ $DISTRIBUTION_NAME = "raspios" ]]; then echo "Installing host dependencies..." sudo apt update && sudo apt install qemu-user-static p7zip xz-utils mkdir artifacts && true cd artifacts - # Use Raspberry Pi OS to build for debian to support armv6 echo "Downloading raspios $RASPBIAN_VERSION for $DISTRIUBTION_VERSION..." IMAGE_FILE=$RASPIOS_VERSION-raspios-$DISTRIUBTION_VERSION-armhf-lite.img DOWNLOAD_URL=$RASPIOS_URL/$IMAGE_FILE.xz @@ -175,4 +174,4 @@ else echo "Cleaning up" docker rm $CONTAINER_NAME -fi \ No newline at end of file +fi