-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #24 from kleis-technology/feature/lc_step
feature/lc step
- Loading branch information
Showing
23 changed files
with
535 additions
and
80 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
name: Publish | ||
|
||
on: | ||
push: | ||
tags: [ "v*.*.*" ] | ||
workflow_dispatch: | ||
|
||
jobs: | ||
publish: | ||
runs-on: ubuntu-latest | ||
steps: | ||
# Checkout the repository | ||
- name: Checkout code | ||
uses: actions/checkout@v3 | ||
|
||
# Log in to GitHub Container Registry | ||
- name: Log in to GitHub Container Registry | ||
uses: docker/login-action@v3 | ||
with: | ||
registry: ghcr.io | ||
username: ${{ github.actor }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
# Build and push the Docker image | ||
- name: Build and push Docker image | ||
uses: docker/build-push-action@v6 | ||
with: | ||
push: true | ||
tags: | | ||
ghcr.io/${{ github.repository_owner }}/${{ github.repository }}:${{ github.ref_name }} | ||
ghcr.io/${{ github.repository_owner }}/${{ github.repository }}:latest |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
package org.cloud_assess.model | ||
|
||
import ch.kleis.lcaac.core.lang.value.ProductValue | ||
import ch.kleis.lcaac.core.lang.value.StringValue | ||
import ch.kleis.lcaac.core.math.basic.BasicNumber | ||
|
||
data class ProductMatcher( | ||
private val name: String, | ||
private val process: String, | ||
private val labels: Map<String, String> = emptyMap(), | ||
private val arguments: Map<String, String> = emptyMap(), | ||
) { | ||
override fun toString(): String { | ||
return "$name from $process$arguments$labels" | ||
} | ||
|
||
fun addLabel(name: String, value: String): ProductMatcher = this.copy( | ||
labels = this.labels.plus(name to value) | ||
) | ||
|
||
fun addArgument(name: String, value: String): ProductMatcher = this.copy( | ||
arguments = this.arguments.plus(name to value) | ||
) | ||
|
||
fun matches(product: ProductValue<BasicNumber>): Boolean { | ||
val matchName = name == product.name | ||
val matchProcessName = process == product.fromProcessRef?.name | ||
val actualLabels = product.fromProcessRef | ||
?.matchLabels | ||
?.mapValues { it.value.s } | ||
?.entries ?: emptySet() | ||
val sameLabels = actualLabels.containsAll(labels.entries) | ||
&& labels.entries.containsAll(actualLabels) | ||
val actualArguments = product.fromProcessRef | ||
?.arguments | ||
?.filterValues { it is StringValue<BasicNumber> } | ||
?.mapValues { (it.value as StringValue).s } | ||
?.entries ?: emptySet() | ||
val containsArguments = actualArguments.containsAll(arguments.entries) | ||
return matchName && matchProcessName && sameLabels && containsArguments | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.