-
Notifications
You must be signed in to change notification settings - Fork 7
ci: add package smoke checks #224
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
base: main
Are you sure you want to change the base?
Changes from all commits
a84da9f
2ba1f01
91b2ec3
fd032ef
1413b02
dd633e2
03030cf
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -104,9 +104,28 @@ jobs: | |
| run: | | ||
| brew install --overwrite aarch64-unknown-linux-gnu | ||
|
|
||
| - uses: maxim-lobanov/setup-xcode@v1 | ||
| if: matrix.os-type == 'macos' | ||
| with: | ||
| xcode-version: '16.2' | ||
|
|
||
| - name: "Install build dependencies (Linux)" | ||
| if: matrix.os-type == 'linux' | ||
| run: sudo apt-get update && sudo apt-get install build-essential -y | ||
|
|
||
| - name: "Install Rust toolchain" | ||
| run: | | ||
| curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs -o rustup-init.sh | ||
| sh rustup-init.sh -y --profile minimal --default-toolchain stable | ||
| echo "$HOME/.cargo/bin" >> "$GITHUB_PATH" | ||
| export PATH="$HOME/.cargo/bin:$PATH" | ||
| rustc --version | ||
| cargo --version | ||
|
|
||
| - name: "Install Rust Targets" | ||
| if: matrix.os-type == 'macos' | ||
| run: | | ||
| export PATH="$HOME/.cargo/bin:$PATH" | ||
| rustup target add armv7-linux-androideabi | ||
| rustup target add i686-linux-android | ||
| rustup target add aarch64-linux-android | ||
|
|
@@ -116,18 +135,10 @@ jobs: | |
| rustup target add aarch64-unknown-linux-gnu | ||
| rustup target add x86_64-unknown-linux-gnu | ||
|
|
||
| - uses: maxim-lobanov/setup-xcode@v1 | ||
| if: matrix.os-type == 'macos' | ||
| - name: "Setup node" | ||
| uses: actions/setup-node@v4 | ||
| with: | ||
| xcode-version: '16.2' | ||
|
|
||
| - name: "Install rust toolchain (Linux)" | ||
| if: matrix.os-type == 'linux' | ||
| run: sudo apt install rustc build-essential -y | ||
|
|
||
| - name: "Install rust toolchain (Macos)" | ||
| if: matrix.os-type == 'macos' | ||
| run: brew install rustup | ||
| node-version: '20' | ||
|
|
||
| - name: "Install wasm-pack" | ||
| run: cargo install wasm-pack | ||
|
|
@@ -141,6 +152,98 @@ jobs: | |
| - name: "Build Check All tests" | ||
| run: ./gradlew allTests | ||
|
|
||
| - name: "Build package artifacts" | ||
| if: matrix.os-type == 'macos' | ||
| run: ./gradlew :apollo:assembleJsPackage :apollo:createSwiftPackage publishToMavenLocal --no-configuration-cache | ||
|
|
||
| - name: "Smoke test npm package" | ||
| if: matrix.os-type == 'macos' | ||
| run: | | ||
| set -euo pipefail | ||
| PACK_DIR=$(mktemp -d) | ||
| TEST_DIR=$(mktemp -d) | ||
| npm pack ./apollo/build/packages/js --pack-destination "$PACK_DIR" >/dev/null | ||
| pushd "$TEST_DIR" >/dev/null | ||
| npm init -y >/dev/null | ||
| npm install "$PACK_DIR"/*.tgz >/dev/null | ||
| node -e "require('@hyperledger/identus-apollo'); console.log('npm smoke ok');" | ||
| popd >/dev/null | ||
| rm -rf "$PACK_DIR" "$TEST_DIR" | ||
|
|
||
| - name: "Smoke test Maven packages" | ||
| if: matrix.os-type == 'macos' | ||
| run: | | ||
| set -euo pipefail | ||
| VERSION=$(sed -n 's/^version = *//p' gradle.properties | tr -d '[:space:]') | ||
| KOTLIN_VERSION=$(sed -n 's/^kotlin = "\(.*\)"/\1/p' gradle/libs.versions.toml | head -n1) | ||
| test -f "$HOME/.m2/repository/org/hyperledger/identus/apollo-jvm/$VERSION/apollo-jvm-$VERSION.jar" | ||
| test -f "$HOME/.m2/repository/org/hyperledger/identus/apollo-android/$VERSION/apollo-android-$VERSION.aar" | ||
| test -f "$HOME/.m2/repository/org/hyperledger/identus/apollo-iosarm64/$VERSION/apollo-iosarm64-$VERSION.klib" | ||
|
|
||
| TEST_DIR=$(mktemp -d) | ||
| cat <<'EOF' > "$TEST_DIR/settings.gradle.kts" | ||
| rootProject.name = "apollo-jvm-smoke" | ||
| EOF | ||
| cat <<EOF > "$TEST_DIR/build.gradle.kts" | ||
| plugins { | ||
| kotlin("jvm") version "$KOTLIN_VERSION" | ||
| application | ||
| } | ||
| repositories { mavenLocal(); mavenCentral() } | ||
| dependencies { implementation("org.hyperledger.identus:apollo-jvm:$VERSION") } | ||
| application { mainClass.set("MainKt") } | ||
| EOF | ||
| mkdir -p "$TEST_DIR/src/main/kotlin" | ||
| cat <<'EOF' > "$TEST_DIR/src/main/kotlin/Main.kt" | ||
| import org.hyperledger.identus.apollo.utils.KMMECSecp256k1PublicKey | ||
|
|
||
| fun main() { | ||
| val bytes = ByteArray(33) { 0 } | ||
| bytes[0] = 0x02 | ||
| KMMECSecp256k1PublicKey(bytes) | ||
| println("maven smoke ok") | ||
| } | ||
| EOF | ||
| gradle -p "$TEST_DIR" run --no-daemon | ||
| rm -rf "$TEST_DIR" | ||
|
|
||
| - name: "Smoke test Swift package" | ||
| if: matrix.os-type == 'macos' | ||
| run: | | ||
| set -euo pipefail | ||
| TEST_DIR=$(mktemp -d) | ||
| ln -s "${GITHUB_WORKSPACE}/apollo/build/packages/ApolloSwift/ApolloLibrary.xcframework" "$TEST_DIR/ApolloLibrary.xcframework" | ||
| cat <<EOF > "$TEST_DIR/Package.swift" | ||
| // swift-tools-version: 5.9 | ||
| import PackageDescription | ||
|
|
||
| let package = Package( | ||
| name: "ApolloSwiftSmoke", | ||
| platforms: [.iOS(.v13), .macOS(.v11)], | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
The temp Swift package is created with Useful? React with 👍 / 👎. |
||
| products: [ | ||
| .executable(name: "ApolloSwiftSmoke", targets: ["ApolloSwiftSmoke"]) | ||
| ], | ||
| targets: [ | ||
| .binaryTarget( | ||
| name: "ApolloLibrary", | ||
| path: "ApolloLibrary.xcframework" | ||
| ), | ||
| .executableTarget( | ||
| name: "ApolloSwiftSmoke", | ||
| dependencies: ["ApolloLibrary"] | ||
| ) | ||
| ] | ||
| ) | ||
| EOF | ||
| mkdir -p "$TEST_DIR/Sources/ApolloSwiftSmoke" | ||
| cat <<'EOF' > "$TEST_DIR/Sources/ApolloSwiftSmoke/main.swift" | ||
| import ApolloLibrary | ||
|
|
||
| print("swift smoke ok") | ||
| EOF | ||
| swift build --package-path "$TEST_DIR" | ||
| rm -rf "$TEST_DIR" | ||
|
|
||
| - name: "Generate kover coverage report" | ||
| run: ./gradlew koverHtmlReport koverXmlReport | ||
|
|
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In the macOS PR job this new smoke test runs
gradle -p "$TEST_DIR", but the workflow only usesgradle/actions/setup-gradle@v4without agradle-version; the setup-gradle docs say it adds a Gradle executable to PATH only whengradle-versionis specified, and otherwise show wrapper-based invocations. That means this check uses whatever Gradle version themacos-latestimage happens to ship instead of the repo wrapper pinned ingradle/wrapper/gradle-wrapper.properties, so the smoke can start failing on runner image updates or with an unsupported Kotlin Gradle plugin/Gradle combination even though the published artifacts are fine. Invoke the temp project through./gradlew -p "$TEST_DIR"or configure setup-gradle with the wrapper version.Useful? React with 👍 / 👎.