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

added and tested assembly #14

Merged
merged 3 commits into from
Apr 28, 2021
Merged

Conversation

MeerKatDev
Copy link
Contributor

As discussed in #13 , to optimize the speed, the building time should be cut off completely for it to run in a decent amount of time (only the build takes 40-50 seconds).

I added sbt-assembly and successfully generated a far jar that contains all the dependencies needed. It can be run in place of sbt compile + sbt run, so instead of compiling the test-runner for every run, the assembly can run as a standalone executable with:

java -jar target/scala-2.13/TestRunner-assembly-0.1.0-SNAPSHOT.jar <arg1> <arg2> ...

Now I'm not sure how to change all those shell files (and the Dockerfile), also because there's no need to move the project files anymore. I tried to change run.sh accordingly, but I cannot understand how that all has to work :/

@iHiD
Copy link
Member

iHiD commented Apr 23, 2021

Thanks @MeerKatDev :) Erik is off for a few days but will check it when he's back!

build.sbt Outdated
@@ -1,6 +1,6 @@
import Dependencies._

ThisBuild / scalaVersion := "2.12.8"
ThisBuild / scalaVersion := "2.13.5"
Copy link
Member

Choose a reason for hiding this comment

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

This needs to be the same version the exercises use, so I've reverted this.

@@ -1,5 +1,5 @@
import sbt._

object Dependencies {
lazy val scalaTest = "org.scalatest" %% "scalatest" % "3.0.1"
lazy val scalaTest = "org.scalatest" %% "scalatest" % "3.0.8"
Copy link
Member

Choose a reason for hiding this comment

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

This needs to be the same version the exercises use, so I've reverted this.

@ErikSchierboom ErikSchierboom marked this pull request as ready for review April 28, 2021 08:05
@ErikSchierboom ErikSchierboom requested a review from a team as a code owner April 28, 2021 08:05
@ErikSchierboom ErikSchierboom force-pushed the use_assembly_to_produce_binary branch from 7a1ccf3 to 44b544f Compare April 28, 2021 08:07
@@ -5,7 +5,8 @@ WORKDIR /opt/test-runner
COPY project/ project/
COPY src/ src/
COPY build.sbt build.sbt
RUN sbt compile
RUN sbt assembly
Copy link
Member

Choose a reason for hiding this comment

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

This needed to be changed to actually build the jar

Dockerfile Outdated
@@ -5,7 +5,8 @@ WORKDIR /opt/test-runner
COPY project/ project/
COPY src/ src/
COPY build.sbt build.sbt
RUN sbt compile
RUN sbt assembly
RUN chmod +x target/scala-2.12/TestRunner-assembly-0.1.0-SNAPSHOT.jar
Copy link
Member

Choose a reason for hiding this comment

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

Set executable permissions to allow running the jar

Copy link
Contributor Author

Choose a reason for hiding this comment

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

the intention of the PR was not this. The meaning of using an assembled fat jar is to deploy it together with the test-runner and use that as an executable to run the uploaded exercises, not to generate it upon running the test-runner, because we'd be back to point one.

Copy link
Member

Choose a reason for hiding this comment

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

But we're not doing that. Were building the executable in the Dockerfile, which is only done when the test runner is deployed. For each test run, we're using the compiled test runner (see https://github.com/exercism/scala-test-runner/pull/14/files#diff-00a80c5821edea2ebf676056aa4c9a24e57379ef52cefecb2ccffaaf4cc362c9R57). The code in the Dockerfile is not executed.

@ErikSchierboom
Copy link
Member

ErikSchierboom commented Apr 28, 2021

@MeerKatDev I've updated the PR to use the pre-compiled binary. I'll merge this and then hopefully we're back to a sane execution time again. Thanks for the help!

@ErikSchierboom ErikSchierboom merged commit d380b95 into main Apr 28, 2021
@ErikSchierboom ErikSchierboom deleted the use_assembly_to_produce_binary branch April 28, 2021 08:12
@ErikSchierboom ErikSchierboom mentioned this pull request Apr 28, 2021
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.

3 participants