Compare commits

...

1 commit

Author SHA1 Message Date
2322e9afc8
Adding real merge request builds.
All checks were successful
/ Build and Test Library Snapshot (pull_request) Successful in 1m20s
- 100% code coverage
- Pre-commit enforced at build time
- Code coverage enforced at build time
- Publish snapshot to maven repo
2024-03-18 21:16:12 -05:00
7 changed files with 70 additions and 15 deletions

View file

@ -1,8 +0,0 @@
on: [push]
jobs:
test:
runs-on: docker
container:
image: alpine:3.19
steps:
- run: echo Verifying builds

View file

@ -0,0 +1,24 @@
on:
pull_request:
types: [opened, synchronize, reopened]
jobs:
library_snapshot:
runs-on: docker
container:
image: registry.garrity.co:8443/gs/ci-scala:latest
name: 'Build and Test Library Snapshot'
env:
GS_MAVEN_USER: ${{ vars.GS_MAVEN_USER }}
GS_MAVEN_TOKEN: ${{ secrets.GS_MAVEN_TOKEN }}
steps:
- uses: actions/checkout@v4
name: 'Checkout Repository'
- name: 'Pre-Commit'
run: |
pre-commit install
pre-commit run --all-files
- name: 'Unit Tests and Code Coverage'
run: sbt clean coverage test coverageReport
- name: 'Publish Snapshot'
run: sbt clean publish

View file

@ -5,7 +5,13 @@ repos:
hooks:
- id: end-of-file-fixer
- id: trailing-whitespace
- id: fix-byte-order-marker
- id: mixed-line-ending
args: ['--fix=lf']
description: Enforces using only 'LF' line endings.
- id: trailing-whitespace
- id: check-yaml
- repo: https://git.garrity.co/garrity-software/gs-pre-commit-scala
rev: v0.1.3
rev: v1.0.0
hooks:
- id: scalafmt

View file

@ -1,12 +1,15 @@
val scala3: String = "3.3.1"
val scala3: String = "3.4.0"
ThisBuild / scalaVersion := scala3
ThisBuild / versionScheme := Some("semver-spec")
ThisBuild / gsProjectName := "gs-uuid"
val sharedSettings = Seq(
scalaVersion := scala3,
version := semVerSelected.value
scalaVersion := scala3,
version := semVerSelected.value,
coverageFailOnMinimum := true,
coverageMinimumStmtTotal := 100,
coverageMinimumBranchTotal := 100
)
lazy val testSettings = Seq(

View file

@ -1 +1 @@
sbt.version=1.9.8
sbt.version=1.9.9

View file

@ -1,10 +1,33 @@
credentials += Credentials(Path.userHome / ".sbt" / ".credentials")
def selectCredentials(): Credentials =
if ((Path.userHome / ".sbt" / ".credentials").exists())
Credentials(Path.userHome / ".sbt" / ".credentials")
else
Credentials.apply(
realm = "Reposilite",
host = "maven.garrity.co",
userName = sys.env
.get("GS_MAVEN_USER")
.getOrElse(
throw new RuntimeException(
"You must either provide ~/.sbt/.credentials or specify the GS_MAVEN_USER environment variable."
)
),
passwd = sys.env
.get("GS_MAVEN_TOKEN")
.getOrElse(
throw new RuntimeException(
"You must either provide ~/.sbt/.credentials or specify the GS_MAVEN_TOKEN environment variable."
)
)
)
credentials += selectCredentials()
externalResolvers := Seq(
"Garrity Software Mirror" at "https://maven.garrity.co/releases",
"Garrity Software Releases" at "https://maven.garrity.co/gs"
)
addSbtPlugin("org.scoverage" % "sbt-scoverage" % "2.0.8")
addSbtPlugin("org.scoverage" % "sbt-scoverage" % "2.0.11")
addSbtPlugin("gs" % "sbt-garrity-software" % "0.2.0")
addSbtPlugin("gs" % "sbt-gs-semver" % "0.2.0")

View file

@ -50,6 +50,13 @@ class UUIDTests extends munit.FunSuite:
assert(parsed == Some(base))
}
test("should return lsb, msb, and if the UUID is zero") {
val uuid = UUID.parse("00000000-0000-0000-0000-000000000000")
assert(uuid.map(_.lsb()) == Some(0L))
assert(uuid.map(_.msb()) == Some(0L))
assert(uuid.map(_.isZero()) == Some(true))
}
private def doGen(
using
UUID.Generator