diff --git a/.github/workflows/buildExecuteCustom-A.yaml b/.github/workflows/buildExecuteCustom-A.yaml index 8758a05f..3860f33a 100644 --- a/.github/workflows/buildExecuteCustom-A.yaml +++ b/.github/workflows/buildExecuteCustom-A.yaml @@ -65,9 +65,10 @@ jobs: lastRC="$(./scripts/lastVersionRC.sc)" lastStable=$(./scripts/lastVersionStable.sc) - scala-cli scripts/raport-regressions.scala scripts/md_printer.scala -- $scalaVersion > raport-full.md - scala-cli scripts/raport-regressions.scala scripts/md_printer.scala -- $scalaVersion --compareWith=$lastRC > raport-compare-$lastRC.md - scala-cli scripts/raport-regressions.scala scripts/md_printer.scala -- $scalaVersion --compareWith=$lastStable > raport-compare-$lastStable.md + FOR_HTML=1 scala-cli scripts/raport-regressions.scala -- $scalaVersion > rendered.raport-full.md + scala-cli scripts/raport-regressions.scala -- $scalaVersion > raport-full.md + scala-cli scripts/raport-regressions.scala -- $scalaVersion --compareWith=$lastRC > raport-compare-$lastRC.md + scala-cli scripts/raport-regressions.scala -- $scalaVersion --compareWith=$lastStable > raport-compare-$lastStable.md - name: Upload raports uses: actions/upload-artifact@v3 @@ -87,6 +88,6 @@ jobs: uses: ./.github/actions/push-raport-to-gh-pages with: artifact-name: build-raports - file-to-pick: raport-full.md + file-to-pick: rendered.raport-full.md build-title: ${{ needs.execute-build-plan.outputs.used-scala-version }} token: ${{ steps.generate-token.outputs.token }} diff --git a/.github/workflows/buildExecuteCustom-B.yaml b/.github/workflows/buildExecuteCustom-B.yaml index 3023ffb2..517d138b 100644 --- a/.github/workflows/buildExecuteCustom-B.yaml +++ b/.github/workflows/buildExecuteCustom-B.yaml @@ -65,9 +65,10 @@ jobs: lastRC="$(./scripts/lastVersionRC.sc)" lastStable=$(./scripts/lastVersionStable.sc) - scala-cli scripts/raport-regressions.scala scripts/md_printer.scala -- $scalaVersion > raport-full.md - scala-cli scripts/raport-regressions.scala scripts/md_printer.scala -- $scalaVersion --compareWith=$lastRC > raport-compare-$lastRC.md - scala-cli scripts/raport-regressions.scala scripts/md_printer.scala -- $scalaVersion --compareWith=$lastStable > raport-compare-$lastStable.md + FOR_HTML=1 scala-cli scripts/raport-regressions.scala -- $scalaVersion > rendered.raport-full.md + scala-cli scripts/raport-regressions.scala -- $scalaVersion > raport-full.md + scala-cli scripts/raport-regressions.scala -- $scalaVersion --compareWith=$lastRC > raport-compare-$lastRC.md + scala-cli scripts/raport-regressions.scala -- $scalaVersion --compareWith=$lastStable > raport-compare-$lastStable.md - name: Upload raports uses: actions/upload-artifact@v3 @@ -87,6 +88,6 @@ jobs: uses: ./.github/actions/push-raport-to-gh-pages with: artifact-name: build-raports - file-to-pick: raport-full.md + file-to-pick: rendered.raport-full.md build-title: ${{ needs.execute-build-plan.outputs.used-scala-version }} token: ${{ steps.generate-token.outputs.token }} diff --git a/.github/workflows/buildExecuteScheduledWeekly-A.yaml b/.github/workflows/buildExecuteScheduledWeekly-A.yaml index 38113169..4603858c 100644 --- a/.github/workflows/buildExecuteScheduledWeekly-A.yaml +++ b/.github/workflows/buildExecuteScheduledWeekly-A.yaml @@ -75,15 +75,17 @@ jobs: lastRC="$(./scripts/lastVersionRC.sc)" lastStable=$(./scripts/lastVersionStable.sc) - scala-cli scripts/raport-regressions.scala scripts/md_printer.scala -- $scalaVersion > raport-full.md - scala-cli scripts/raport-regressions.scala scripts/md_printer.scala -- $scalaVersion --compareWith=$lastRC > raport-compare-$lastRC.md - scala-cli scripts/raport-regressions.scala scripts/md_printer.scala -- $scalaVersion --compareWith=$lastStable > raport-compare-$lastStable.md + FOR_HTML=1 scala-cli scripts/raport-regressions.scala -- $scalaVersion > rendered.raport-full.md + scala-cli scripts/raport-regressions.scala -- $scalaVersion > raport-full.md + scala-cli scripts/raport-regressions.scala -- $scalaVersion --compareWith=$lastRC > raport-compare-$lastRC.md + scala-cli scripts/raport-regressions.scala -- $scalaVersion --compareWith=$lastStable > raport-compare-$lastStable.md lastWeeklyVersionFile=./last-successfull-weekly-version if [[ -f "$lastWeeklyVersionFile" ]]; then lastWeeklyVersion=$(cat $lastWeeklyVersionFile) - echo "Comparing with last foundly weekly version: ${lastWeeklyVersion}" - scala-cli scripts/raport-regressions.scala scripts/md_printer.scala -- $scalaVersion --compareWith=$lastWeeklyVersion > raport-compare-$lastWeeklyVersion.md + echo "Comparing with last found weekly version: ${lastWeeklyVersion}" + scala-cli scripts/raport-regressions.scala -- $scalaVersion --compareWith=$lastWeeklyVersion > raport-compare-$lastWeeklyVersion.md + scala-cli scripts/compareVersions.scala -- $scalaVersion $lastWeeklyVersion > raport-cmp-$lastWeeklyVersion.md else echo "Not found previous weekly build version." fi @@ -105,6 +107,6 @@ jobs: uses: ./.github/actions/push-raport-to-gh-pages with: artifact-name: build-raports - file-to-pick: raport-full.md + file-to-pick: rendered.raport-full.md build-title: ${{ needs.execute-build-plan.outputs.used-scala-version }} token: ${{ steps.generate-token.outputs.token }} diff --git a/.github/workflows/buildExecuteScheduledWeekly-B.yaml b/.github/workflows/buildExecuteScheduledWeekly-B.yaml index 4cb23970..d3d73708 100644 --- a/.github/workflows/buildExecuteScheduledWeekly-B.yaml +++ b/.github/workflows/buildExecuteScheduledWeekly-B.yaml @@ -75,15 +75,17 @@ jobs: lastRC="$(./scripts/lastVersionRC.sc)" lastStable=$(./scripts/lastVersionStable.sc) - scala-cli scripts/raport-regressions.scala scripts/md_printer.scala -- $scalaVersion > raport-full.md - scala-cli scripts/raport-regressions.scala scripts/md_printer.scala -- $scalaVersion --compareWith=$lastRC > raport-compare-$lastRC.md - scala-cli scripts/raport-regressions.scala scripts/md_printer.scala -- $scalaVersion --compareWith=$lastStable > raport-compare-$lastStable.md + FOR_HTML=1 scala-cli scripts/raport-regressions.scala -- $scalaVersion > rendered.raport-full.md + scala-cli scripts/raport-regressions.scala -- $scalaVersion > raport-full.md + scala-cli scripts/raport-regressions.scala -- $scalaVersion --compareWith=$lastRC > raport-compare-$lastRC.md + scala-cli scripts/raport-regressions.scala -- $scalaVersion --compareWith=$lastStable > raport-compare-$lastStable.md lastWeeklyVersionFile=./last-successfull-weekly-version if [[ -f "$lastWeeklyVersionFile" ]]; then lastWeeklyVersion=$(cat $lastWeeklyVersionFile) - echo "Comparing with last foundly weekly version: ${lastWeeklyVersion}" - scala-cli scripts/raport-regressions.scala scripts/md_printer.scala -- $scalaVersion --compareWith=$lastWeeklyVersion > raport-compare-$lastWeeklyVersion.md + echo "Comparing with last found weekly version: ${lastWeeklyVersion}" + scala-cli scripts/raport-regressions.scala -- $scalaVersion --compareWith=$lastWeeklyVersion > raport-compare-$lastWeeklyVersion.md + scala-cli scripts/compareVersions.scala -- $scalaVersion $lastWeeklyVersion > raport-cmp-$lastWeeklyVersion.md else echo "Not found previous weekly build version." fi @@ -105,6 +107,6 @@ jobs: uses: ./.github/actions/push-raport-to-gh-pages with: artifact-name: build-raports - file-to-pick: raport-full.md + file-to-pick: rendered.raport-full.md build-title: ${{ needs.execute-build-plan.outputs.used-scala-version }} token: ${{ steps.generate-token.outputs.token }} diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 9acb2b37..199c3c32 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -29,26 +29,3 @@ jobs: - name: Test build run: scripts/test-build.sh - test-cli: - runs-on: ubuntu-22.04 - steps: - - name: Git Checkout - uses: actions/checkout@v3 - - - uses: coursier/setup-action@v1 - with: - apps: scala sbt mill:0.11.5 scala-cli:1.0.4 - - - name: Start minikube - run: minikube start - - - name: Build up base docker images - env: - BUILD_ONLY_DEFAULT_JDK: true - run: | - eval $(minikube -p minikube docker-env) - scripts/build-all.sh test - - - name: Test CLI - run: scripts/test-cli.sh - diff --git a/.github/workflows/compare.yaml b/.github/workflows/compare.yaml index 17975764..703e64d4 100644 --- a/.github/workflows/compare.yaml +++ b/.github/workflows/compare.yaml @@ -45,7 +45,7 @@ jobs: ES_USER: ${{ secrets.OPENCB_ELASTIC_USER }} ES_PASSWORD: ${{ secrets.OPENCB_ELASTIC_PSWD }} run: | - scala-cli scripts/raport-regressions.scala scripts/console_printer.scala -- \ + scala-cli scripts/raport-regressions.scala -- \ ${{ inputs.scala-version }} \ --compareWith=${{ inputs.compare-with-scala-version }} \ --buildId=${{ inputs.build-id }} \ @@ -58,7 +58,7 @@ jobs: ES_PASSWORD: ${{ secrets.OPENCB_ELASTIC_PSWD }} run: | scalaVersion=${{ inputs.scala-version }} - scala-cli scripts/raport-regressions.scala scripts/md_printer.scala -- $scalaVersion > raport-full.md + FOR_HTML=1 scala-cli scripts/raport-regressions.scala -- $scalaVersion > raport-full.md - name: Upload raports uses: actions/upload-artifact@v3 diff --git a/scripts/console_printer.scala b/scripts/console_printer.scala deleted file mode 100644 index 781ec2f3..00000000 --- a/scripts/console_printer.scala +++ /dev/null @@ -1,18 +0,0 @@ -object Printer { - import scala.Console - val RED = Console.RED - val YELLOW = Console.YELLOW - val MAGENTA = Console.MAGENTA - val RESET = Console.RESET - val BOLD = Console.BOLD - val LINE_BREAK = "" - - def println(text: String): Unit = Predef.println(text) - def log(text: String) = Predef.println(text) - def printLine() = println("-" * 20) - def projectUrlString(projectName: String, version: String, buildUrl: String): String = { - val projectVerString = if version.isEmpty then projectName else s"$projectName @ $version" - - if buildUrl.isEmpty then projectVerString else s"$projectVerString - $buildUrl" - } -} diff --git a/scripts/md_printer.scala b/scripts/md_printer.scala deleted file mode 100644 index 4d233eff..00000000 --- a/scripts/md_printer.scala +++ /dev/null @@ -1,19 +0,0 @@ -object Printer { - val RED = """""" - val YELLOW = """""" - val MAGENTA = """""" - val RESET = """""" - val BOLD = """""" - val LINE_BREAK = "
" - - def println(text: String): Unit = Predef.println(s"$text") - def log(text: String) = () - def printLine() = println("
") - - /** make project name be a clickable link to the build */ - def projectUrlString(projectName: String, version: String, buildUrl: String): String = { - val projectVerString = if version.isEmpty then projectName else s"$projectName @ $version" - - if buildUrl.isEmpty then projectVerString else s"[$projectVerString]($buildUrl)" - } -} diff --git a/scripts/raport-regressions.scala b/scripts/raport-regressions.scala index 5fff0d5b..63ca4982 100755 --- a/scripts/raport-regressions.scala +++ b/scripts/raport-regressions.scala @@ -20,7 +20,10 @@ import scala.concurrent.duration.* import org.elasticsearch.client.RestClient import org.apache.http.HttpHost -import Printer.{println, *} +val printer: Printer = + if sys.env.contains("FOR_HTML") then Printer.HTMLCompatPrinter + else Printer.StandardPrinter +import printer.{println, *} given ExecutionContext = ExecutionContext.global @@ -266,7 +269,7 @@ def listFailedProjects( val name = label.padTo(8, " ").mkString val ver = projectVersions(project) println( - s"$color$name${RESET} failure in ${BOLD}${Printer + s"$color$name${RESET} failure in ${BOLD}${printer .projectUrlString(project.name, ver, buildURL)}$LINE_BREAK" ) val compilerFailure = summary.compilerFailure @@ -533,3 +536,59 @@ def isVersionNewerThen(version: String, reference: String) = end isVersionNewerThen def isVersionNewerOrEqualThen(version: String, reference: String) = version == reference || isVersionNewerThen(version, reference) + + +sealed trait Printer{ + import scala.Console + def RED: String + def YELLOW: String + def MAGENTA: String + def RESET :String + def BOLD :String + def LINE_BREAK : String + + def println(text: String): Unit + def printLine(): Unit + def log(text: String): Unit + def showUrl(url: String, text: String): String + + final def projectUrlString(projectName: String, version: String, buildUrl: String): String = { + val projectVerString = if version.isEmpty then projectName else s"$projectName @ $version" + if buildUrl.isEmpty then projectVerString + else showUrl(buildUrl, projectVerString) + } +} + +object Printer{ + object StandardPrinter extends Printer{ + import scala.Console + override val RED = Console.RED + override val YELLOW = Console.YELLOW + override val MAGENTA = Console.MAGENTA + override val RESET = Console.RESET + override val BOLD = Console.BOLD + override val LINE_BREAK = "" + + override def println(text: String): Unit = Predef.println(text) + override def log(text: String) = Predef.println(text) + override def printLine() = println("-" * 20) + override def showUrl(url: String, text: String): String = + s"$text - $url" + } + + + object HTMLCompatPrinter extends Printer{ + override val RED = """""" + override val YELLOW = """""" + override val MAGENTA = """""" + override val RESET = """""" + override val BOLD = """""" + override val LINE_BREAK = "
" + + override def println(text: String): Unit = Predef.println(s"$text") + override def log(text: String) = System.err.println(s"$text") + override def printLine() = println("
") + override def showUrl(url: String, text: String): String= + s"""$text""" + } +} \ No newline at end of file