Skip to content
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

ci: Re-enable CI for KMP #21

Merged
merged 1 commit into from
May 31, 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
9 changes: 2 additions & 7 deletions .github/workflows/pull-request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@ env:
ATALA_GITHUB_ACTOR: ${{ secrets.ATALA_GITHUB_ACTOR }}
ATALA_GITHUB_TOKEN: ${{ secrets.ATALA_GITHUB_TOKEN }}

on: [pull_request]
on: [ pull_request ]

jobs:
build:
runs-on: macos-latest
runs-on: macos-13
steps:
- name: "Checkout the repo"
uses: actions/checkout@v4
Expand All @@ -40,11 +40,6 @@ jobs:
working-directory: ./anoncred-kmm
run: ./gradlew ktlintCheck

- name: "Install Homebrew"
run: >
/bin/bash -c "$(curl -fsSL
https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
- name: "Install autoconf, automake, libtool"
run: |
brew install autoconf automake libtool
Expand Down
149 changes: 72 additions & 77 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ jobs:
with:
commit_message: "chore: prepare release ${{github.event.inputs.tag}}"
tagging_message: ${{github.event.inputs.tag}}

- name: Upload library artifacts
uses: actions/upload-artifact@v3
with:
Expand All @@ -65,82 +65,8 @@ jobs:
file: uniffi/output-frameworks/anoncreds-swift/libanoncreds.xcframework.zip
asset_name: "libanoncreds.xcframework.zip"

# build-kmp:
# name: "Build KMP"
# runs-on: macos-latest
# steps:
# - name: Checkout the repo
# uses: actions/checkout@v3
# with:
# submodules: recursive
# token: ${{ secrets.ATALA_GITHUB_TOKEN }}
# fetch-depth: 0
#
# - name: "Install Java ${{ env.JAVA_VERSION }}"
# uses: actions/setup-java@v3
# with:
# java-version: "${{ env.JAVA_VERSION }}"
# distribution: zulu
#
# - name: Install Homebrew
# run: >
# /bin/bash -c "$(curl -fsSL
# https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
#
# - name: "Install autoconf, automake, libtool"
# run: |
# brew install autoconf automake libtool
#
# - name: "Install Mac ToolChain"
# run: |
# brew tap messense/macos-cross-toolchains
#
# - name: "Install Linux GNU for x86_64"
# run: |
# rm '/usr/local/bin/2to3'
# rm '/usr/local/bin/2to3-3.11'
# rm '/usr/local/bin/2to3-3.12'
# rm '/usr/local/bin/python3'
# rm '/usr/local/bin/python3.11'
# rm '/usr/local/bin/python3.12'
# rm '/usr/local/bin/idle3'
# rm '/usr/local/bin/idle3.11'
# rm '/usr/local/bin/idle3.12'
# rm '/usr/local/bin/pydoc3'
# rm '/usr/local/bin/pydoc3.11'
# rm '/usr/local/bin/pydoc3.12'
# rm '/usr/local/bin/python3-config'
# rm '/usr/local/bin/python3.11-config'
# rm '/usr/local/bin/python3.12-config'
# rm -r '/usr/local/lib/node_modules'
# brew install --overwrite x86_64-unknown-linux-gnu
#
# - name: "Install Linux GNU for aarch64"
# run: |
# brew install --overwrite aarch64-unknown-linux-gnu
#
# - name: "Install Rust Targets"
# run: |
# rustup target add armv7-linux-androideabi
# rustup target add i686-linux-android
# rustup target add aarch64-linux-android
# rustup target add x86_64-linux-android
# rustup target add aarch64-apple-darwin
# rustup target add x86_64-apple-darwin
# rustup target add aarch64-unknown-linux-gnu
# rustup target add x86_64-unknown-linux-gnu
#
# - name: "Install Rust Cargo NDK"
# run: |
# cargo install cargo-ndk
#
# - name: "Publish to GitHub Maven"
# working-directory: ./anoncred-kmm
# run: |
# ./gradlew :anoncreds-kmp:publishAllPublicationsToGitHubPackagesRepository

build-release:
needs: [build-swift-package]
needs: [ build-swift-package ]
name: Build Library

strategy:
Expand Down Expand Up @@ -203,7 +129,7 @@ jobs:
run: |
cd uniffi
cargo build --release --target ${{matrix.target}}
- name: Upload library artifacts
uses: actions/upload-artifact@v3
with:
Expand All @@ -229,3 +155,72 @@ jobs:
tag: ${{github.event.inputs.tag}}
file: library-${{ matrix.architecture }}.tar.gz
asset_name: "library-${{ matrix.architecture }}-${{ github.sha }}.tar.gz"

build-kmp:
name: "Build KMP"
runs-on: macos-13
steps:
- name: Checkout the repo
uses: actions/checkout@v4
with:
submodules: recursive
token: ${{ secrets.ATALA_GITHUB_TOKEN }}
fetch-depth: 0

- name: "Install Java ${{ env.JAVA_VERSION }}"
uses: actions/setup-java@v4
with:
java-version: "${{ env.JAVA_VERSION }}"
distribution: zulu

- name: "Install autoconf, automake, libtool"
run: |
brew install autoconf automake libtool
- name: "Install Mac ToolChain"
run: |
brew tap messense/macos-cross-toolchains
- name: "Install Linux GNU for x86_64"
run: |
rm '/usr/local/bin/2to3'
rm '/usr/local/bin/2to3-3.11'
rm '/usr/local/bin/2to3-3.12'
rm '/usr/local/bin/python3'
rm '/usr/local/bin/python3.11'
rm '/usr/local/bin/python3.12'
rm '/usr/local/bin/idle3'
rm '/usr/local/bin/idle3.11'
rm '/usr/local/bin/idle3.12'
rm '/usr/local/bin/pydoc3'
rm '/usr/local/bin/pydoc3.11'
rm '/usr/local/bin/pydoc3.12'
rm '/usr/local/bin/python3-config'
rm '/usr/local/bin/python3.11-config'
rm '/usr/local/bin/python3.12-config'
rm -r '/usr/local/lib/node_modules'
brew install --overwrite x86_64-unknown-linux-gnu
- name: "Install Linux GNU for aarch64"
run: |
brew install --overwrite aarch64-unknown-linux-gnu
- name: "Install Rust Targets"
run: |
rustup target add armv7-linux-androideabi
rustup target add i686-linux-android
rustup target add aarch64-linux-android
rustup target add x86_64-linux-android
rustup target add aarch64-apple-darwin
rustup target add x86_64-apple-darwin
rustup target add aarch64-unknown-linux-gnu
rustup target add x86_64-unknown-linux-gnu
- name: "Install Rust Cargo NDK"
run: |
cargo install cargo-ndk
- name: "Publish to GitHub Maven"
working-directory: ./anoncred-kmm
run: |
./gradlew :anoncreds-kmp:publishAllPublicationsToSonatypeRepository
49 changes: 3 additions & 46 deletions anoncred-kmm/anoncred-wrapper-rust/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -41,17 +41,6 @@ fun Project.execWithOutput(spec: ExecSpec.() -> Unit): String {
}
}

/*
fun Project.commandLineWithOutput(vararg commands: String) {
val pb = ProcessBuilder()
}
*/

// TODO: Replace commandLine with
// val pb = ProcessBuilder("brew", "--version")
// pb.start().waitFor()
// println(pb.output)

/**
* Delete the generated `Target` folder that is being generated by Rust Cargo
*/
Expand All @@ -67,26 +56,6 @@ tasks.matching { it.name == "clean" }.all {
dependsOn(rustClean)
}

/**
* Building the original Rust anoncreds lib
* @note no longer needed.
*/
val buildAnoncredsLib by tasks.register<Exec>("buildAnoncredsLib") {
group = "rust"
description = "Building the original Rust anoncreds lib"
onlyIf {
rootDir
.resolve("target")
.resolve("release")
.exists()
.not()
}
workingDir = rootDir.parentFile
inputs.files(rootDir.parentFile.resolve("Cargo.toml"))
outputs.files(fileTree(rootDir.parentFile.resolve("target")))
commandLine("cargo", "build", "--release")
}

// Compiling Tasks

val buildAnonCredWrapperForMacOSArch64 by tasks.register<Exec>("buildAnonCredWrapperForMacOSArch64") {
Expand Down Expand Up @@ -260,7 +229,7 @@ val buildAnonCredWrapperForAndroidUniversal by tasks.register("buildAnonCredWrap
val buildAnonCredWrapper by tasks.register("buildAnonCredWrapper") {
group = "rust-compiling"
description = "Build and compile AnonCred Wrapper"
dependsOn(buildAnonCredWrapperForMacOSUniversal, buildAnonCredWrapperForLinuxUniversal, buildAnonCredWrapperForAndroidUniversal) // buildAnonCredWrapperForiOSUniversal
dependsOn(buildAnonCredWrapperForMacOSUniversal, buildAnonCredWrapperForLinuxUniversal, buildAnonCredWrapperForAndroidUniversal)
}

// Copy Bindings Tasks
Expand Down Expand Up @@ -376,7 +345,7 @@ val copyGeneratedBinaryForAndroid by tasks.register("copyGeneratedBinaryForAndro
val copyGeneratedBinariesToCorrectLocation by tasks.register("copyGeneratedBinariesToCorrectLocation") {
group = "rust-compiling"
description = "Copy all generated binaries to generated resources folder"
dependsOn(copyGeneratedBinaryForMacOS, copyGeneratedBinaryForLinux, copyGeneratedBinaryForAndroid) // copyGeneratedBinaryForiOS
dependsOn(copyGeneratedBinaryForMacOS, copyGeneratedBinaryForLinux, copyGeneratedBinaryForAndroid)
}

/**
Expand All @@ -390,18 +359,6 @@ val copyBindings by tasks.register<Copy>("copyBindings") {
dependsOn(copyGeneratedBinariesToCorrectLocation)
}

/**
* Copy generated dylib to correct location
*/
val copyAnoncredsBinariesToProcessedResources by tasks.register<Copy>("copyAnoncredsBinariesToProcessedResources") {
group = "rust-compiling"
description = "Copy generated AnonCreds binaries to generated resources folder"
include("*.so", "*.a", "*.d", "*.dylib")
from(rootDir.parentFile.resolve("target").resolve("release"))
into(rootDir.resolve("anoncreds-kmp").resolve("build").resolve("generatedResources").resolve("jvm").resolve("main"))
dependsOn(buildAnoncredsLib)
}

/**
* Generate rust documentation
*/
Expand Down Expand Up @@ -631,7 +588,7 @@ val buildRust by tasks.register("buildRust") {
moveRustSrcFiles
}
mustRunAfter(moveRustSrcFiles)
dependsOn(moveRustSrcFiles, requiredInstallation, verifyRust, copyBindings, copyAnoncredsBinariesToProcessedResources)
dependsOn(moveRustSrcFiles, copyBindings)
}

afterEvaluate {
Expand Down
Loading