Skip to content
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
35 changes: 35 additions & 0 deletions .github/actions/cache_swiftpm_build/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: 'Cache SwiftPM .build'
description: |
Restore/save a SwiftPM .build directory keyed on Swift version, OS, a
job-specific tag, and a hash of the relevant package + source files.
Falls back to the most recent cache for the same job tag so SwiftPM
performs incremental compilation when sources change.

inputs:
path:
description: 'Path to the .build directory to cache (e.g. .build, Benchmarks/.build)'
required: true
tag:
description: 'Short job-specific tag, used to keep different jobs from sharing caches'
required: true
hash-files:
description: 'Newline-separated glob patterns hashed into the cache key'
required: true
swift-version:
description: 'Swift version, used as part of the cache key (defaults to matrix.swift_version)'
required: true
os-version:
description: 'OS version, used as part of the cache key (defaults to matrix.os_version)'
required: true

runs:
using: composite
steps:
- name: Cache ${{ inputs.path }}
uses: actions/cache@v5
continue-on-error: true
with:
path: ${{ inputs.path }}
key: ${{ runner.os }}-swift${{ inputs.swift-version }}-${{ inputs.os-version }}-build-${{ inputs.tag }}-${{ hashFiles(inputs.hash-files) }}
restore-keys: |
${{ runner.os }}-swift${{ inputs.swift-version }}-${{ inputs.os-version }}-build-${{ inputs.tag }}-
2 changes: 1 addition & 1 deletion .github/actions/prepare_env/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ runs:
# shell: bash
# run: ./gradlew -q javaToolchains
- name: Cache local SwiftPM repository
if: matrix.os_version == 'jammy'
if: matrix.os_version == 'noble'
uses: actions/cache@v4
continue-on-error: true
with:
Expand Down
85 changes: 73 additions & 12 deletions .github/workflows/pull_request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,14 +34,26 @@ jobs:
fail-fast: true
matrix:
swift_version: ['6.3']
os_version: ['jammy']
os_version: ['noble']
jdk_vendor: ['corretto']
steps:
- uses: actions/checkout@v6
- name: Prepare CI Environment
uses: ./.github/actions/prepare_env
- name: Cache .build
uses: ./.github/actions/cache_swiftpm_build
with:
path: .build
tag: docs
swift-version: ${{ matrix.swift_version }}
os-version: ${{ matrix.os_version }}
hash-files: |
Package.swift
Package.resolved
Sources/**/*.swift
Plugins/**/*.swift
- name: Swift Build
run: swift build --disable-experimental-prebuilts # FIXME: until prebuilt swift-syntax isn't broken on 6.2 anymore: https://github.com/swiftlang/swift-java/issues/418
run: swift build
- name: Run documentation check
run: ./.github/scripts/validate_docs.sh

Expand All @@ -54,7 +66,7 @@ jobs:
fail-fast: true
matrix:
swift_version: ['6.3', 'nightly']
os_version: ['jammy']
os_version: ['noble']
jdk_vendor: ['corretto']
container:
image: ${{ (contains(matrix.swift_version, 'nightly') && 'swiftlang/swift') || 'swift' }}:${{ matrix.swift_version }}-${{ matrix.os_version }}
Expand Down Expand Up @@ -104,7 +116,7 @@ jobs:
fail-fast: true
matrix:
swift_version: ['6.3']
os_version: ['jammy']
os_version: ['noble']
jdk_vendor: ['corretto']
container:
image: ${{ (contains(matrix.swift_version, 'nightly') && 'swiftlang/swift') || 'swift' }}:${{ matrix.swift_version }}-${{ matrix.os_version }}
Expand All @@ -124,7 +136,7 @@ jobs:
fail-fast: true
matrix:
swift_version: ['6.3']
os_version: ['jammy']
os_version: ['noble']
jdk_vendor: ['corretto']
container:
image: ${{ (contains(matrix.swift_version, 'nightly') && 'swiftlang/swift') || 'swift' }}:${{ matrix.swift_version }}-${{ matrix.os_version }}
Expand All @@ -136,8 +148,20 @@ jobs:
uses: ./.github/actions/prepare_env
- name: Install jemalloc
run: apt-get update && apt-get install -y libjemalloc-dev
- name: Cache Benchmarks/.build
uses: ./.github/actions/cache_swiftpm_build
with:
path: Benchmarks/.build
tag: benchmarks
swift-version: ${{ matrix.swift_version }}
os-version: ${{ matrix.os_version }}
hash-files: |
Benchmarks/Package.swift
Benchmarks/Package.resolved
Benchmarks/Benchmarks/**/*.swift
Benchmarks/Sources/**/*.swift
- name: Swift Benchmarks
run: swift package --package-path Benchmarks/ --disable-experimental-prebuilts benchmark # FIXME: until prebuilt swift-syntax isn't broken on 6.2 anymore: https://github.com/swiftlang/swift-java/issues/418
run: swift package --package-path Benchmarks/ benchmark

test-swift:
name: Test (Swift) (${{ matrix.os_version }} swift:${{ matrix.swift_version }} jdk:${{matrix.jdk_vendor}})
Expand All @@ -148,7 +172,7 @@ jobs:
fail-fast: false
matrix:
swift_version: ['6.1.3', '6.3', 'nightly']
os_version: ['jammy']
os_version: ['noble']
jdk_vendor: ['corretto']
container:
image: ${{ (contains(matrix.swift_version, 'nightly') && 'swiftlang/swift') || 'swift' }}:${{ matrix.swift_version }}-${{ matrix.os_version }}
Expand All @@ -158,6 +182,19 @@ jobs:
- uses: actions/checkout@v6
- name: Prepare CI Environment
uses: ./.github/actions/prepare_env
- name: Cache .build
uses: ./.github/actions/cache_swiftpm_build
with:
path: .build
tag: test
swift-version: ${{ matrix.swift_version }}
os-version: ${{ matrix.os_version }}
hash-files: |
Package.swift
Package.resolved
Sources/**/*.swift
Plugins/**/*.swift
Tests/**/*.swift
- name: Swift Build
run: swift build --build-tests --disable-sandbox --disable-experimental-prebuilts # FIXME: until prebuilt swift-syntax isn't broken on 6.2 anymore: https://github.com/swiftlang/swift-java/issues/418
- name: Swift Test (XCTest)
Expand Down Expand Up @@ -200,7 +237,7 @@ jobs:
fail-fast: false
matrix:
swift_version: ['6.3']
os_version: ['jammy']
os_version: ['noble']
jdk_vendor: ['corretto']
sdk_triple: ['aarch64-unknown-linux-android28', 'x86_64-unknown-linux-android28', 'armv7-unknown-linux-android28']
ndk_version: ['r27d', 'r28c']
Expand All @@ -226,7 +263,7 @@ jobs:
fail-fast: false
matrix:
swift_version: ['6.3']
os_version: ['jammy']
os_version: ['noble']
jdk_vendor: ['corretto']
sample_app: [ # TODO: use a reusable-workflow to generate those names
'JavaDependencySampleApp',
Expand Down Expand Up @@ -295,18 +332,29 @@ jobs:
run: .github/scripts/validate_sample.sh Samples/${{ matrix.sample_app }}

linkage-test:
name: Linkage test (jammy swift:6.3)
name: Linkage test (noble swift:6.3)
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
jdk_vendor: ['corretto']
container:
image: swift:6.3-jammy
image: swift:6.3-noble
steps:
- uses: actions/checkout@v6
- name: Prepare CI Environment
uses: ./.github/actions/prepare_env
- name: Cache Tests/LinkageTest/.build
uses: ./.github/actions/cache_swiftpm_build
with:
path: Tests/LinkageTest/.build
tag: linkage
swift-version: '6.3'
os-version: noble
hash-files: |
Tests/LinkageTest/Package.swift
Tests/LinkageTest/Package.resolved
Tests/LinkageTest/Sources/**/*.swift
- name: Run linkage test
run: ./scripts/run-linkage-test.sh
env:
Expand All @@ -320,13 +368,26 @@ jobs:
matrix:
jdk_vendor: ['corretto']
container:
image: swift:6.3-jammy
image: swift:6.3-noble
steps:
- uses: actions/checkout@v6
- name: Mark workspace as safe for git
run: git config --global --add safe.directory "$GITHUB_WORKSPACE"
- name: Prepare CI Environment
uses: ./.github/actions/prepare_env
- name: Cache .build
uses: ./.github/actions/cache_swiftpm_build
with:
path: .build
tag: wrapjava
swift-version: '6.3'
os-version: noble
hash-files: |
Package.swift
Package.resolved
Sources/SwiftJavaTool/**/*.swift
Sources/SwiftJavaToolLib/**/*.swift
Sources/SwiftJava/**/*.swift
- name: Regenerate JavaStdlib wrappers
env:
JAVA_HOME: ${{ env.JAVA_HOME_25 }}
Expand Down
Loading