From 4ba48012840ffbaa98ab014e111691d10424bf58 Mon Sep 17 00:00:00 2001 From: Ahmed Moussa Date: Thu, 30 Nov 2023 02:00:10 +0200 Subject: [PATCH] ci: add manual trigger for docs update & extra documents Signed-off-by: Ahmed Moussa --- .github/ISSUE_TEMPLATE.md | 5 ++ .github/ISSUE_TEMPLATE/1-bug-report.yaml | 36 +++++++++++ .github/ISSUE_TEMPLATE/2-feature-request.yaml | 23 ++++++++ .github/ISSUE_TEMPLATE/config.yml | 2 + .github/PULL_REQUEST_TEMPLATE.md | 28 +++++++++ .github/workflows/release-documentation.yml | 59 +++++++++++++++++++ apollo/build.gradle.kts | 41 +++++++++++-- apollo/docs/Base64.md | 50 ++++++++++++++++ apollo/docs/SecureRandom.md | 38 ++++++++++++ build.gradle.kts | 7 +-- 10 files changed, 279 insertions(+), 10 deletions(-) create mode 100644 .github/ISSUE_TEMPLATE.md create mode 100644 .github/ISSUE_TEMPLATE/1-bug-report.yaml create mode 100644 .github/ISSUE_TEMPLATE/2-feature-request.yaml create mode 100644 .github/ISSUE_TEMPLATE/config.yml create mode 100644 .github/PULL_REQUEST_TEMPLATE.md create mode 100644 .github/workflows/release-documentation.yml create mode 100644 apollo/docs/Base64.md create mode 100644 apollo/docs/SecureRandom.md diff --git a/.github/ISSUE_TEMPLATE.md b/.github/ISSUE_TEMPLATE.md new file mode 100644 index 000000000..4c4fb04e1 --- /dev/null +++ b/.github/ISSUE_TEMPLATE.md @@ -0,0 +1,5 @@ +To submit a new issue, please, use one of the following templates: + +https://github.com/input-output-hk/atala-prism-didcomm-kmm/issues/new/choose + +Thank you! \ No newline at end of file diff --git a/.github/ISSUE_TEMPLATE/1-bug-report.yaml b/.github/ISSUE_TEMPLATE/1-bug-report.yaml new file mode 100644 index 000000000..c0fe44489 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/1-bug-report.yaml @@ -0,0 +1,36 @@ +--- +name: Bug Report +description: Report a bug in the Atala PRISM DIDComm + +body: + - type: dropdown + id: is-regression + attributes: + label: Is this a regression? + options: + - 'Yes' + - 'No' + validations: + required: true + + - type: textarea + id: description + attributes: + label: Description + validations: + required: true + + - type: textarea + id: exception-or-error + attributes: + label: Please provide the exception or error you saw + + - type: textarea + id: environment + attributes: + label: Please provide the environment you discovered this bug in + + - type: textarea + id: other + attributes: + label: Anything else? diff --git a/.github/ISSUE_TEMPLATE/2-feature-request.yaml b/.github/ISSUE_TEMPLATE/2-feature-request.yaml new file mode 100644 index 000000000..048598441 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/2-feature-request.yaml @@ -0,0 +1,23 @@ +--- +name: 'Feature Request' +description: Suggest a new feature for Atala PRISM DIDComm + +body: + - type: textarea + id: proposed-feature + attributes: + label: Proposed feature + validations: + required: true + + - type: textarea + id: description + attributes: + label: Feature description + validations: + required: true + + - type: textarea + id: other + attributes: + label: Anything else? diff --git a/.github/ISSUE_TEMPLATE/config.yml b/.github/ISSUE_TEMPLATE/config.yml new file mode 100644 index 000000000..bd9dfe4ef --- /dev/null +++ b/.github/ISSUE_TEMPLATE/config.yml @@ -0,0 +1,2 @@ +--- +blank_issues_enabled: false diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md new file mode 100644 index 000000000..24cc4ab08 --- /dev/null +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -0,0 +1,28 @@ +# Overview + + +Fixes # + +## Checklist + +### My PR contains... +* [ ] No code changes (changes to documentation, CI, metadata, etc.) +* [ ] Bug fixes (non-breaking change which fixes an issue) +* [ ] Improvements (misc. changes to existing features) +* [ ] Features (non-breaking change which adds functionality) + +### My changes... +* [ ] are breaking changes +* [ ] are not breaking changes +* [ ] If yes to above: I have updated the documentation accordingly + +### Documentation +* [ ] My changes do not require a change to the project documentation +* [ ] My changes require a change to the project documentation +* [ ] If yes to above: I have updated the documentation accordingly + +### Tests +* [ ] My changes can not or do not need to be tested +* [ ] My changes can and should be tested by unit and/or integration tests +* [ ] If yes to above: I have added tests to cover my changes +* [ ] If yes to above: I have taken care to cover edge cases in my tests \ No newline at end of file diff --git a/.github/workflows/release-documentation.yml b/.github/workflows/release-documentation.yml new file mode 100644 index 000000000..b7649d41b --- /dev/null +++ b/.github/workflows/release-documentation.yml @@ -0,0 +1,59 @@ +--- +# kics-scan ignore +name: "Release Documentation" + +defaults: + run: + shell: bash + +env: + JAVA_VERSION: 11 + NODEJS_VERSION: 16.17.0 + ATALA_GITHUB_ACTOR: ${{ secrets.ATALA_GITHUB_ACTOR }} + ATALA_GITHUB_TOKEN: ${{ secrets.ATALA_GITHUB_TOKEN }} + +on: + workflow_dispatch: + push: + tags: + - "*" + +jobs: + build: + runs-on: ubuntu-latest + steps: + - name: "Checkout the repo" + uses: actions/checkout@v3 + + - name: "Validate Gradle Wrapper" + uses: gradle/wrapper-validation-action@v1 + + - name: "Cache gradle" + uses: actions/cache@v3 + with: + path: | + ~/.gradle/caches + ~/.gradle/wrapper + ~/.konan + key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*') }} + restore-keys: | + ${{ runner.os }}-gradle- + + - name: "Install Java ${{ env.JAVA_VERSION }}" + uses: actions/setup-java@v3 + with: + java-version: ${{ env.JAVA_VERSION }} + distribution: "zulu" + + - name: "Dokka Documentation Generation" + run: | + ./gradlew dokkaHtml + + - name: "Push" + uses: s0/git-publish-subdir-action@develop + env: + REPO: self + BRANCH: gh-pages # The branch name where you want to push the assets + FOLDER: "apollo/build/dokka/html/" # The directory where your assets are generated + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # GitHub will automatically add this - you don't need to bother getting a token + MESSAGE: "feat(docs): ({sha}) {msg}" # The commit message diff --git a/apollo/build.gradle.kts b/apollo/build.gradle.kts index c598de072..4718058e5 100644 --- a/apollo/build.gradle.kts +++ b/apollo/build.gradle.kts @@ -4,6 +4,7 @@ import org.jetbrains.dokka.gradle.DokkaTask import org.jetbrains.kotlin.gradle.targets.js.webpack.KotlinWebpackOutput.Target import org.jetbrains.kotlin.gradle.tasks.CInteropProcess import org.jetbrains.kotlin.gradle.tasks.KotlinCompile +import java.net.URL val currentModuleName: String = "Apollo" val os: OperatingSystem = OperatingSystem.current() @@ -314,14 +315,43 @@ ktlint { } // Dokka implementation -tasks.withType { - moduleName.set(project.name) +tasks.withType().configureEach { + moduleName.set(currentModuleName) moduleVersion.set(rootProject.version.toString()) description = "This is a Kotlin Multiplatform Library for cryptography" + pluginConfiguration { + customAssets = listOf(rootDir.resolve("Logo.png")) + } dokkaSourceSets { - // TODO: Figure out how to include files to the documentations - named("commonMain") { - includes.from("Module.md", "docs/Module.md") + configureEach { + jdkVersion.set(11) + languageVersion.set("1.8.20") + apiVersion.set("2.0") + includes.from( + "docs/Base64.md", + "docs/SecureRandom.md", + ) + sourceLink { + localDirectory.set(projectDir.resolve("src")) + remoteUrl.set(URL("https://github.com/input-output-hk/atala-prism-apollo/tree/main/src")) + remoteLineSuffix.set("#L") + } + externalDocumentationLink { + url.set(URL("https://kotlinlang.org/api/latest/jvm/stdlib/")) + } + externalDocumentationLink { + url.set(URL("https://kotlinlang.org/api/kotlinx.serialization/")) + } + externalDocumentationLink { + url.set(URL("https://api.ktor.io/")) + } + externalDocumentationLink { + url.set(URL("https://kotlinlang.org/api/kotlinx-datetime/")) + packageListUrl.set(URL("https://kotlinlang.org/api/kotlinx-datetime/")) + } + externalDocumentationLink { + url.set(URL("https://kotlinlang.org/api/kotlinx.coroutines/")) + } } } } @@ -335,6 +365,7 @@ npmPublish { named("js") { scope.set("atala") packageName.set("apollo") + readme.set(rootDir.resolve("README.md")) packageJson { author { name.set("IOG") diff --git a/apollo/docs/Base64.md b/apollo/docs/Base64.md new file mode 100644 index 000000000..26714ed9d --- /dev/null +++ b/apollo/docs/Base64.md @@ -0,0 +1,50 @@ +# Package io.iohk.atala.prism.apollo.base64 + +[![Kotlin](https://img.shields.io/badge/kotlin-1.8.20-blue.svg?logo=kotlin)](http://kotlinlang.org) + +![android](https://camo.githubusercontent.com/b1d9ad56ab51c4ad1417e9a5ad2a8fe63bcc4755e584ec7defef83755c23f923/687474703a2f2f696d672e736869656c64732e696f2f62616467652f706c6174666f726d2d616e64726f69642d3645444238442e7376673f7374796c653d666c6174) +![apple-silicon](https://camo.githubusercontent.com/a92c841ffd377756a144d5723ff04ecec886953d40ac03baa738590514714921/687474703a2f2f696d672e736869656c64732e696f2f62616467652f737570706f72742d2535424170706c6553696c69636f6e2535442d3433424246462e7376673f7374796c653d666c6174) +![ios](https://camo.githubusercontent.com/1fec6f0d044c5e1d73656bfceed9a78fd4121b17e82a2705d2a47f6fd1f0e3e5/687474703a2f2f696d672e736869656c64732e696f2f62616467652f706c6174666f726d2d696f732d4344434443442e7376673f7374796c653d666c6174) +![jvm](https://camo.githubusercontent.com/700f5dcd442fd835875568c038ae5cd53518c80ae5a0cf12c7c5cf4743b5225b/687474703a2f2f696d672e736869656c64732e696f2f62616467652f706c6174666f726d2d6a766d2d4442343133442e7376673f7374796c653d666c6174) +![js](https://camo.githubusercontent.com/3e0a143e39915184b54b60a2ecedec75e801f396d34b5b366c94ec3604f7e6bd/687474703a2f2f696d672e736869656c64732e696f2f62616467652f706c6174666f726d2d6a732d4638444235442e7376673f7374796c653d666c6174) +![getNode-js](https://camo.githubusercontent.com/d08fda729ceebcae0f23c83499ca8f06105350f037661ac9a4cc7f58edfdbca9/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f706c6174666f726d2d6e6f64656a732d3638613036332e7376673f7374796c653d666c6174) +![macos](https://camo.githubusercontent.com/1b8313498db244646b38a4480186ae2b25464e5e8d71a1920c52b2be5212b909/687474703a2f2f696d672e736869656c64732e696f2f62616467652f706c6174666f726d2d6d61636f732d3131313131312e7376673f7374796c653d666c6174) +![tvos](https://camo.githubusercontent.com/4ac08d7fb1bcb8ef26388cd2bf53b49626e1ab7cbda581162a946dd43e6a2726/687474703a2f2f696d672e736869656c64732e696f2f62616467652f706c6174666f726d2d74766f732d3830383038302e7376673f7374796c653d666c6174) +![watchos](https://camo.githubusercontent.com/135dbadae40f9cabe7a3a040f9380fb485cff36c90909f3c1ae36b81c304426b/687474703a2f2f696d672e736869656c64732e696f2f62616467652f706c6174666f726d2d77617463686f732d4330433043302e7376673f7374796c653d666c6174) + +![Atala Prism Logo](../../images/Logo.png) + +Apollo Base64 is Kotlin Multiplatform library containing: + +- Standard +- URL safe + +## Supported Targets + +| Platform | Supported | +|------------------------------------------|--------------------| +| iOS x86 64 | :heavy_check_mark: | +| iOS Arm 64 | :heavy_check_mark: | +| iOS Arm 32 | :heavy_check_mark: | +| iOS Simulator Arm 64 (Apple Silicon) | :heavy_check_mark: | +| JVM | :heavy_check_mark: | +| Android | :heavy_check_mark: | +| JS Browser | :heavy_check_mark: | +| NodeJS Browser | :heavy_check_mark: | +| macOS Arm 64 (Apple Silicon) | :heavy_check_mark: | + +## Usage + +### Base64 Standard + +```kotlin +val helloWorld = "V2VsY29tZSB0byBJT0c=".base64Decoded // "Hello, world!" +println("Welcome to IOG".base64Encoded) // Prints "SGVsbG8sIHdvcmxkIQ==" +``` + +### Base64 URL + +```kotlin +val helloWorld = "V2VsY29tZSB0byBJT0c".base64UrlDecoded // "Hello, world!" +println("Welcome to IOG".base64UrlEncoded) // Prints "SGVsbG8sIHdvcmxkIQ" +``` diff --git a/apollo/docs/SecureRandom.md b/apollo/docs/SecureRandom.md new file mode 100644 index 000000000..e7bb5e495 --- /dev/null +++ b/apollo/docs/SecureRandom.md @@ -0,0 +1,38 @@ +# Package io.iohk.atala.prism.apollo.securerandom + +[![Kotlin](https://img.shields.io/badge/kotlin-1.8.20-blue.svg?logo=kotlin)](http://kotlinlang.org) + +![android](https://camo.githubusercontent.com/b1d9ad56ab51c4ad1417e9a5ad2a8fe63bcc4755e584ec7defef83755c23f923/687474703a2f2f696d672e736869656c64732e696f2f62616467652f706c6174666f726d2d616e64726f69642d3645444238442e7376673f7374796c653d666c6174) +![apple-silicon](https://camo.githubusercontent.com/a92c841ffd377756a144d5723ff04ecec886953d40ac03baa738590514714921/687474703a2f2f696d672e736869656c64732e696f2f62616467652f737570706f72742d2535424170706c6553696c69636f6e2535442d3433424246462e7376673f7374796c653d666c6174) +![ios](https://camo.githubusercontent.com/1fec6f0d044c5e1d73656bfceed9a78fd4121b17e82a2705d2a47f6fd1f0e3e5/687474703a2f2f696d672e736869656c64732e696f2f62616467652f706c6174666f726d2d696f732d4344434443442e7376673f7374796c653d666c6174) +![jvm](https://camo.githubusercontent.com/700f5dcd442fd835875568c038ae5cd53518c80ae5a0cf12c7c5cf4743b5225b/687474703a2f2f696d672e736869656c64732e696f2f62616467652f706c6174666f726d2d6a766d2d4442343133442e7376673f7374796c653d666c6174) +![js](https://camo.githubusercontent.com/3e0a143e39915184b54b60a2ecedec75e801f396d34b5b366c94ec3604f7e6bd/687474703a2f2f696d672e736869656c64732e696f2f62616467652f706c6174666f726d2d6a732d4638444235442e7376673f7374796c653d666c6174) +![getNode-js](https://camo.githubusercontent.com/d08fda729ceebcae0f23c83499ca8f06105350f037661ac9a4cc7f58edfdbca9/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f706c6174666f726d2d6e6f64656a732d3638613036332e7376673f7374796c653d666c6174) +![macos](https://camo.githubusercontent.com/1b8313498db244646b38a4480186ae2b25464e5e8d71a1920c52b2be5212b909/687474703a2f2f696d672e736869656c64732e696f2f62616467652f706c6174666f726d2d6d61636f732d3131313131312e7376673f7374796c653d666c6174) +![tvos](https://camo.githubusercontent.com/4ac08d7fb1bcb8ef26388cd2bf53b49626e1ab7cbda581162a946dd43e6a2726/687474703a2f2f696d672e736869656c64732e696f2f62616467652f706c6174666f726d2d74766f732d3830383038302e7376673f7374796c653d666c6174) +![watchos](https://camo.githubusercontent.com/135dbadae40f9cabe7a3a040f9380fb485cff36c90909f3c1ae36b81c304426b/687474703a2f2f696d672e736869656c64732e696f2f62616467652f706c6174666f726d2d77617463686f732d4330433043302e7376673f7374796c653d666c6174) + +![Atala Prism Logo](../../images/Logo.png) + +Apollo Secure Random is Kotlin Multiplatform library to generate secure random bytes + +## Supported Targets + +| Platform | Supported | +|------------------------------------------|--------------------| +| iOS x86 64 | :heavy_check_mark: | +| iOS Arm 64 | :heavy_check_mark: | +| iOS Arm 32 | :heavy_check_mark: | +| iOS Simulator Arm 64 (Apple Silicon) | :heavy_check_mark: | +| JVM | :heavy_check_mark: | +| Android | :heavy_check_mark: | +| JS Browser | :heavy_check_mark: | +| NodeJS Browser | :heavy_check_mark: | +| macOS Arm 64 (Apple Silicon) | :heavy_check_mark: | + +## Usage + +```kotlin +val iv: ByteArray = SecureRandom().nextBytes(16) +val seed: ByteArray = SecureRandom.generateSeed(10) +``` diff --git a/build.gradle.kts b/build.gradle.kts index 4365e099b..df2e6be91 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -2,7 +2,7 @@ import org.jetbrains.kotlin.gradle.targets.js.nodejs.NodeJsRootExtension import org.jetbrains.kotlin.gradle.targets.js.nodejs.NodeJsRootPlugin plugins { - id("org.jetbrains.dokka") version "1.7.10" + id("org.jetbrains.dokka") version "1.9.10" id("org.jlleitschuh.gradle.ktlint") version "11.6.1" id("maven-publish") id("org.jetbrains.kotlinx.kover") version "0.7.2" @@ -17,6 +17,7 @@ buildscript { dependencies { classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:1.8.20") classpath("com.android.tools.build:gradle:7.2.2") + classpath("org.jetbrains.dokka:dokka-base:1.9.10") } } @@ -87,7 +88,3 @@ subprojects { rootProject.plugins.withType(NodeJsRootPlugin::class.java) { rootProject.extensions.getByType(NodeJsRootExtension::class.java).nodeVersion = "16.17.0" } - -tasks.dokkaGfmMultiModule.configure { - outputDirectory.set(buildDir.resolve("dokkaCustomMultiModuleOutput")) -}