Skip to content

cache downloaded swiftpm artifacts #58

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 1 commit 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
51 changes: 39 additions & 12 deletions .github/workflows/pull_request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,25 +36,31 @@ jobs:
- 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
# - uses: actions/setup-java@v4
# with:
# distribution: 'zulu'
# java-version: '22'
# cache: 'gradle'
- name: Install Nightly Swift
- name: Install Untested Nightly Swift
run: "bash -xc './docker/install_untested_nightly_swift.sh'"
# Cache .m2/repository
# setup caches
- 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') }}
path: |
/root/.gradle/caches
/root/.gradle/wrapper
key: ${{ runner.os }}-gradle-${{ hashFiles('*/*.gradle*', 'settings.gradle') }}
restore-keys: |
${{ runner.os }}-gradle-cache
${{ runner.os }}-gradle-
- name: Cache local SwiftPM repository
uses: actions/cache@v4
continue-on-error: true
with:
path: /__w/swift-java/swift-java/.build/checkouts
key: ${{ runner.os }}-swiftpm-cache-${{ hashFiles('Package.swift') }}
restore-keys: |
${{ runner.os }}-swiftpm-cache
${{ runner.os }}-swiftpm-
# run the actual build
- name: Gradle build
run: ./gradlew build --info --no-daemon
run: ./gradlew update --info --no-daemon

test-swift:
name: Swift tests (swift:${{ matrix.swift_version }} jdk:${{matrix.jdk_vendor}} os:${{ matrix.os_version }})
Expand All @@ -75,8 +81,29 @@ jobs:
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
- name: Install Untested Nightly Swift
run: "bash -xc './docker/install_untested_nightly_swift.sh'"
# setup caches
- name: Cache local Gradle repository
uses: actions/cache@v4
continue-on-error: true
with:
path: |
/root/.gradle/caches
/root/.gradle/wrapper
key: ${{ runner.os }}-gradle-${{ hashFiles('*/*.gradle*', 'settings.gradle') }}
restore-keys: |
${{ runner.os }}-gradle-
- name: Cache local SwiftPM repository
uses: actions/cache@v4
continue-on-error: true
with:
path: /__w/swift-java/swift-java/.build/checkouts
key: ${{ runner.os }}-swiftpm-cache-${{ hashFiles('Package.swift') }}
restore-keys: |
${{ runner.os }}-swiftpm-cache
${{ runner.os }}-swiftpm-
# run the actual build
- name: Generate sources (make) (Temporary)
# TODO: this should be triggered by the respective builds
run: "make jextract-run"
Expand Down
16 changes: 8 additions & 8 deletions docker/install_untested_nightly_swift.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,15 @@ if [[ "$(grep "22.04" /etc/lsb-release)" = "" ]]; then
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)}')
UNTESTED_TOOLCHAIN_FILENAME=$"toolchain.tar.gz"

echo "Download toolchain: $UNTESTED_TOOLCHAIN_URL"

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

swift -version

echo "Extract toolchain: $UNTESTED_TOOLCHAIN_FILENAME"
tar xzf "$UNTESTED_TOOLCHAIN_FILENAME"
swift -version
swift -version