From eb0e58dda340125296b9a217e92144b8d80b2c25 Mon Sep 17 00:00:00 2001 From: philwalk Date: Wed, 21 Feb 2024 16:53:04 -0700 Subject: [PATCH 1/8] release v0.10.8 -- update version references --- .github/workflows/scala.yml | 4 +- README.md | 10 +- build.sbt | 9 +- jsrc/bashPath.sc | 2 +- jsrc/bashPathCli.sc | 2 +- jsrc/fstabCli.sc | 2 +- jsrc/palletRef.sc | 2 +- jsrc/palletRefCli.sc | 2 +- jsrc/sbt2cs.sc | 6 +- jsrc/unameGreeting.sc | 2 +- src/main/scala/vastblue/time/TimeDate.scala | 229 +++++++++--------- .../scala/vastblue/file/PathnameTest.scala | 5 +- 12 files changed, 138 insertions(+), 137 deletions(-) diff --git a/.github/workflows/scala.yml b/.github/workflows/scala.yml index 5421082..e8f735a 100644 --- a/.github/workflows/scala.yml +++ b/.github/workflows/scala.yml @@ -30,5 +30,5 @@ jobs: - name: Run tests run: sbt test # Optional: This step uploads information to the GitHub dependency graph and unblocking Dependabot alerts for the repository -# - name: Upload dependency graph -# uses: scalacenter/sbt-dependency-submission@ab086b50c947c9774b70f39fc7f6e20ca2706c91 + - name: Upload dependency graph + uses: scalacenter/sbt-dependency-submission@ab086b50c947c9774b70f39fc7f6e20ca2706c91 diff --git a/README.md b/README.md index 5f078ab..81832be 100644 --- a/README.md +++ b/README.md @@ -22,7 +22,7 @@ Provides support for expressive idioms typical of scripting languages, for writi To use `pallet` in an `SBT` project, add this dependency to `build.sbt` ```sbt - "org.vastblue" % "pallet_3" % "0.10.6" + "org.vastblue" % "pallet_3" % "0.10.8" ``` For `scala` or `scala-cli` scripts, see examples below. @@ -35,7 +35,7 @@ Simplicity and Universal Portability: ```scala #!/usr/bin/env -S scala-cli shebang -//> using lib "org.vastblue::pallet::0.10.6" +//> using lib "org.vastblue::pallet::0.10.8" import vastblue.pallet.* printf("uname / osType / osName:\n%s\n", s"platform info: ${unameLong} / ${osType} / ${osName}") @@ -226,7 +226,7 @@ Some differences to be aware of between `scala-cli` scripts and conventional `sc For a per-user classpath `atFile`, define your classpath in a file named, e.g., `/Users/username/.scala3cp`. To include the `scala3` version of this library, for example, the `@file` might contain: ``` --classpath /Users/username/.ivy2/local/org.vastblue/pallet_3/0.10.6/jars/pallet_3.jar +-classpath /Users/username/.ivy2/local/org.vastblue/pallet_3/0.10.8/jars/pallet_3.jar ``` With this configuration, your scala 3 `shebang` line will look like this: ```scala @@ -265,7 +265,7 @@ object Fstab { #!/ usr / bin / env -S scala -cli shebang //> using scala "3.3.1" -//> using lib "org.vastblue::pallet::0.10.6" +//> using lib "org.vastblue::pallet::0.10.8" import vastblue.pallet.* import vastblue.Platform.* @@ -297,7 +297,7 @@ Note that on Darwin, there is no `/etc/fstab` file, so the `Path#lines` extensio #!/usr/bin/env -S scala-cli shebang //> using scala "3.3.1" -//> using lib "org.vastblue::pallet::0.10.6" +//> using lib "org.vastblue::pallet::0.10.8" import vastblue.pallet.* diff --git a/build.sbt b/build.sbt index c11ee68..0165f8f 100644 --- a/build.sbt +++ b/build.sbt @@ -9,7 +9,7 @@ javacOptions ++= Seq("-source", "11", "-target", "11") //ThisBuild / envFileName := "dev.env" // sbt-dotenv plugin gets build environment here ThisBuild / scalaVersion := scalaVer -ThisBuild / version := "0.10.6" +ThisBuild / version := "0.10.8" ThisBuild / versionScheme := Some("semver-spec") ThisBuild / organization := "org.vastblue" @@ -68,13 +68,12 @@ lazy val root = (project in file(".")). ) libraryDependencies ++= Seq( - "org.simpleflatmapper" % "sfm-csv-jre6" % "8.2.3", + "org.simpleflatmapper" % "sfm-csv" % "8.2.3", "com.github.sbt" % "junit-interface" % "0.13.3" % Test, "org.scalatest" %% "scalatest" % "3.2.17" % Test, - "org.scalacheck" %% "scalacheck" % "1.17.0" % Test, "io.github.chronoscala" %% "chronoscala" % "2.0.10", - "org.vastblue" % "unifile_3" % "0.3.0", - "com.github.sisyphsu" % "dateparser" % "1.0.11", + "org.vastblue" % "unifile_3" % "0.3.1", +//"com.github.sisyphsu" % "dateparser" % "1.0.11", ) /* diff --git a/jsrc/bashPath.sc b/jsrc/bashPath.sc index bb5132c..a7b0225 100755 --- a/jsrc/bashPath.sc +++ b/jsrc/bashPath.sc @@ -2,7 +2,7 @@ //package vastblue.demo //> using scala "3.3.1" -//> using lib "org.vastblue::pallet::0.10.7" +//> using lib "org.vastblue::pallet::0.10.8" import vastblue.pallet.* diff --git a/jsrc/bashPathCli.sc b/jsrc/bashPathCli.sc index 6687f22..0f25ff9 100755 --- a/jsrc/bashPathCli.sc +++ b/jsrc/bashPathCli.sc @@ -1,7 +1,7 @@ #!/usr/bin/env -S scala-cli shebang //> using scala "3.3.1" -//> using lib "org.vastblue::pallet::0.10.7" +//> using lib "org.vastblue::pallet::0.10.8" import vastblue.pallet.* diff --git a/jsrc/fstabCli.sc b/jsrc/fstabCli.sc index dcac9b1..e89a2b0 100755 --- a/jsrc/fstabCli.sc +++ b/jsrc/fstabCli.sc @@ -2,7 +2,7 @@ //> using scala "3.3.1" //> using lib "org.vastblue::unifile::0.3.1" -//> using lib "org.vastblue::pallet::0.10.7" +//> using lib "org.vastblue::pallet::0.10.8" //import vastblue.pallet.* import vastblue.unifile.* diff --git a/jsrc/palletRef.sc b/jsrc/palletRef.sc index 08a7a76..91b5f42 100755 --- a/jsrc/palletRef.sc +++ b/jsrc/palletRef.sc @@ -1,7 +1,7 @@ #!/usr/bin/env -S scala-cli shebang //> using scala "3.3.1" -//> using lib "org.vastblue::pallet::0.10.7" +//> using lib "org.vastblue::pallet::0.10.8" import vastblue.pallet._ diff --git a/jsrc/palletRefCli.sc b/jsrc/palletRefCli.sc index 061bcab..2c29be4 100755 --- a/jsrc/palletRefCli.sc +++ b/jsrc/palletRefCli.sc @@ -1,7 +1,7 @@ #!/usr/bin/env -S scala-cli shebang //> using scala "3.3.1" -//> using lib "org.vastblue::pallet::0.10.7" +//> using lib "org.vastblue::pallet::0.10.8" import vastblue.pallet.* diff --git a/jsrc/sbt2cs.sc b/jsrc/sbt2cs.sc index 1ade88d..308004a 100644 --- a/jsrc/sbt2cs.sc +++ b/jsrc/sbt2cs.sc @@ -12,7 +12,7 @@ import vastblue.unifile.* * * from: * org.vastblue %% unifile % 0.3.1 - * org.vastblue %% pallet % 0.10.7 + * org.vastblue %% pallet % 0.10.8 * org.scalanlp %% breeze-viz % 2.1.0 * org.scalanlp %% breeze % 2.1.0 * org.scala-lang.modules %% scala-xml % 2.2.0 @@ -23,7 +23,7 @@ import vastblue.unifile.* * com.github.darrenjw %% scala-glm % 0.8 * * to: - * //> using dep "org.vastblue::pallet::0.10.7" + * //> using dep "org.vastblue::pallet::0.10.8" * //> using dep "org.vastblue::unifile::0.3.1" * //> using dep "org.scalanlp::breeze-viz::2.1.0" * //> using dep "org.scalanlp::breeze::2.1.0" @@ -86,7 +86,7 @@ com.github.darrenjw %% scala-glm % 0.8 org.scala-lang.modules %% scala-swing % 3.0.0 net.ruippeixotog %% scala-scraper % 3.1.1 org.vastblue %% unifile % 0.3.1 -org.vastblue %% pallet % 0.10.7 +org.vastblue %% pallet % 0.10.8 """.trim.split("[\r\n]+").toList.filter { _.nonEmpty } def parseArgs(args: Seq[String]): Unit = { diff --git a/jsrc/unameGreeting.sc b/jsrc/unameGreeting.sc index 0c2cbf0..8633aa3 100644 --- a/jsrc/unameGreeting.sc +++ b/jsrc/unameGreeting.sc @@ -1,7 +1,7 @@ #!/usr/bin/env -S scala //> using scala "3.3.1" -//> using lib "org.vastblue::pallet::0.10.7" +//> using lib "org.vastblue::pallet::0.10.8" import vastblue.pallet.* diff --git a/src/main/scala/vastblue/time/TimeDate.scala b/src/main/scala/vastblue/time/TimeDate.scala index aa1fe22..0c33abf 100644 --- a/src/main/scala/vastblue/time/TimeDate.scala +++ b/src/main/scala/vastblue/time/TimeDate.scala @@ -1,14 +1,12 @@ package vastblue.time import vastblue.pallet.* -//import vastblue.time.TimeParser -import vastblue.time.ChronoParse import java.time.ZoneId import java.time.format.* import io.github.chronoscala.Imports.* -import java.time.temporal.{ChronoField, TemporalAdjuster, TemporalAdjusters} +import java.time.temporal.{TemporalAdjuster, TemporalAdjusters} import scala.util.matching.Regex object TimeDate extends vastblue.time.TimeExtensions { @@ -29,12 +27,6 @@ object TimeDate extends vastblue.time.TimeExtensions { } lazy val NullDate: LocalDateTime = DateTime.parse("0000-01-01T00:00:00") // .ofInstant(Instant.ofEpochMilli(0)) - // Patterns permit but don't require time fields - // Used to parse both date and time from column 1. - // Permits but does not require column to be double-quoted. - lazy val YMDColumnPattern: Regex = """[^#\d]?(2\d{3})[-/](\d{1,2})[-/](\d{1,2})(.*)""".r - lazy val MDYColumnPattern: Regex = """[^#\d]?(\d{1,2})[-/](\d{1,2})[-/](2\d{3})(.*)""".r - lazy val standardTimestampFormat = datetimeFmt6 lazy val datetimeFmt9 = "yyyy-MM-dd HH:mm:ss [-+][0-9]{4}" @@ -59,9 +51,9 @@ object TimeDate extends vastblue.time.TimeExtensions { lazy val datetimeFormatter5: DateTimeFormatter = dateTimeFormatPattern(datetimeFmt5) lazy val datetimeFormatter5b: DateTimeFormatter = dateTimeFormatPattern(datetimeFmt5b) lazy val dateonlyFormatter: DateTimeFormatter = dateTimeFormatPattern(dateonlyFmt) - lazy val dateonlyFormatterB: DateTimeFormatter = dateTimeFormatPattern(dateonlyFmtB) - - lazy val EasternTime: ZoneId = java.time.ZoneId.of("America/New_York") +// lazy val dateonlyFormatterB: DateTimeFormatter = dateTimeFormatPattern(dateonlyFmtB) +// +// lazy val EasternTime: ZoneId = java.time.ZoneId.of("America/New_York") lazy val MountainTime: ZoneId = java.time.ZoneId.of("America/Denver") lazy val UTC: ZoneId = java.time.ZoneId.of("UTC") @@ -97,6 +89,7 @@ object TimeDate extends vastblue.time.TimeExtensions { } elapsedDays } + // private var hook = 0 def secondsBetween(idate1: DateTime, idate2: DateTime): Long = { // val d2d = idate1 to idate2 // new RichDuration(duration) @@ -252,106 +245,106 @@ object TimeDate extends vastblue.time.TimeExtensions { } } } - private[vastblue] def _dateParser(inpDateStr: String, offset: Int = 0): DateTime = { - if (inpDateStr.startsWith("31/05/2009")) { - hook += 1 - } - if (inpDateStr.contains("-07")) { - hook += 1 - } - val _datestr = inpDateStr.trim.replaceAll("\"", "").replaceAll(" [-+][0-9]{4}$", "") - val zonestr: String = inpDateStr.drop(_datestr.length) - if (_datestr.isEmpty) { - BadDate - } else { - // val ff = _datestr.split("\\D+") - // first, deal with things like "12/31/21" and "22/5/5" (year has 2 digits) - _datestr match { - case ThreeIntegerFields1(_y, _m, _d) => - if (_y.length > 2) { - val (y, m, d) = (_y.toInt, _m.toInt, _d.toInt) - new RichString("%4d-%02d-%02d".format(y, m, d)).toDateTime - } else { - val nums = List(_y, _m, _d).map { _.toInt } - val possibleDays = nums.zipWithIndex.filter { case (n, i) => n <= 31 } - val possibleMonths = nums.zipWithIndex.filter { case (n, i) => n <= 12 } - val (y, m, d) = possibleMonths match { - case (n, 0) :: list => (nums(2), nums(0), nums(1)) // m/d/y - case (n, 1) :: list => (nums(2), nums(1), nums(0)) // d/m/y - case _ => - possibleDays match { - case (n, 0) :: list => (nums(2), nums(1), nums(0)) // d/m/y - case _ => (nums(2), nums(0), nums(1)) // m/d/y - } - } - val year = if (y >= 1000) y else y + 2000 - new RichString("%4d-%02d-%02d".format(year, m, d)).toDateTime - } - case ThreeIntegerFields3(_m, _d, _y) => - val (y, m, d) = (_y.toInt, _m.toInt, _d.toInt) - val year = if (y >= 1000) y else y + 2000 - new RichString("%4d-%02d-%02d".format(year, m, d)).toDateTime - case ThreeIntegerFields2(_x, _y, _z) => - val nums = List(_x, _y, _z).map { _.toInt } - val possibleDays = nums.zipWithIndex.filter { case (n, i) => n <= 31 } - val possibleMonths = nums.zipWithIndex.filter { case (n, i) => n <= 12 } - val List(y, m, d) = nums - val year = if (y >= 1000) y else y + 2000 - new RichString("%4d-%02d-%02d".format(year, m, d)).toDateTime - case _ => - // next, treat yyyyMMdd (8 digits, no field separators) - if (_datestr.matches("""2\d{7}""")) { - new RichString(_datestr.replaceAll("(....)(..)(..)", "$1-$2-$3")).toDateTime - } else if (_datestr.matches("""\d{2}\D\d{2}\D\d{2}""")) { - // MM-dd-yy - val fixed = _datestr.split("\\D").toList match { - case m :: d :: y :: Nil => - "%04d-%02d-%02d 00:00:00".format(2000 + y.toInt, m.toInt, d.toInt) - case _ => - _datestr // no fix - } - // printf("%s\n", datetimeFormatter.getClass) - // datetimeFormatter6.parse(fixed) - DateTime.parse(fixed, datetimeFormatter6) - } else if (_datestr.matches("""2\d{3}\D\d{2}\D\d{2}\.\d{4}""")) { - // yyyy-MM-dd.HHMM - val fixed = _datestr.replaceAll("""(....)\D(..)\D(..)\.(\d\d)(\d\d)""", "$1-$2-$3 $4:$5:00") - DateTime.parse(fixed, datetimeFormatter6) - } else { - val datestr = _datestr.replaceAll("/", "-") - try { - val fixed = _datestr. - replaceAll(" [-+][0-9]{4}$", ""). - replaceAll("([0-9])([A-Z])", "$1 $2"). - replaceAll("([a-z])([0-9])", "$1 $2") - parseDateString(fixed) - } catch { - case r: RuntimeException if r.getMessage.toLowerCase.contains("bad date format") => -// if (TimeParser.debug) System.err.printf("e[%s]\n", r.getMessage) - BadDate - case p: DateTimeParseException => -// if (TimeParser.debug) System.err.printf("e[%s]\n", p.getMessage) - BadDate - case e: Exception => -// if (TimeParser.debug) System.err.printf("e[%s]\n", e.getMessage) - BadDate -/* - val mdate: TimeParser = TimeParser.parseDate(datestr).getOrElse(TimeParser.BadParsDate) - // val timestamp = new DateTime(mdate.getEpoch) - val standardFormat = mdate.toString(standardTimestampFormat) - val timestamp = standardFormat.toDateTime - val hour = timestamp.getHour // hourOfDay.get - // format: off - val extraHours = if (datestr.contains(" PM") && hour < 12) { 12 } else { 0 } - val hours = (offset + extraHours).toLong - timestamp.plusHours(hours) - // format: on - */ - } - } - } - } - } +// private[vastblue] def _dateParser(inpDateStr: String, offset: Int = 0): DateTime = { +// if (inpDateStr.startsWith("31/05/2009")) { +// hook += 1 +// } +// if (inpDateStr.contains("-07")) { +// hook += 1 +// } +// val _datestr = inpDateStr.trim.replaceAll("\"", "").replaceAll(" [-+][0-9]{4}$", "") +// val zonestr: String = inpDateStr.drop(_datestr.length) +// if (_datestr.isEmpty) { +// BadDate +// } else { +// // val ff = _datestr.split("\\D+") +// // first, deal with things like "12/31/21" and "22/5/5" (year has 2 digits) +// _datestr match { +// case ThreeIntegerFields1(_y, _m, _d) => +// if (_y.length > 2) { +// val (y, m, d) = (_y.toInt, _m.toInt, _d.toInt) +// new RichString("%4d-%02d-%02d".format(y, m, d)).toDateTime +// } else { +// val nums = List(_y, _m, _d).map { _.toInt } +// val possibleDays = nums.zipWithIndex.filter { case (n, i) => n <= 31 } +// val possibleMonths = nums.zipWithIndex.filter { case (n, i) => n <= 12 } +// val (y, m, d) = possibleMonths match { +// case (n, 0) :: list => (nums(2), nums(0), nums(1)) // m/d/y +// case (n, 1) :: list => (nums(2), nums(1), nums(0)) // d/m/y +// case _ => +// possibleDays match { +// case (n, 0) :: list => (nums(2), nums(1), nums(0)) // d/m/y +// case _ => (nums(2), nums(0), nums(1)) // m/d/y +// } +// } +// val year = if (y >= 1000) y else y + 2000 +// new RichString("%4d-%02d-%02d".format(year, m, d)).toDateTime +// } +// case ThreeIntegerFields3(_m, _d, _y) => +// val (y, m, d) = (_y.toInt, _m.toInt, _d.toInt) +// val year = if (y >= 1000) y else y + 2000 +// new RichString("%4d-%02d-%02d".format(year, m, d)).toDateTime +// case ThreeIntegerFields2(_x, _y, _z) => +// val nums = List(_x, _y, _z).map { _.toInt } +// val possibleDays = nums.zipWithIndex.filter { case (n, i) => n <= 31 } +// val possibleMonths = nums.zipWithIndex.filter { case (n, i) => n <= 12 } +// val List(y, m, d) = nums +// val year = if (y >= 1000) y else y + 2000 +// new RichString("%4d-%02d-%02d".format(year, m, d)).toDateTime +// case _ => +// // next, treat yyyyMMdd (8 digits, no field separators) +// if (_datestr.matches("""2\d{7}""")) { +// new RichString(_datestr.replaceAll("(....)(..)(..)", "$1-$2-$3")).toDateTime +// } else if (_datestr.matches("""\d{2}\D\d{2}\D\d{2}""")) { +// // MM-dd-yy +// val fixed = _datestr.split("\\D").toList match { +// case m :: d :: y :: Nil => +// "%04d-%02d-%02d 00:00:00".format(2000 + y.toInt, m.toInt, d.toInt) +// case _ => +// _datestr // no fix +// } +// // printf("%s\n", datetimeFormatter.getClass) +// // datetimeFormatter6.parse(fixed) +// DateTime.parse(fixed, datetimeFormatter6) +// } else if (_datestr.matches("""2\d{3}\D\d{2}\D\d{2}\.\d{4}""")) { +// // yyyy-MM-dd.HHMM +// val fixed = _datestr.replaceAll("""(....)\D(..)\D(..)\.(\d\d)(\d\d)""", "$1-$2-$3 $4:$5:00") +// DateTime.parse(fixed, datetimeFormatter6) +// } else { +// val datestr = _datestr.replaceAll("/", "-") +// try { +// val fixed = _datestr. +// replaceAll(" [-+][0-9]{4}$", ""). +// replaceAll("([0-9])([A-Z])", "$1 $2"). +// replaceAll("([a-z])([0-9])", "$1 $2") +// parseDateString(fixed) +// } catch { +// case r: RuntimeException if r.getMessage.toLowerCase.contains("bad date format") => +//// if (TimeParser.debug) System.err.printf("e[%s]\n", r.getMessage) +// BadDate +// case p: DateTimeParseException => +//// if (TimeParser.debug) System.err.printf("e[%s]\n", p.getMessage) +// BadDate +// case e: Exception => +//// if (TimeParser.debug) System.err.printf("e[%s]\n", e.getMessage) +// BadDate +///* +// val mdate: TimeParser = TimeParser.parseDate(datestr).getOrElse(TimeParser.BadParsDate) +// // val timestamp = new DateTime(mdate.getEpoch) +// val standardFormat = mdate.toString(standardTimestampFormat) +// val timestamp = standardFormat.toDateTime +// val hour = timestamp.getHour // hourOfDay.get +// // format: off +// val extraHours = if (datestr.contains(" PM") && hour < 12) { 12 } else { 0 } +// val hours = (offset + extraHours).toLong +// timestamp.plusHours(hours) +// // format: on +// */ +// } +// } +// } +// } +// } def standardTime(datestr: String, offset: Int = 0): String = { dateParser(datestr, offset).toString(standardTimestampFormat) @@ -593,4 +586,16 @@ object TimeDate extends vastblue.time.TimeExtensions { case EmptyDate => "" case other => other.toString(fmt) } + + object sysTimer { + var begin = System.currentTimeMillis + def reset(): Unit = { begin = System.currentTimeMillis } + def elapsed: Long = System.currentTimeMillis - begin + def elapsedMillis = elapsed + + def elapsedSeconds: Double = elapsed.toDouble / 1000.0 + def elapsedMinutes: Double = elapsed.toDouble / (60.0 * 1000.0) + def elapsedHours: Double = elapsed.toDouble / (60.0 * 60.0 * 1000.0) + def elapsedDays: Double = elapsed.toDouble / (24.0 * 60.0 * 60.0 * 1000.0) + } } diff --git a/src/test/scala/vastblue/file/PathnameTest.scala b/src/test/scala/vastblue/file/PathnameTest.scala index 0c04d8f..258a679 100644 --- a/src/test/scala/vastblue/file/PathnameTest.scala +++ b/src/test/scala/vastblue/file/PathnameTest.scala @@ -20,10 +20,7 @@ class PathnameTest extends AnyFunSpec with Matchers with BeforeAndAfter { } } val testfilenames = Seq( - s"${TMP}/_Завещание&chapter=all", - s"${TMP}/Canada's_Border.mp3" - // ,s"${TMP}/ï" - , + s"${TMP}/Canada's_Border.mp3", s"${TMP}/Canada&s_Border.mp3", s"${TMP}/Canada=s_Border.mp3", s"${TMP}/Canada!s_Border.mp3", From 37c007b35d3e75cfa0250b82bc34bfbb60ce1e1a Mon Sep 17 00:00:00 2001 From: philwalk Date: Wed, 21 Feb 2024 17:36:57 -0700 Subject: [PATCH 2/8] modify workflow --- .github/workflows/scala.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/scala.yml b/.github/workflows/scala.yml index e8f735a..c0d4669 100644 --- a/.github/workflows/scala.yml +++ b/.github/workflows/scala.yml @@ -31,4 +31,4 @@ jobs: run: sbt test # Optional: This step uploads information to the GitHub dependency graph and unblocking Dependabot alerts for the repository - name: Upload dependency graph - uses: scalacenter/sbt-dependency-submission@ab086b50c947c9774b70f39fc7f6e20ca2706c91 + uses: scalacenter/sbt-dependency-submission@v2 From 0eaaa3a02c0f8e24d79f9048aadc91625f7e17d3 Mon Sep 17 00:00:00 2001 From: philwalk Date: Thu, 22 Feb 2024 13:33:54 -0700 Subject: [PATCH 3/8] add dependency-graph.yml --- .github/workflows/dependency-graph.yml | 17 +++++++++++++++++ .github/workflows/scala.yml | 2 +- 2 files changed, 18 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/dependency-graph.yml diff --git a/.github/workflows/dependency-graph.yml b/.github/workflows/dependency-graph.yml new file mode 100644 index 0000000..adc9c21 --- /dev/null +++ b/.github/workflows/dependency-graph.yml @@ -0,0 +1,17 @@ +name: Update Dependency Graph +on: + push: + branches: + - main # default branch of the project +jobs: + dependency-graph: + name: Update Dependency Graph + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - uses: scalacenter/sbt-dependency-submission@v2 + with: + working-directory: . + configs-ignore: scala-doc-tool + permissions: + contents: write # this permission is needed to submit the dependency graph diff --git a/.github/workflows/scala.yml b/.github/workflows/scala.yml index c0d4669..e8f735a 100644 --- a/.github/workflows/scala.yml +++ b/.github/workflows/scala.yml @@ -31,4 +31,4 @@ jobs: run: sbt test # Optional: This step uploads information to the GitHub dependency graph and unblocking Dependabot alerts for the repository - name: Upload dependency graph - uses: scalacenter/sbt-dependency-submission@v2 + uses: scalacenter/sbt-dependency-submission@ab086b50c947c9774b70f39fc7f6e20ca2706c91 From 45284e97f7273f88107fff1ab00db77c534d9f57 Mon Sep 17 00:00:00 2001 From: philwalk Date: Thu, 22 Feb 2024 15:49:55 -0700 Subject: [PATCH 4/8] modify dependency-graph --- .github/workflows/dependency-graph.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/dependency-graph.yml b/.github/workflows/dependency-graph.yml index adc9c21..1096c97 100644 --- a/.github/workflows/dependency-graph.yml +++ b/.github/workflows/dependency-graph.yml @@ -1,5 +1,7 @@ +# .github/workflows/dependency-graph.yml name: Update Dependency Graph on: + workflow_dispatch: push: branches: - main # default branch of the project From d1819677ff7e21629b73b7b2100d6f668d6caacf Mon Sep 17 00:00:00 2001 From: philwalk Date: Thu, 22 Feb 2024 16:07:28 -0700 Subject: [PATCH 5/8] dependency-graph test --- .github/workflows/dependency-graph.yml | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/.github/workflows/dependency-graph.yml b/.github/workflows/dependency-graph.yml index 1096c97..5b7b85e 100644 --- a/.github/workflows/dependency-graph.yml +++ b/.github/workflows/dependency-graph.yml @@ -8,12 +8,14 @@ on: jobs: dependency-graph: name: Update Dependency Graph + permissions: + actions: read + contents: write # this permission is needed to submit the dependency graph + security-events: write runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 - uses: scalacenter/sbt-dependency-submission@v2 - with: - working-directory: . - configs-ignore: scala-doc-tool - permissions: - contents: write # this permission is needed to submit the dependency graph + with: + working-directory: . + configs-ignore: scala-doc-tool From 5ec46c5736a63f5e3bd51927c4387adcc76cd742 Mon Sep 17 00:00:00 2001 From: philwalk Date: Thu, 22 Feb 2024 16:11:39 -0700 Subject: [PATCH 6/8] added dependencyTreePlugin --- project/plugins.sbt | 2 ++ 1 file changed, 2 insertions(+) diff --git a/project/plugins.sbt b/project/plugins.sbt index da2de39..848a49d 100644 --- a/project/plugins.sbt +++ b/project/plugins.sbt @@ -7,6 +7,8 @@ addSbtPlugin("com.github.sbt" % "sbt-dynver" % "5.0.1") addSbtPlugin("com.eed3si9n" % "sbt-buildinfo" % "0.11.0") addSbtPlugin("com.github.sbt" % "sbt-pgp" % "2.2.1") +addDependencyTreePlugin + libraryDependencies += "org.scala-sbt" %% "scripted-plugin" % sbtVersion.value //resolvers += Resolver.sonatypeRepo("snapshots") From 43d6a3cf12d013587f0fa12adf8013dd13aa56f9 Mon Sep 17 00:00:00 2001 From: philwalk Date: Thu, 22 Feb 2024 16:48:12 -0700 Subject: [PATCH 7/8] updated dependency-graph --- .github/workflows/scala.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/scala.yml b/.github/workflows/scala.yml index e8f735a..503327f 100644 --- a/.github/workflows/scala.yml +++ b/.github/workflows/scala.yml @@ -30,5 +30,6 @@ jobs: - name: Run tests run: sbt test # Optional: This step uploads information to the GitHub dependency graph and unblocking Dependabot alerts for the repository - - name: Upload dependency graph - uses: scalacenter/sbt-dependency-submission@ab086b50c947c9774b70f39fc7f6e20ca2706c91 + - name: Sbt Dependency Submission + uses: scalacenter/sbt-dependency-submission@v2.3.0 + From d4ee94b59839a194ac6ab5c3c4d92d55c126d571 Mon Sep 17 00:00:00 2001 From: philwalk Date: Thu, 22 Feb 2024 17:55:06 -0700 Subject: [PATCH 8/8] disable dependency-graph --- .github/workflows/scala.yml | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/.github/workflows/scala.yml b/.github/workflows/scala.yml index 503327f..299c508 100644 --- a/.github/workflows/scala.yml +++ b/.github/workflows/scala.yml @@ -8,11 +8,9 @@ name: Scala CI on: push: branches: [ "main" ] - pull_request: - branches: [ "main" ] permissions: - contents: read + contents: write jobs: build: @@ -30,6 +28,5 @@ jobs: - name: Run tests run: sbt test # Optional: This step uploads information to the GitHub dependency graph and unblocking Dependabot alerts for the repository - - name: Sbt Dependency Submission - uses: scalacenter/sbt-dependency-submission@v2.3.0 - +# - name: Sbt Dependency Submission +# uses: scalacenter/sbt-dependency-submission@v2.3.0