Add automated builds #2

Merged
pfm merged 1 commit from real-builds into main 2024-03-20 03:06:10 +00: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: hooks:
- id: end-of-file-fixer - id: end-of-file-fixer
- id: trailing-whitespace - 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 - repo: https://git.garrity.co/garrity-software/gs-pre-commit-scala
rev: v0.1.3 rev: v1.0.0
hooks: hooks:
- id: scalafmt - id: scalafmt

View file

@ -1,12 +1,15 @@
val scala3: String = "3.3.1" val scala3: String = "3.4.0"
ThisBuild / scalaVersion := scala3 ThisBuild / scalaVersion := scala3
ThisBuild / versionScheme := Some("semver-spec") ThisBuild / versionScheme := Some("semver-spec")
ThisBuild / gsProjectName := "gs-uuid" ThisBuild / gsProjectName := "gs-uuid"
val sharedSettings = Seq( val sharedSettings = Seq(
scalaVersion := scala3, scalaVersion := scala3,
version := semVerSelected.value version := semVerSelected.value,
coverageFailOnMinimum := true,
coverageMinimumStmtTotal := 100,
coverageMinimumBranchTotal := 100
) )
lazy val testSettings = Seq( 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( externalResolvers := Seq(
"Garrity Software Mirror" at "https://maven.garrity.co/releases", "Garrity Software Mirror" at "https://maven.garrity.co/releases",
"Garrity Software Releases" at "https://maven.garrity.co/gs" "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-garrity-software" % "0.2.0")
addSbtPlugin("gs" % "sbt-gs-semver" % "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)) 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( private def doGen(
using using
UUID.Generator UUID.Generator