Skip to content

Commit 436be8a

Browse files
committed
try to fix CI docc validation by guessing JAVA_HOME
1 parent bd45afb commit 436be8a

File tree

5 files changed

+39
-14
lines changed

5 files changed

+39
-14
lines changed

.github/workflows/pull_request.yml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,30 @@ jobs:
1313
# FIXME: Something is off with the format task and it gets "stuck", need to investigate
1414
format_check_enabled: false
1515
license_header_check_project_name: Swift.org
16+
# We need JAVA_HOME to be set to build the Swift project, so the default check would not do that.
17+
docs_check_enabled: false
18+
19+
soundness-docs:
20+
name: Soundness (Documentation) (swift:${{ matrix.swift_version }} jdk:${{matrix.jdk_vendor}} os:${{ matrix.os_version }})
21+
runs-on: ubuntu-latest
22+
strategy:
23+
fail-fast: true
24+
matrix:
25+
# swift_version: ['nightly-main']
26+
swift_version: ['6.0.2']
27+
os_version: ['jammy']
28+
jdk_vendor: ['Corretto']
29+
container:
30+
image: ${{ (contains(matrix.swift_version, 'nightly') && 'swiftlang/swift') || 'swift' }}:${{ matrix.swift_version }}-${{ matrix.os_version }}
31+
env:
32+
JAVA_HOME: "/usr/lib/jvm/default-jdk"
33+
steps:
34+
- uses: actions/checkout@v4
35+
- name: Prepare CI Environment
36+
uses: ./.github/actions/prepare_env
37+
- name: "Soundness (Documentation)"
38+
run: apt-get -qq update && apt-get -qq -y install curl yq && \
39+
curl -s https://raw.githubusercontent.com/swiftlang/github-workflows/refs/heads/main/.github/workflows/scripts/check-docs.sh | bash
1640

1741
test-java:
1842
name: Java tests (swift:${{ matrix.swift_version }} jdk:${{matrix.jdk_vendor}} os:${{ matrix.os_version }})

Package.swift

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,14 @@ func findJavaHome() -> String {
2626
return home
2727
}
2828

29+
// Detect we're on CI and try to guess the JAVA_HOME for the shared Swift Soundness scripts
30+
if ProcessInfo.processInfo.environment["GITHUB_ACTIONS"] != nil {
31+
let defaultCIJDKPath = "/usr/lib/jvm/default-jdk"
32+
if FileManager.default.fileExists(atPath: defaultCIJDKPath) {
33+
return defaultCIJDKPath
34+
}
35+
}
36+
2937
fatalError("Please set the JAVA_HOME environment variable to point to where Java is installed.")
3038
}
3139
let javaHome = findJavaHome()
@@ -410,4 +418,4 @@ case "true", "TRUE", "yes", "YES", "1":
410418
)
411419
default:
412420
()
413-
}
421+
}

Sources/JExtractSwift/JExtractSwift.docc/JExtractSwift.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,6 @@ func callMe(maybe: () -> ()) {}
3838
```
3939

4040

41-
4241
## `jextract-swift` importer behavior
4342

4443
Only `public` functions, properties and types are imported.
@@ -60,3 +59,4 @@ public final class SomeModule ... {
6059
public static void globalFunction() { ... }
6160
}
6261
```
62+

Sources/SwiftJava/SwiftJava.docc/SwiftJava.md

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,8 @@
22

33
Java interoperability for Swift.
44

5-
This project offers both ways to simplify using JNI to call from Swift code into Java libraryes (primarily centered around the `JavaKit` library),
5+
This project offers both ways to simplify using JNI to call from Swift code into Java libraries (primarily centered around the `JavaKit` library),
66
as well as a way to generate Java wrappers around existing Swift code to ease consumption of Swift libraries from Java.
77

8-
Please refer to
8+
The project is in early development so please reach out on github or the [swift forums](https://forums.swift.org)
99

10-
## Topics
11-
12-
### Calling Swift From Java
13-
14-
- ``JavaKit/JavaKit``
15-
16-
### Calling Java From Swift
17-
18-
### In depth

Sources/SwiftJava/dummy.swift

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,6 @@
1212
//
1313
//===----------------------------------------------------------------------===//
1414

15-
// empty on purpose
15+
// empty on purpose
16+
17+
public func swiftkit_dummy() {}

0 commit comments

Comments
 (0)