Skip to content
This repository was archived by the owner on Mar 27, 2025. It is now read-only.

Commit 8f496dc

Browse files
authored
Update CMT plugin code (#61)
* Update CMT plugin code - Add git config before running tests - Add CMT/bin to PATH on github actions * Update github actions config
1 parent 78f7dbc commit 8f496dc

File tree

3 files changed

+16
-8
lines changed

3 files changed

+16
-8
lines changed

.github/workflows/ci.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,11 +51,14 @@ jobs:
5151
5252
- name: Generate Tests Script using CMT
5353
run: |
54+
git config --global user.email "[email protected]"
55+
git config --global user.name "Lunatech Labs"
5456
(cd CMT/ && exec sbt "mainadm -dot -t ../runTests $GITHUB_WORKSPACE/course-repo")
5557
5658
- name: Run Tests
5759
run: |
5860
chmod +x runTests
61+
export PATH=${PATH}:$GITHUB_WORKSPACE/CMT/bin
5962
./runTests
6063
6164
create_release:
@@ -104,6 +107,7 @@ jobs:
104107
- name: Studentify Repo
105108
run: |
106109
mkdir -p studentified
110+
export PATH=${PATH}:$GITHUB_WORKSPACE/CMT/bin
107111
git config --global user.email "[email protected]"
108112
git config --global user.name "Lunatech Labs"
109113
(cd CMT/ && exec sbt "studentify -dot -g ../lunatech-scala-2-to-scala3-course ../studentified")

exercises/project/CommonSettings.scala

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ import sbt.Keys._
2222
import sbt._
2323
import sbtstudent.AdditionalSettings
2424
import dotty.tools.sbtplugin.DottyPlugin.autoImport.DottyCompatModuleID
25+
import sbtstudent.StudentCommandsPlugin._
2526

2627

2728
object CommonSettings {
@@ -41,7 +42,8 @@ object CommonSettings {
4142
publishArtifact in packageDoc := false,
4243
libraryDependencies ++= Dependencies.dependencies,
4344
libraryDependencies ++= Dependencies.crossDependencies.map(_.withDottyCompat(scalaVersion.value)),
44-
testFrameworks += new TestFramework("munit.Framework")
45+
testFrameworks += new TestFramework("munit.Framework"),
46+
shellPrompt := (state => renderCMTPrompt(state))
4547
) ++
4648
AdditionalSettings.initialCmdsConsole ++
4749
AdditionalSettings.initialCmdsTestConsole ++

exercises/project/StudentCommandsPlugin.scala

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -55,13 +55,15 @@ object StudentCommandsPlugin extends AutoPlugin {
5555
IO.readLines(new sbt.File(new sbt.File(Project.extract(state).structure.root), ".courseName")).head
5656
}
5757

58-
override lazy val projectSettings: Seq[Def.Setting[State => String]] =
58+
def renderCMTPrompt(state: State) = {
59+
val exercise = Console.GREEN + extractCurrentExerciseDesc(state) + Console.RESET
60+
val manRmnd = Console.GREEN + "man [e]" + Console.RESET
61+
val prjNbrNme = extractProjectName(state)
62+
s"$manRmnd > $prjNbrNme > $exercise > "
63+
}
64+
65+
override def projectSettings: Seq[Def.Setting[State => String]] =
5966
Seq(
60-
shellPrompt := { state =>
61-
val exercise = Console.GREEN + extractCurrentExerciseDesc(state) + Console.RESET
62-
val manRmnd = Console.GREEN + "man [e]" + Console.RESET
63-
val prjNbrNme = extractProjectName(state)
64-
s"$manRmnd > $prjNbrNme > $exercise > "
65-
}
67+
shellPrompt := { state => renderCMTPrompt(state)}
6668
)
6769
}

0 commit comments

Comments
 (0)