Skip to content

Commit edee32e

Browse files
authored
Merge pull request #56 from ktoso/wip-untested-nightly
2 parents aba153a + 7becdfb commit edee32e

File tree

4 files changed

+62
-6
lines changed

4 files changed

+62
-6
lines changed

.github/workflows/pull_request.yml

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,8 @@ jobs:
3131
JAVA_HOME: "/usr/lib/jvm/default-jdk"
3232
steps:
3333
- uses: actions/checkout@v4
34-
- name: Install Make
35-
run: apt-get -qq update && apt-get -qq install -y make
34+
- name: Install System Dependencies
35+
run: apt-get -qq update && apt-get -qq install -y make curl wget
3636
- name: Install JDK
3737
run: "bash -xc 'JDK_VENDOR=${{ matrix.jdk_vendor }} ./docker/install_jdk.sh'"
3838
# TODO: not using setup-java since incompatible with the swiftlang/swift base image
@@ -41,6 +41,18 @@ jobs:
4141
# distribution: 'zulu'
4242
# java-version: '22'
4343
# cache: 'gradle'
44+
- name: Install Nightly Swift
45+
run: "bash -xc './docker/install_untested_nightly_swift.sh'"
46+
# Cache .m2/repository
47+
- name: Cache local Gradle repository
48+
uses: actions/cache@v4
49+
continue-on-error: true
50+
with:
51+
path: ~/.gradle/caches
52+
key: ${{ runner.os }}-gradle-cache-${{ hashFiles('**/build.gradle') }}-${{ hashFiles('**/build.gradle.kts') }}
53+
restore-keys: |
54+
${{ runner.os }}-gradle-cache
55+
${{ runner.os }}-gradle-
4456
- name: Gradle build
4557
run: ./gradlew build --info --no-daemon
4658

@@ -59,10 +71,12 @@ jobs:
5971
JAVA_HOME: "/usr/lib/jvm/default-jdk"
6072
steps:
6173
- uses: actions/checkout@v4
62-
- name: Install Make
63-
run: apt-get -qq update && apt-get -qq install -y make
74+
- name: Install System Dependencies
75+
run: apt-get -qq update && apt-get -qq install -y make curl wget
6476
- name: Install JDK
6577
run: "bash -xc 'JDK_VENDOR=${{ matrix.jdk_vendor }} ./docker/install_jdk.sh'"
78+
- name: Install Nightly Swift
79+
run: "bash -xc './docker/install_untested_nightly_swift.sh'"
6680
- name: Generate sources (make) (Temporary)
6781
# TODO: this should be triggered by the respective builds
6882
run: "make jextract-run"

docker/Dockerfile

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,4 +19,8 @@ ENV LANGUAGE=en_US.UTF-8
1919
COPY install_jdk.sh .
2020
RUN bash -xc 'JDK_VENDOR=Corretto ./install_jdk.sh'
2121
ENV JAVA_HOME="/usr/lib/jvm/default-jdk"
22-
ENV PATH="$PATH:/usr/lib/jvm/default-jdk/bin"
22+
ENV PATH="$PATH:/usr/lib/jvm/default-jdk/bin"
23+
24+
# Install "untested" nightly 'main' Swift
25+
# TODO: Only do this if the released Swift is older than what we require
26+
RUN bash -xc './install_nightly_untested_swift.sh'
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
#!/bin/bash
2+
##===----------------------------------------------------------------------===##
3+
##
4+
## This source file is part of the Swift.org open source project
5+
##
6+
## Copyright (c) 2024 Apple Inc. and the Swift.org project authors
7+
## Licensed under Apache License v2.0
8+
##
9+
## See LICENSE.txt for license information
10+
## See CONTRIBUTORS.txt for the list of Swift.org project authors
11+
##
12+
## SPDX-License-Identifier: Apache-2.0
13+
##
14+
##===----------------------------------------------------------------------===##
15+
set -euo pipefail
16+
17+
echo "Download [nightly] [untested] Swift toolchain for: $(uname -m)"
18+
19+
declare -r SWIFT_UNTESTED_TOOLCHAIN_JOB_URL="https://ci.swift.org/job/oss-swift-package-ubuntu-22_04/lastSuccessfulBuild/consoleText"
20+
21+
if [[ "$(grep "22.04" /etc/lsb-release)" = "" ]]; then
22+
echo "This script specifically only supports Ubuntu 20.04 due to nightly toolchain availability"
23+
exit 1
24+
fi
25+
26+
UNTESTED_TOOLCHAIN_URL=$(curl -s $SWIFT_UNTESTED_TOOLCHAIN_JOB_URL | grep 'Toolchain: ' | sed 's/Toolchain: //g')
27+
UNTESTED_TOOLCHAIN_FILENAME=$(echo "$UNTESTED_TOOLCHAIN_URL" | awk '
28+
function basename(file) {
29+
sub(".*/", "", file)
30+
return file
31+
}
32+
{print FILENAME, basename(FILENAME)}')
33+
34+
cd /
35+
curl "$UNTESTED_TOOLCHAIN_URL" > "$UNTESTED_TOOLCHAIN_FILENAME"
36+
37+
tar xzf "$UNTESTED_TOOLCHAIN_FILENAME"
38+
swift -version

settings.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
//
1313
//===----------------------------------------------------------------------===//
1414

15-
pluginManagement{
15+
pluginManagement {
1616
includeBuild("BuildLogic")
1717
}
1818

0 commit comments

Comments
 (0)