Skip to content

Commit aa1f1f7

Browse files
committed
Enables lockfile workflow with sbt-dependency-lock
Caveats of this: 1. [Crossbuilds may not be supported][crossbuilds], impacting #84. 2. The hash used is SHA1, which is deprecated including by [NIST][nist]. Some work is in draft PRs for introducing a new version of the lockfile that may enable SHA256 or other hash algorithms. Fixes #129 [crossbuilds]: stringbean/sbt-dependency-lock#13 [nist]: https://www.nist.gov/news-events/news/2022/12/nist-retires-sha-1-cryptographic-algorithm
1 parent 45ded42 commit aa1f1f7

File tree

6 files changed

+2938
-6
lines changed

6 files changed

+2938
-6
lines changed

.github/.scala-steward.conf

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -68,10 +68,10 @@ updates.ignore = [ { groupId = "org.scala-lang", artifactId = "scala-library" }
6868

6969
# If set, Scala Steward will use this message template for the commit messages and PR titles.
7070
# Supported variables: ${artifactName}, ${currentVersion}, ${nextVersion} and ${default}
71-
# Default: "${default}" which is equivalent to "Update ${artifactName} to ${nextVersion}"
71+
# Default: "${default}" which is equivalent to "Update ${artifactName} to ${nextVersion}"
7272
commits.message = "Update ${artifactName} from ${currentVersion} to ${nextVersion}"
7373

74-
# If true and when upgrading version in .scalafmt.conf, Scala Steward will perform scalafmt
74+
# If true and when upgrading version in .scalafmt.conf, Scala Steward will perform scalafmt
7575
# and add a separate commit when format changed. So you don't need reformat manually and can merge PR.
7676
# If false, Scala Steward will not perform scalafmt, so your CI may abort when reformat needed.
7777
# Default: true
@@ -90,9 +90,13 @@ scalafmt.runAfterUpgrading = false
9090
# groupId = "com.github.sbt",
9191
# artifactId = "sbt-protobuf"
9292
# }]
93+
postUpdateHooks = [{
94+
command = ["sbt", "dependencyLockWrite"],
95+
commitMessage = "Regenerated sbt lock file"
96+
}]
9397

9498
# You can override some config options for dependencies that matches the given pattern.
95-
# Currently, "pullRequests" can be overridden.
99+
# Currently, "pullRequests" can be overridden.
96100
# Each pattern must have `groupId`, and may have `artifactId` and `version`.
97101
# First-matched entry is used.
98102
# More-specific entry should be placed before less-specific entry.

.github/workflows/ci.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,4 +36,4 @@ jobs:
3636
key: ${{ runner.os }}-sbt-cache-v2-${{ hashFiles('**/*.sbt') }}-${{ hashFiles('project/build.properties') }}
3737

3838
- name: Build, test, and package project
39-
run: bin/sbt clean compile test package makePom
39+
run: bin/sbt clean update dependencyLockCheck compile test package makePom

.github/workflows/release.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ jobs:
3333
~/AppData/Local/Coursier/Cache/v1
3434
~/Library/Caches/Coursier/v1
3535
key: ${{ runner.os }}-sbt-cache-v2-${{ hashFiles('**/*.sbt') }}-${{ hashFiles('project/build.properties') }}
36-
36+
3737
# uses sbt-github-packages, see build.sbt
3838
- name: Publish with SBT
39-
run: bin/sbt publish
39+
run: bin/sbt dependencyLockCheck publish

Makefile

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,18 @@ test: ## Runs tests
2121
check: ## Runs linters and other checks
2222
$(SBT) scalastyle
2323

24+
.PHONY: check-deps
25+
check-deps: ## Checks dependencies are what are expected
26+
$(SBT) dependencyLockCheck
27+
2428
.PHONY: build
2529
build:
2630
$(SBT) assembly
2731

32+
.PHONY: relock
33+
relock: ## Lock dependencies based on what's currently referenced
34+
$(SBT) dependencyLockWrite
35+
2836
.PHONY: format-scala
2937
format-scala: ## Formats all Scala code
3038
$(SBT) scalafmt

0 commit comments

Comments
 (0)