Skip to content

Commit

Permalink
Github workflow added
Browse files Browse the repository at this point in the history
  • Loading branch information
niklastheman committed Dec 5, 2023
1 parent 4e03300 commit b64aae5
Show file tree
Hide file tree
Showing 2 changed files with 53 additions and 5 deletions.
41 changes: 41 additions & 0 deletions .github/workflows/push-release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: Build on push/release

on:
workflow_dispatch:
branches:
- main

jobs:
build-and-push:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Build Docker image
run: |
docker build -t fedn-kotlin /FednKotlin
- name: Log in to GitHub Docker Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Log in to Harbor Registry
uses: docker/login-action@v3
with:
registry: harbor.studio.scaleoutplatform.com
username: robot$github-studio
password: ${{ secrets.HARBOR_TOKEN }}

- name: Tag Docker image
run: |
docker tag fedn-kotlin ghcr.io/scaleoutsystems/android-client:fedn-kotlin
docker tag fedn-kotlin harbor.studio.scaleoutplatform.com/scaleoutstudio/fedn-kotlin:fedn-kotlin
- name: Push Docker images
run: |
docker push ghcr.io/scaleoutsystems/android-client:fedn-kotlin
docker push harbor.studio.scaleoutplatform.com/scaleoutstudio/fedn-kotlin:fedn-kotlin
17 changes: 12 additions & 5 deletions FednKotlin/app/bin/main/fednkotlin/App.kt
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ package fednkotlin

import com.example.fedn_client.FednClient
import com.example.fedn_client.IFednClient
import java.util.UUID
import kotlinx.coroutines.runBlocking

val runTrainingProcess: (ByteArray) -> ByteArray = { modelIn ->
Expand All @@ -18,18 +19,24 @@ fun main() {
runBlocking {
val url: String? = System.getenv("FEDN_URL")
val token: String? = System.getenv("FEDN_TOKEN")
val name: String? = System.getenv("FEDN_NAME")
var name: String? = System.getenv("FEDN_NAME")

if (url == null || token == null || name == null) {
println("FEDN_URL, FEDN_TOKEN and FEDN_NAME must be set")
if (url == null || token == null) {
println("FEDN_URL and FEDN_TOKEN must be set")
return@runBlocking
}

println("FEDN_URL: $url")
println("FEDN_TOKEN: $token")

if (name == null) {
println("FEDN_NAME not set, using random name")
name = UUID.randomUUID().toString()
}
println("FEDN_NAME: $name")

val fednClient: IFednClient = FednClient(url, token, name = name)
val fednClient: IFednClient =
FednClient(url, token, name = name, secureGrpcConnection = false)

val result =
fednClient.runProcess(
Expand All @@ -41,7 +48,7 @@ fun main() {
timeoutAfterMillis = 60000
)

println("Result: ${result?.first}")
println("Result: ${result.first}")
}

println("Program ran to completion")
Expand Down

0 comments on commit b64aae5

Please sign in to comment.