Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
File renamed without changes.
153 changes: 153 additions & 0 deletions .github/workflows/pull_request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,156 @@ jobs:
name: docker-logs
path: |
*.log

android-build:
name: Android ${{ matrix.build-type }} ${{ matrix.swift-version }} ${{ matrix.arch }} ${{ matrix.runner }} (compiler=${{ matrix.build-compiler }})
strategy:
fail-fast: false
matrix:
include:
- swift-version: 'tag:swift-DEVELOPMENT-SNAPSHOT-2026-02-06-a'
build-type: 'docker'
build-compiler: '1'
runner: 'ubuntu-24.04'
- swift-version: 'tag:swift-6.3-DEVELOPMENT-SNAPSHOT-2026-01-29-a'
build-type: 'local'
build-compiler: '1'
runner: 'ubuntu-24.04'
runs-on: ${{ matrix.runner }}
# 16 hour timeout
timeout-minutes: 1080
steps:
- name: Free Disk Space
run: |
df -h
# brings available space from 25G to 32G
# otherwise we sometimes run out of space during the build
sudo rm -rf /usr/share/miniconda /usr/share/az* /usr/share/glade* /usr/local/share/chromium /usr/local/share/powershell /usr/share/dotnet /opt/ghc /opt/hostedtoolcache /usr/local/graalvm/ /usr/local/.ghcup/ /usr/local/lib/node_modules /usr/local/share/boost
sudo docker image prune --all --force
sudo docker builder prune -a
df -h
- name: Setup
id: config
run: |
# these variabes are used by build-docker and build-local
# to determine which Swift version to build for
echo "SWIFT_VERSION=${{ matrix.swift-version }}" >> $GITHUB_ENV
# pass the build-compiler matrix through to the build script
echo "BUILD_COMPILER=${{ matrix.build-compiler }}" >> $GITHUB_ENV
echo "TARGET_ARCHS=${{ matrix.arch }}" >> $GITHUB_ENV
echo "WORKDIR=${{ runner.temp }}/swift-android-sdk" >> $GITHUB_ENV
- name: Checkout repository
uses: actions/checkout@v4
- name: Build Android SDK (Local)
if: ${{ matrix.build-type == 'local' }}
working-directory: swift-ci/sdks/android
run: |
sudo apt install -q patchelf build-essential cmake ninja-build python3 golang git gnupg2 libcurl4-openssl-dev libedit-dev libicu-dev libncurses5-dev libpython3-dev libsqlite3-dev libxml2-dev rsync uuid-dev uuid-runtime tzdata curl unzip
./build-local ${SWIFT_VERSION} ${WORKDIR}
- name: Build Android SDK (Docker)
if: ${{ matrix.build-type == 'docker' }}
working-directory: swift-ci/sdks/android
run: |
./build-docker ${SWIFT_VERSION} ${WORKDIR}
- name: Install Host Toolchain
if: ${{ matrix.build-type == 'docker' }}
working-directory: swift-ci/sdks/android
run: |
# when building in a Docker container, we don't have a local host toolchain,
# but we need one in order to run the SDK validation tests, so we install it now
HOST_OS=ubuntu$(lsb_release -sr)
source ./scripts/toolchain-vars.sh
mkdir -p ${WORKDIR}/host-toolchain
./scripts/install-swift.sh ${WORKDIR}/host-toolchain/$SWIFT_BASE/usr
ls ${WORKDIR}/host-toolchain
${WORKDIR}/host-toolchain/*/usr/bin/swift --version
- name: Get artifact info
id: info
shell: bash
run: |
set -ex
SWIFT_ROOT=$(dirname ${WORKDIR}/host-toolchain/*/usr)
echo "swift-root=${SWIFT_ROOT}" >> $GITHUB_OUTPUT
echo "swift-path=${SWIFT_ROOT}/usr/bin/swift" >> $GITHUB_OUTPUT

ARTIFACT_PATH=$(realpath ${WORKDIR}/products/*.artifactbundle.tar.gz)
echo "artifact-path=${ARTIFACT_PATH}" >> $GITHUB_OUTPUT
echo "sdk-id=x86_64-unknown-linux-android28" >> $GITHUB_OUTPUT

ARTIFACT_EXT=".artifactbundle.tar.gz"
ARTIFACT_NAME="$(basename ${ARTIFACT_PATH} ${ARTIFACT_EXT})"
# depending on whether we are building locally or in a container, add a maker to the name
if [[ "${{ matrix.build-type }}" == 'local' ]]; then
ARTIFACT_NAME="${ARTIFACT_NAME}-local"
fi
if [[ "${{ matrix.build-compiler }}" == '1' ]]; then
ARTIFACT_NAME="${ARTIFACT_NAME}-hostbuild"
fi
# artifacts need a unique name so we suffix with the matrix arch(s)
if [[ ! -z "${{ matrix.arch }}" ]]; then
ARTIFACT_NAME="${ARTIFACT_NAME}-$(echo ${{ matrix.arch }} | tr ',' '-')"
fi
ARTIFACT_NAME="${ARTIFACT_NAME}${ARTIFACT_EXT}"

# There is no way to prevent even a single-file artifact from being zipped:
# https://github.com/actions/upload-artifact?tab=readme-ov-file#zip-archives
# so the actual artifact download will look like:
# swift-6.1-RELEASE_android-0.1-x86_64.artifactbundle.tar.gz.zip
echo "artifact-name=${ARTIFACT_NAME}" >> $GITHUB_OUTPUT
- name: Upload SDK artifactbundle
uses: actions/upload-artifact@v4
with:
compression-level: 0
name: ${{ steps.info.outputs.artifact-name }}
path: ${{ steps.info.outputs.artifact-path }}
- name: Cleanup
run: |
# need to free up some space or else when installing we get: No space left on device
df -h
rm -rf ${WORKDIR}/{build,source}
sudo docker image prune --all --force
sudo docker builder prune -a
df -h
- name: Install artifactbundle
shell: bash
run: |
set -ex
${{ steps.info.outputs.swift-path }} sdk install ${{ steps.info.outputs.artifact-path }}
${{ steps.info.outputs.swift-path }} sdk configure --show-configuration $(${{ steps.info.outputs.swift-path }} sdk list | head -n 1) ${{ steps.info.outputs.sdk-id }}
# recent releases require that ANDROID_NDK_ROOT *not* be set
# see https://github.com/swiftlang/swift-driver/pull/1879
echo "ANDROID_NDK_ROOT=" >> $GITHUB_ENV

- name: Create Demo Project
run: |
cd ${{ runner.temp }}
mkdir DemoProject
cd DemoProject
${{ steps.info.outputs.swift-path }} --version
${{ steps.info.outputs.swift-path }} package init
echo 'import Foundation' >> Sources/DemoProject/DemoProject.swift
echo 'import FoundationEssentials' >> Sources/DemoProject/DemoProject.swift
echo 'import FoundationXML' >> Sources/DemoProject/DemoProject.swift
echo 'import FoundationNetworking' >> Sources/DemoProject/DemoProject.swift
echo 'import Dispatch' >> Sources/DemoProject/DemoProject.swift
echo 'import Android' >> Sources/DemoProject/DemoProject.swift
- name: Test Demo Project on Android
uses: skiptools/swift-android-action@main
with:
# only test for the complete arch SDK build to speed up CI
#run-tests: ${{ matrix.arch == '' }}
package-path: ${{ runner.temp }}/DemoProject
installed-sdk: ${{ steps.info.outputs.sdk-id }}
installed-swift: ${{ steps.info.outputs.swift-root }}

- name: Checkout swift-algorithms
uses: actions/checkout@v4
with:
repository: apple/swift-algorithms
path: swift-algorithms
- name: Test swift-algorithms
uses: skiptools/swift-android-action@main
with:
package-path: swift-algorithms
installed-sdk: ${{ steps.info.outputs.sdk-id }}
installed-swift: ${{ steps.info.outputs.swift-root }}
70 changes: 70 additions & 0 deletions nightly-6.3/fedora/41/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
FROM fedora:41
LABEL maintainer="Swift Infrastructure <swift-infrastructure@forums.swift.org>"
LABEL description="Docker Container for the Swift programming language"

RUN yum -y install \
binutils \
gcc \
git \
zip \
unzip \
libcurl-devel \
libedit-devel \
libicu-devel \
sqlite-devel \
libuuid-devel \
libxml2-devel \
python3-devel \
libstdc++-devel \
libstdc++-static \
gnupg


ARG SWIFT_SIGNING_KEY=E813C892820A6FA13755B268F167DF1ACF9CE069
ARG SWIFT_PLATFORM=fedora41
ARG SWIFT_VERSION=6.3
ARG SWIFT_BRANCH=swift-${SWIFT_VERSION}-release
ARG SWIFT_TAG=swift-${SWIFT_VERSION}-RELEASE
ARG SWIFT_WEBROOT=https://download.swift.org/swift-6.3-branch
ARG SWIFT_WEBROOT="$SWIFT_WEBROOT/$SWIFT_PLATFORM"
ARG SWIFT_PREFIX=/opt/swift/${SWIFT_VERSION}

ENV SWIFT_SIGNING_KEY=$SWIFT_SIGNING_KEY \
SWIFT_PLATFORM=$SWIFT_PLATFORM \
SWIFT_VERSION=$SWIFT_VERSION \
SWIFT_BRANCH=$SWIFT_BRANCH \
SWIFT_TAG=$SWIFT_TAG \
SWIFT_WEBROOT=$SWIFT_WEBROOT \
SWIFT_PREFIX=$SWIFT_PREFIX

RUN set -e; \
ARCH_NAME="$(rpm --eval '%{_arch}')"; \
url=; \
case "${ARCH_NAME##*-}" in \
'x86_64') \
OS_ARCH_SUFFIX=''; \
;; \
'aarch64') \
OS_ARCH_SUFFIX='-aarch64'; \
;; \
*) echo >&2 "error: unsupported architecture: '$ARCH_NAME'"; exit 1 ;; \
esac; \
export $(curl -s ${SWIFT_WEBROOT}${OS_ARCH_SUFFIX}/latest-build.yml | grep 'download:' | sed 's/:[^:\/\/]/=/g') \
&& export $(curl -s ${SWIFT_WEBROOT}${OS_ARCH_SUFFIX}/latest-build.yml | grep 'download_signature:' | sed 's/:[^:\/\/]/=/g') \
&& export DOWNLOAD_DIR=$(echo $download | sed "s/-${SWIFT_PLATFORM}${OS_ARCH_SUFFIX}.tar.gz//g") \
&& echo $DOWNLOAD_DIR > .swift_tag \
# - Download the GPG keys, Swift toolchain, and toolchain signature, and verify.
&& export GNUPGHOME="$(mktemp -d)" \
&& curl -fsSL ${SWIFT_WEBROOT}${OS_ARCH_SUFFIX}/${DOWNLOAD_DIR}/${download} -o latest_toolchain.tar.gz \
${SWIFT_WEBROOT}${OS_ARCH_SUFFIX}/${DOWNLOAD_DIR}/${download} -o latest_toolchain.tar.gz.sig \
&& curl -fSsL --compressed https://swift.org/keys/all-keys.asc | gpg --import - \
# - Unpack the toolchain, set libs permissions, and clean up.
&& mkdir -p $SWIFT_PREFIX \
&& tar -xzf latest_toolchain.tar.gz --directory $SWIFT_PREFIX --strip-components=1 \
&& chmod -R o+r $SWIFT_PREFIX/usr/lib/swift \
&& rm -rf "$GNUPGHOME" latest_toolchain.tar.gz.sig latest_toolchain.tar.gz

ENV PATH="${SWIFT_PREFIX}/usr/bin:${PATH}"

# Print Installed Swift Version
RUN swift --version
80 changes: 80 additions & 0 deletions nightly-6.3/fedora/41/buildx/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
FROM fedora:41 AS base
LABEL maintainer="Swift Infrastructure <swift-infrastructure@forums.swift.org>"
LABEL description="Docker Container for the Swift programming language"

RUN yum -y install \
binutils \
gcc \
git \
zip \
unzip \
libcurl-devel \
libedit-devel \
libicu-devel \
sqlite-devel \
libuuid-devel \
libxml2-devel \
python3-devel \
libstdc++-devel \
libstdc++-static \
gnupg


ARG SWIFT_SIGNING_KEY=E813C892820A6FA13755B268F167DF1ACF9CE069
ARG SWIFT_PLATFORM=fedora41
ARG SWIFT_VERSION=6.3
ARG SWIFT_BRANCH=swift-${SWIFT_VERSION}-release
ARG SWIFT_TAG=swift-${SWIFT_VERSION}-RELEASE
ARG SWIFT_WEBROOT=https://download.swift.org/swift-6.3-branch
ARG SWIFT_WEBROOT="$SWIFT_WEBROOT/$SWIFT_PLATFORM"
ARG SWIFT_PREFIX=/opt/swift/${SWIFT_VERSION}

# This is a small trick to enable if/else for arm64 and amd64.
# Because of https://bugs.swift.org/browse/SR-14872 we need adjust tar options.
FROM base AS base-amd64
ARG OS_ARCH_SUFFIX=

FROM base AS base-arm64
ARG OS_ARCH_SUFFIX=-aarch64

FROM base-$TARGETARCH AS final

ENV SWIFT_SIGNING_KEY=$SWIFT_SIGNING_KEY \
SWIFT_PLATFORM=$SWIFT_PLATFORM \
SWIFT_VERSION=$SWIFT_VERSION \
SWIFT_BRANCH=$SWIFT_BRANCH \
SWIFT_TAG=$SWIFT_TAG \
SWIFT_WEBROOT=$SWIFT_WEBROOT \
SWIFT_PREFIX=$SWIFT_PREFIX

RUN set -e; \
ARCH_NAME="$(rpm --eval '%{_arch}')"; \
url=; \
case "${ARCH_NAME##*-}" in \
'x86_64') \
OS_ARCH_SUFFIX=''; \
;; \
'aarch64') \
OS_ARCH_SUFFIX='-aarch64'; \
;; \
*) echo >&2 "error: unsupported architecture: '$ARCH_NAME'"; exit 1 ;; \
esac; \
export $(curl -s ${SWIFT_WEBROOT}${OS_ARCH_SUFFIX}/latest-build.yml | grep 'download:' | sed 's/:[^:\/\/]/=/g') \
&& export $(curl -s ${SWIFT_WEBROOT}${OS_ARCH_SUFFIX}/latest-build.yml | grep 'download_signature:' | sed 's/:[^:\/\/]/=/g') \
&& export DOWNLOAD_DIR=$(echo $download | sed "s/-${SWIFT_PLATFORM}${OS_ARCH_SUFFIX}.tar.gz//g") \
&& echo $DOWNLOAD_DIR > .swift_tag \
# - Download the GPG keys, Swift toolchain, and toolchain signature, and verify.
&& export GNUPGHOME="$(mktemp -d)" \
&& curl -fsSL ${SWIFT_WEBROOT}${OS_ARCH_SUFFIX}/${DOWNLOAD_DIR}/${download} -o latest_toolchain.tar.gz \
${SWIFT_WEBROOT}${OS_ARCH_SUFFIX}/${DOWNLOAD_DIR}/${download} -o latest_toolchain.tar.gz.sig \
&& curl -fSsL --compressed https://swift.org/keys/all-keys.asc | gpg --import - \
# - Unpack the toolchain, set libs permissions, and clean up.
&& mkdir -p $SWIFT_PREFIX \
&& tar -xzf latest_toolchain.tar.gz --directory $SWIFT_PREFIX --strip-components=1 \
&& chmod -R o+r $SWIFT_PREFIX/usr/lib/swift \
&& rm -rf "$GNUPGHOME" latest_toolchain.tar.gz.sig latest_toolchain.tar.gz

ENV PATH="${SWIFT_PREFIX}/usr/bin:${PATH}"

# Print Installed Swift Version
RUN swift --version
78 changes: 78 additions & 0 deletions swift-ci/main/amazon-linux/2023/Verification/6.2/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
FROM amazonlinux:2023

RUN yum install shadow-utils -y

RUN groupadd -g 998 build-user && \
useradd -m -r -u 42 -g build-user build-user

RUN yum -y group install "development tools"
RUN yum -y install \
cmake \
ninja-build \
curl-devel \
gcc-c++ \
clang \
git \
libbsd-devel \
libedit-devel \
libicu-devel \
libuuid-devel \
libxml2-devel \
ncurses-devel \
pkgconfig \
procps-ng \
python3 \
python3-devel \
python3-distro \
python3-setuptools \
python-pip \
rsync \
sqlite-devel \
swig \
tzdata \
unzip \
zip \
lld \
diffutils \
which

RUN mkdir -p /usr/local/lib/python3.7/site-packages/

COPY swift-ci/dependencies/requirements.txt /dependencies/
RUN pip3 install -r /dependencies/requirements.txt
RUN pip3 install six

ARG SWIFT_PLATFORM=amazon-linux2023
ARG SWIFT_VERSION=6.2
ARG SWIFT_WEBROOT=https://download.swift.org
ARG SWIFT_PREFIX=/opt/swift/${SWIFT_VERSION}

ENV SWIFT_PLATFORM=$SWIFT_PLATFORM \
SWIFT_VERSION=$SWIFT_VERSION \
SWIFT_WEBROOT=$SWIFT_WEBROOT \
SWIFT_PREFIX=$SWIFT_PREFIX

RUN set -e; \
ARCH_NAME="$(rpm --eval '%{_arch}')"; \
url=; \
case "${ARCH_NAME##*-}" in \
'x86_64') \
OS_ARCH_SUFFIX=''; \
;; \
'aarch64') \
OS_ARCH_SUFFIX='-aarch64'; \
;; \
*) echo >&2 "error: unsupported architecture: '$ARCH_NAME'"; exit 1 ;; \
esac; \
SWIFT_BIN_URL="$SWIFT_WEBROOT/tmp-ci-nightly/development/swift-6.2-bootstrap/amazonlinux2023$OS_ARCH_SUFFIX/latest.tar.gz" \
&& curl -fsSL "$SWIFT_BIN_URL" -o swift.tar.gz \
&& mkdir -p $SWIFT_PREFIX \
&& tar -xzf swift.tar.gz --directory $SWIFT_PREFIX \
&& ls -la $SWIFT_PREFIX/usr/lib/ \
&& chmod -R o+r $SWIFT_PREFIX/usr/lib/swift \
&& rm -rf "$GNUPGHOME" swift.tar.gz

ENV PATH="${SWIFT_PREFIX}/usr/bin:${PATH}"

USER build-user
WORKDIR /home/build-user
Loading
Loading