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

Mc/matchmaking poc1 #339

Draft
wants to merge 10 commits into
base: master
Choose a base branch
from
Draft
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
69 changes: 69 additions & 0 deletions .github/workflows/release-js.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
name: JS automated product release

on:
pull_request:
branches: [master]
types: [closed]
paths:
- 'js-chat/.pubnub.yml'

jobs:
check-release:
name: Check release required
if: github.event.pull_request.merged && endsWith(github.repository, '-private') != true
runs-on:
group: macos-gh
outputs:
release: ${{ steps.check.outputs.ready }}
steps:
- name: Checkout actions
uses: actions/checkout@v4
with:
repository: pubnub/client-engineering-deployment-tools
ref: v1
token: ${{ secrets.GH_TOKEN }}
path: .github/.release/actions
- id: check
name: Check pre-release completed
uses: ./.github/.release/actions/actions/checks/release
with:
token: ${{ secrets.GH_TOKEN }}
publish:
name: Publish package
needs: check-release
if: needs.check-release.outputs.release == 'true'
runs-on:
group: macos-gh
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
# This should be the same as the one specified for on.pull_request.branches
ref: master
submodules: recursive
- name: Checkout actions
uses: actions/checkout@v4
with:
repository: pubnub/client-engineering-deployment-tools
ref: v1
token: ${{ secrets.GH_TOKEN }}
path: .github/.release/actions
- name: Install JDK
uses: actions/setup-java@v4
with:
distribution: 'zulu' # See 'Supported distributions' for available options
java-version: '21'
- uses: actions/setup-node@v4
with:
node-version: 18
- name: Publish to NPM
uses: ./.github/.release/actions/actions/services/npm
with:
token: ${{ secrets.GH_TOKEN }}
npm-token: ${{ secrets.NPM_TOKEN }}
check-ownership: false
package-path: package.json
actions: "build,publish"
build-command: npm run build
build-path: dist
last-service: true
8 changes: 8 additions & 0 deletions .github/workflows/release/js-pre-npm-build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
set -e
echo "Build JS Matchmaking SDK module artifacts"
./gradlew pubnub-matchmaking-kotlin:jsNodeProductionLibraryDistribution #build JS locally, command: ./gradlew pubnub-matchmaking-kotlin:jsNodeProductionLibraryDistribution
./gradlew pubnub-matchmaking-kotlin:packJsPackage #this is configured by npmPublish in pubnub-matchmaking-kotlin/build.gradle.kts
mkdir -p pubnub-matchmaking-kotlin/js-matchmaking/dist
cp pubnub-matchmaking-kotlin/build/packages/js/package.json pubnub-matchmaking-kotlin/js-matchmaking/package.json
cp pubnub-matchmaking-kotlin/build/dist/js/productionLibrary/pubnub-pubnub-matchmaking-kotlin.d.ts pubnub-matchmaking-kotlin/js-matchmaking/dist/ #todo zmienic nazwe pliku index.d.ts
cp pubnub-matchmaking-kotlin/build/dist/js/productionLibrary/pubnub-pubnub-matchmaking-kotlin.d.ts pubnub-matchmaking-kotlin/js-matchmaking/dist/pubnub-pubnub-matchmaking-kotlin.es.d.ts #todo zmienic nazwe pliku index.d.ts
6 changes: 6 additions & 0 deletions .github/workflows/release/products.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,11 @@
"name": "Java & Kotlin SDK",
"main": true,
"overrideRelease": true
},
"js": {
"path": "./pubnub-matchmaking-kotlin/js-matchmaking",
"name": "PubNub JS Matchmaking SDK",
"main": false,
"overrideRelease": true
}
}
4 changes: 2 additions & 2 deletions .pubnub.yml
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,8 @@ sdks:
requires:
-
name: kotlin-stdlib
min-version: 1.8.0
location: https://repo1.maven.org/maven2/org/jetbrains/kotlin/kotlin-stdlib/2.0.21/kotlin-stdlib-2.0.21.jar
min-version: 2.1.0
location: https://repo1.maven.org/maven2/org/jetbrains/kotlin/kotlin-stdlib/2.1.0/kotlin-stdlib-2.1.0.jar
license: Apache License, Version 2.0
license-url: https://www.apache.org/licenses/LICENSE-2.0.txt
is-required: Required
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,9 +71,6 @@ class PubNubBaseKotlinMultiplatformPlugin : Plugin<Project> {

if (enableJsTarget) {
js { ->
project.findProperty("JS_MODULE_NAME")?.toString()?.let { jsModuleName ->
moduleName = jsModuleName
}
nodejs {
testTask {
it.environment("MOCHA_OPTIONS", "--exit")
Expand Down
10 changes: 8 additions & 2 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,16 @@ POM_DEVELOPER_NAME=PubNub
[email protected]

IOS_SIMULATOR_ID=iPhone 15 Pro
#SWIFT_PATH=../swift
#SWIFT_PATH=../swift # swift project sourcecode is in the same folder as kotlin source

ENABLE_TARGET_JS=true
ENABLE_TARGET_IOS_OTHER=false
ENABLE_TARGET_IOS_SIMULATOR_ARM64=true
# alternatively (e.g. for release):
# ENABLE_TARGET_IOS_ALL=true
# ENABLE_TARGET_IOS_ALL=true

#the compiler generates a single, large JavaScript output file containing all Kotlin code and its dependencies.
kotlin.js.ir.output.granularity=whole-program

#we don't want to publish to NPM from here we do it from github scripts
NPM_PUBLISH_REGISTRY_NPMJS_DRY=true
7 changes: 5 additions & 2 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ logback = "1.2.11"
okhttp = "4.12.0"
retrofit2 = "2.11.0"
nexus = "2.0.0"
kotlin = "2.0.21"
kotlin = "2.1.0"
vanniktech = "0.29.0"
ktlint = "12.1.0"
dokka = "1.9.20"
Expand All @@ -28,6 +28,7 @@ jetbrains-annotations = { module = "org.jetbrains:annotations", version = "24.1.
kotlinx-atomicfu = { module = "org.jetbrains.kotlinx:atomicfu", version = "0.24.0" }
kotlinx-datetime = { module = "org.jetbrains.kotlinx:kotlinx-datetime", version.ref = "kotlinx_datetime"}
kotlinx-coroutines-core = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-core", version.ref = "kotlinx_coroutines"}
touchlab-kermit = { module = "co.touchlab:kermit", version = "2.0.4" }

# tests
wiremock = { module = "com.github.tomakehurst:wiremock", version = "2.27.2" }
Expand Down Expand Up @@ -64,4 +65,6 @@ benmanes-versions = { id = "com.github.ben-manes.versions", version = "0.42.0" }
vanniktech-maven-publish = { id = "com.vanniktech.maven.publish", version.ref = "vanniktech" }
lombok = { id = "io.freefair.lombok", version = "8.6" }
gradle-nexus-publish = { id = "io.github.gradle-nexus.publish-plugin", version.ref = "nexus" }
codingfeline-buildkonfig = { id = "com.codingfeline.buildkonfig", version = "0.15.1" }
codingfeline-buildkonfig = { id = "com.codingfeline.buildkonfig", version = "0.15.1" }
mokkery = { id = "dev.mokkery", version = "2.6.0" }
npm-publish = { id = "dev.petuska.npm.publish", version = "3.4.3" }
15 changes: 11 additions & 4 deletions kotlin-js-store/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -490,6 +490,13 @@ jsonfile@^6.0.1:
optionalDependencies:
graceful-fs "^4.1.6"

[email protected]:
version "2.0.0"
resolved "https://registry.yarnpkg.com/kotlin-web-helpers/-/kotlin-web-helpers-2.0.0.tgz#b112096b273c1e733e0b86560998235c09a19286"
integrity sha512-xkVGl60Ygn/zuLkDPx+oHj7jeLR7hCvoNF99nhwXMn8a3ApB4lLiC9pk4ol4NHPjyoCbvQctBqvzUcp8pkqyWw==
dependencies:
format-util "^1.0.5"

lil-uuid@^0.1.1:
version "0.1.1"
resolved "https://registry.yarnpkg.com/lil-uuid/-/lil-uuid-0.1.1.tgz#f9edcf23f00e42bf43f0f843d98d8b53f3341f16"
Expand Down Expand Up @@ -534,10 +541,10 @@ minimatch@^5.0.1, minimatch@^5.1.6:
dependencies:
brace-expansion "^2.0.1"

[email protected].0:
version "10.7.0"
resolved "https://registry.yarnpkg.com/mocha/-/mocha-10.7.0.tgz#9e5cbed8fa9b37537a25bd1f7fb4f6fc45458b9a"
integrity sha512-v8/rBWr2VO5YkspYINnvu81inSz2y3ODJrhO175/Exzor1RcEZZkizgE2A+w/CAXXoESS8Kys5E62dOHGHzULA==
[email protected].3:
version "10.7.3"
resolved "https://registry.yarnpkg.com/mocha/-/mocha-10.7.3.tgz#ae32003cabbd52b59aece17846056a68eb4b0752"
integrity sha512-uQWxAu44wwiACGqjbPYmjo7Lg8sFrS3dQe7PP2FQI+woptP4vZXSMcfMyFL/e1yFEeEpV4RtyTpZROOKmxis+A==
dependencies:
ansi-colors "^4.1.3"
browser-stdout "^1.3.1"
Expand Down
49 changes: 49 additions & 0 deletions pubnub-matchmaking-kotlin/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
import com.pubnub.gradle.enableJsTarget

plugins {
alias(libs.plugins.benmanes.versions)
id("pubnub.dokka")
alias(libs.plugins.npm.publish)
id("pubnub.multiplatform")
id("pubnub.shared")
}

npmPublish {
packages {
getByName("js") {
scope = "pubnub"
packageName = "matchmaking"
// types.set("index.d.ts") // todo not needed if types are generated and defined in package.json
packageJsonTemplateFile = project.layout.projectDirectory.file("js-matchmaking/package_template.json")
}
}
}

kotlin {
sourceSets {
val commonMain by getting {
dependencies {
api(project(":pubnub-matchmaking-kotlin:pubnub-matchmaking-kotlin-api"))
implementation(project(":pubnub-matchmaking-kotlin:pubnub-matchmaking-kotlin-impl"))
}
}
}
if (enableJsTarget) {
js {
// keep this in here for ad-hoc testing
// browser {
// testTask {
// useMocha {
// timeout = "15s"
// }
// }
// }

compilerOptions {
target.set("es2015")
}
binaries.library()
generateTypeScriptDefinitions() // generates pubnub-matchmaking-kotlin/build/dist/js/productionLibrary/pubnub-pubnub-matchmaking-kotlin.d.ts
}
}
}
12 changes: 12 additions & 0 deletions pubnub-matchmaking-kotlin/js-matchmaking/.pubnub.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
name: pubnub-js-matchmaking
version: 0.11.6
scm: github.com/pubnub/kotlin
schema: 1
files:
- lib/dist/index.js
changelog:
- date: 2025-03-26
version: v0.1.0
changes:
- type: feature
text: "Initial release."
31 changes: 31 additions & 0 deletions pubnub-matchmaking-kotlin/js-matchmaking/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
PubNub Software Development Kit License Agreement
Copyright © 2023 PubNub Inc. All rights reserved.

Subject to the terms and conditions of the license, you are hereby granted
a non-exclusive, worldwide, royalty-free license to (a) copy and modify
the software in source code or binary form for use with the software services
and interfaces provided by PubNub, and (b) redistribute unmodified copies
of the software to third parties. The software may not be incorporated in
or used to provide any product or service competitive with the products
and services of PubNub.

The above copyright notice and this license shall be included
in or with all copies or substantial portions of the software.

This license does not grant you permission to use the trade names, trademarks,
service marks, or product names of PubNub, except as required for reasonable
and customary use in describing the origin of the software and reproducing
the content of this license.

THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF
ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO
EVENT SHALL PUBNUB OR THE AUTHORS OR COPYRIGHT HOLDERS OF THE SOFTWARE BE
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

https://www.pubnub.com/
https://www.pubnub.com/terms


Loading
Loading