Skip to content

ci: try out untested nightly swift to unblock nm removal #56

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
Oct 10, 2024
Merged
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
22 changes: 18 additions & 4 deletions .github/workflows/pull_request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ jobs:
JAVA_HOME: "/usr/lib/jvm/default-jdk"
steps:
- uses: actions/checkout@v4
- name: Install Make
run: apt-get -qq update && apt-get -qq install -y make
- name: Install System Dependencies
run: apt-get -qq update && apt-get -qq install -y make curl wget
- name: Install JDK
run: "bash -xc 'JDK_VENDOR=${{ matrix.jdk_vendor }} ./docker/install_jdk.sh'"
# TODO: not using setup-java since incompatible with the swiftlang/swift base image
Expand All @@ -41,6 +41,18 @@ jobs:
# distribution: 'zulu'
# java-version: '22'
# cache: 'gradle'
- name: Install Nightly Swift
run: "bash -xc './docker/install_untested_nightly_swift.sh'"
# Cache .m2/repository
- name: Cache local Gradle repository
uses: actions/cache@v4
continue-on-error: true
with:
path: ~/.gradle/caches
key: ${{ runner.os }}-gradle-cache-${{ hashFiles('**/build.gradle') }}-${{ hashFiles('**/build.gradle.kts') }}
restore-keys: |
${{ runner.os }}-gradle-cache
${{ runner.os }}-gradle-
- name: Gradle build
run: ./gradlew build --info --no-daemon

Expand All @@ -59,10 +71,12 @@ jobs:
JAVA_HOME: "/usr/lib/jvm/default-jdk"
steps:
- uses: actions/checkout@v4
- name: Install Make
run: apt-get -qq update && apt-get -qq install -y make
- name: Install System Dependencies
run: apt-get -qq update && apt-get -qq install -y make curl wget
- name: Install JDK
run: "bash -xc 'JDK_VENDOR=${{ matrix.jdk_vendor }} ./docker/install_jdk.sh'"
- name: Install Nightly Swift
run: "bash -xc './docker/install_untested_nightly_swift.sh'"
- name: Generate sources (make) (Temporary)
# TODO: this should be triggered by the respective builds
run: "make jextract-run"
Expand Down
6 changes: 5 additions & 1 deletion docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,8 @@ ENV LANGUAGE=en_US.UTF-8
COPY install_jdk.sh .
RUN bash -xc 'JDK_VENDOR=Corretto ./install_jdk.sh'
ENV JAVA_HOME="/usr/lib/jvm/default-jdk"
ENV PATH="$PATH:/usr/lib/jvm/default-jdk/bin"
ENV PATH="$PATH:/usr/lib/jvm/default-jdk/bin"

# Install "untested" nightly 'main' Swift
# TODO: Only do this if the released Swift is older than what we require
RUN bash -xc './install_nightly_untested_swift.sh'
38 changes: 38 additions & 0 deletions docker/install_untested_nightly_swift.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
#!/bin/bash
##===----------------------------------------------------------------------===##
##
## This source file is part of the Swift.org open source project
##
## Copyright (c) 2024 Apple Inc. and the Swift.org project authors
## Licensed under Apache License v2.0
##
## See LICENSE.txt for license information
## See CONTRIBUTORS.txt for the list of Swift.org project authors
##
## SPDX-License-Identifier: Apache-2.0
##
##===----------------------------------------------------------------------===##
set -euo pipefail

echo "Download [nightly] [untested] Swift toolchain for: $(uname -m)"

declare -r SWIFT_UNTESTED_TOOLCHAIN_JOB_URL="https://ci.swift.org/job/oss-swift-package-ubuntu-22_04/lastSuccessfulBuild/consoleText"

if [[ "$(grep "22.04" /etc/lsb-release)" = "" ]]; then
echo "This script specifically only supports Ubuntu 20.04 due to nightly toolchain availability"
exit 1
fi

UNTESTED_TOOLCHAIN_URL=$(curl -s $SWIFT_UNTESTED_TOOLCHAIN_JOB_URL | grep 'Toolchain: ' | sed 's/Toolchain: //g')
UNTESTED_TOOLCHAIN_FILENAME=$(echo "$UNTESTED_TOOLCHAIN_URL" | awk '
function basename(file) {
sub(".*/", "", file)
return file
}
{print FILENAME, basename(FILENAME)}')

cd /
curl "$UNTESTED_TOOLCHAIN_URL" > "$UNTESTED_TOOLCHAIN_FILENAME"

tar xzf "$UNTESTED_TOOLCHAIN_FILENAME"
swift -version
2 changes: 1 addition & 1 deletion settings.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
//
//===----------------------------------------------------------------------===//

pluginManagement{
pluginManagement {
includeBuild("BuildLogic")
}

Expand Down
Loading