diff --git a/.github/workflows/pull_request.yml b/.github/workflows/pull_request.yml index 8aad2c67..1b8013f1 100644 --- a/.github/workflows/pull_request.yml +++ b/.github/workflows/pull_request.yml @@ -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 @@ -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 @@ -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" diff --git a/docker/Dockerfile b/docker/Dockerfile index 170619e1..216e3108 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -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" \ No newline at end of file +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' diff --git a/docker/install_untested_nightly_swift.sh b/docker/install_untested_nightly_swift.sh new file mode 100755 index 00000000..76d01895 --- /dev/null +++ b/docker/install_untested_nightly_swift.sh @@ -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 \ No newline at end of file diff --git a/settings.gradle b/settings.gradle index 7ec81ed0..3a0bd106 100644 --- a/settings.gradle +++ b/settings.gradle @@ -12,7 +12,7 @@ // //===----------------------------------------------------------------------===// -pluginManagement{ +pluginManagement { includeBuild("BuildLogic") }