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

Convert to multiplatform #11

Merged
merged 48 commits into from
Feb 21, 2021
Merged

Convert to multiplatform #11

merged 48 commits into from
Feb 21, 2021

Conversation

fullkomnun
Copy link
Contributor

@fullkomnun fullkomnun commented Jan 14, 2021

An attempt to convert the library to Kotlin multiplatform:

Copy link
Member

@ligi ligi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@fullkomnun
Copy link
Contributor Author

Enabled strict 'explicitApi' mode for all modules

@fullkomnun fullkomnun closed this Jan 16, 2021
@ligi
Copy link
Member

ligi commented Jan 16, 2021

hey - wondering why you closed the PR?

@fullkomnun
Copy link
Contributor Author

Closed by mistake

@fullkomnun
Copy link
Contributor Author

fullkomnun commented Jan 25, 2021

Meanwhile, for development purposes, Github Packages may be used as a maven repository that supports Kotlin MP using this ugly workaround(https://github.community/t/download-from-github-package-registry-without-authentication/14407/44).

Are any changes required in the CI to build Kotlin MP projects?

@ligi
Copy link
Member

ligi commented Jan 25, 2021

"CO" ?

@fullkomnun
Copy link
Contributor Author

"CO" ?

CI, fixed the typo =]

@ligi
Copy link
Member

ligi commented Jan 25, 2021

ah guessed so but was not sure - the CI is just executing gradle commands - but I would also be open to add Github Actions here if this would be easier. I would prefer github packages over maven central / bintray - eve though the workaround looks ugly ..
So far I am only targeting the JVM - but think there is value in supporting Kotlin MP.

@fullkomnun
Copy link
Contributor Author

Yes, I focus on adding JS(browser, node) as an additional target for my use-case, besides JS is quite popular in the blockchain domain. Other targets such as iOS or other native targets may be added later..

@ligi
Copy link
Member

ligi commented Jan 25, 2021

Cool - completely agree that JS would be the most interesting target currently.

@fullkomnun
Copy link
Contributor Author

By the way, why is the root package 'org.komputing.khex' while the artifact is published under 'com.github.komputing.khex'?

@ligi
Copy link
Member

ligi commented Jan 31, 2021

because I do not want to bind to github too much. Really hope in the future we can have something equally user-friendly but decentralized and not in the hand of Microsoft ;-)
Looking at radicle e.g.
github is just the current gateway and involved in deployment. But it is not forever. But I have control over komputing - and this is a constant I do not want to change.
But good thinking! Keep up the good work!!

@fullkomnun
Copy link
Contributor Author

@ligi The conversion is complete including usage of GitHub Actions workflows:

  • Pull Request Check (pr-check.yml): triggered for PRs to master, builds project and runs tests, uploads report in case of failure
  • Continuous Integration (continuous-integration.yml) triggered for push to master, builds project and runs tests, uploads report in case of failure and uploads artifacts to GitHub Packages with version of 'master-SNAPSHOT'
  • Release (release.yml): triggered for GitHub release creation, builds project and runs tests, uploads report in case of failure and uploads artifacts to GitHub Packages with version according to the release/tag

This allows deploying kotlin multiplatform artifacts to GitHub Packages while also supporting jitpack for jvm-only variant.
You can see this ci in action in my fork.
KHash also already converted and fetches it's KHex multiplatform dependencies from GitHub Packages using this workaround.
Any maven/gradle project can use the same public credentials from README.md to download the packages.

Before this can be declared 'ready' I need you to perform the following:

  1. Make sure to enable GitHub Actions for the original repository (if not enabled)
  2. Create a 'machine user' according to these instructions and add it to the repo/organisation as a collaborator/outside-collaborator.
  3. Create a PAT with the read:packages scope for that 'machine user'.
  4. Run docker run jcansdale/gpr encode <PAT>
  5. Share the output so I can update the encoded token and READEME.md
    (I did it for my forks but you have to this once for the original repos)

Copy link
Member

@ligi ligi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great work - just the repo needs to be changed in some part of the docs. Will do the steps for the machine user you outlined later today.

README.md Outdated
@@ -1,16 +1,46 @@
![CI](https://github.com/fullkomnun/KHex/workflows/Continuous%20Integration/badge.svg)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
![CI](https://github.com/fullkomnun/KHex/workflows/Continuous%20Integration/badge.svg)
![CI](https://github.com/komputing/KHex/workflows/Continuous%20Integration/badge.svg)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

commited

README.md Outdated
```kotlin
repositories {
maven {
name = "fullkomnun/KHex GitHub Packages"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
name = "fullkomnun/KHex GitHub Packages"
name = "komputing/KHex GitHub Packages"

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

commited

README.md Outdated
repositories {
maven {
name = "fullkomnun/KHex GitHub Packages"
url = uri("https://maven.pkg.github.com/fullkomnun/KHex")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
url = uri("https://maven.pkg.github.com/fullkomnun/KHex")
url = uri("https://maven.pkg.github.com/komputing/KHex")

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

commited

@ligi
Copy link
Member

ligi commented Feb 16, 2021

Sorry it takes a bit longer. The step of creating a user dragged in the need to setup email for komputing.org

@ligi
Copy link
Member

ligi commented Feb 19, 2021

@fullkomnun sorry for the delay - here the output:

A NuGet `nuget.config` file:
<packageSourceCredentials>
  <github>
    <add key="Username" value="PublicToken" />
    <add key="ClearTextPassword" value="&#57;&#50;&#55;&#52;&#49;&#100;&#56;&#51;&#100;&#54;&#57;&#97;&#99;&#97;&#102;&#49;&#98;&#52;&#97;&#48;&#52;&#53;&#51;&#97;&#99;&#50;&#54;&#56;&#54;&#98;&#54;&#50;&#53;&#101;&#52;&#97;&#101;&#52;&#50;&#98;" />
  </github>
</packageSourceCredentials>

A Maven `settings.xml` file:
<servers>
  <server>
    <id>github</id>
    <username>PublicToken</username>
    <password>&#57;&#50;&#55;&#52;&#49;&#100;&#56;&#51;&#100;&#54;&#57;&#97;&#99;&#97;&#102;&#49;&#98;&#52;&#97;&#48;&#52;&#53;&#51;&#97;&#99;&#50;&#54;&#56;&#54;&#98;&#54;&#50;&#53;&#101;&#52;&#97;&#101;&#52;&#50;&#98;</password>
  </server>
</servers>

An npm `.npmrc` file:
@OWNER:registry=https://npm.pkg.github.com
//npm.pkg.github.com/:_authToken="\u0039\u0032\u0037\u0034\u0031\u0064\u0038\u0033\u0064\u0036\u0039\u0061\u0063\u0061\u0066\u0031\u0062\u0034\u0061\u0030\u0034\u0035\u0033\u0061\u0063\u0032\u0036\u0038\u0036\u0062\u0036\u0032\u0035\u0065\u0034\u0061\u0065\u0034\u0032\u0062"

@fullkomnun fullkomnun marked this pull request as ready for review February 21, 2021 00:39
@fullkomnun fullkomnun requested a review from ligi February 21, 2021 00:39
@ligi ligi merged commit a29443c into komputing:master Feb 21, 2021
@fullkomnun
Copy link
Contributor Author

Ready to go, if everything goes well - KHash will follow

@ligi
Copy link
Member

ligi commented Feb 21, 2021

cool - unfortunately there seems to be a problem with actions: https://github.com/komputing/KHex/runs/1944045614

Was just waiting for my old CI and it was happy - should have waited for the actions also - remembering for next time ..-)

@fullkomnun
Copy link
Contributor Author

Yes, CI has built and ran tests successfully but publication has failed, although i do see published artifacts for 'master-SNAPSHOT'. Can you re-run the CI workflow maybe?

@ligi
Copy link
Member

ligi commented Feb 21, 2021

cool - yea the rerun worked

@fullkomnun
Copy link
Contributor Author

And I was able to fetch it from my KHash fork using the credentials so pushed the changes.
Currently though it targets 'master-SNAPSHOT', for it to target a stable release you have to create a new GitHub release.
Both the old ci/Jitpack and the new GitHub Actions/Packages should work in tandem keeping it backwards-compatible.

@ligi
Copy link
Member

ligi commented Feb 21, 2021

Released 1.1.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants