Skip to content

Commit d3e47f0

Browse files
authored
Merge pull request #13 from sqids/upgrade_libraries
Upgrade libraries and make it build
2 parents e4b1493 + 95e4089 commit d3e47f0

File tree

7 files changed

+69
-93
lines changed

7 files changed

+69
-93
lines changed

.github/workflows/ci.yml

+57-70
Original file line numberDiff line numberDiff line change
@@ -15,85 +15,74 @@ on:
1515
tags: [v*]
1616

1717
env:
18-
PGP_PASSPHRASE: ${{ secrets.PGP_PASSPHRASE }}
19-
SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }}
20-
SONATYPE_CREDENTIAL_HOST: ${{ secrets.SONATYPE_CREDENTIAL_HOST }}
21-
SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }}
22-
PGP_SECRET: ${{ secrets.PGP_SECRET }}
2318
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
2419

20+
21+
concurrency:
22+
group: ${{ github.workflow }} @ ${{ github.ref }}
23+
cancel-in-progress: true
24+
2525
jobs:
2626
build:
27-
name: Build and Test
27+
name: Test
2828
strategy:
2929
matrix:
30-
os: [ubuntu-latest]
31-
scala: [2.13.11, 3.3.0]
30+
os: [ubuntu-22.04]
31+
scala: [2.13, 3]
3232
java: [temurin@8]
3333
runs-on: ${{ matrix.os }}
34+
timeout-minutes: 60
3435
steps:
3536
- name: Checkout current branch (full)
36-
uses: actions/checkout@v3
37+
uses: actions/checkout@v4
3738
with:
3839
fetch-depth: 0
3940

40-
- name: Download Java (temurin@8)
41-
id: download-java-temurin-8
42-
if: matrix.java == 'temurin@8'
43-
uses: typelevel/download-java@v2
44-
with:
45-
distribution: temurin
46-
java-version: 8
41+
- name: Setup sbt
42+
uses: sbt/setup-sbt@v1
4743

4844
- name: Setup Java (temurin@8)
45+
id: setup-java-temurin-8
4946
if: matrix.java == 'temurin@8'
50-
uses: actions/setup-java@v3
47+
uses: actions/setup-java@v4
5148
with:
52-
distribution: jdkfile
49+
distribution: temurin
5350
java-version: 8
54-
jdkFile: ${{ steps.download-java-temurin-8.outputs.jdkFile }}
51+
cache: sbt
5552

56-
- name: Cache sbt
57-
uses: actions/cache@v3
58-
with:
59-
path: |
60-
~/.sbt
61-
~/.ivy2/cache
62-
~/.coursier/cache/v1
63-
~/.cache/coursier/v1
64-
~/AppData/Local/Coursier/Cache/v1
65-
~/Library/Caches/Coursier/v1
66-
key: ${{ runner.os }}-sbt-cache-v2-${{ hashFiles('**/*.sbt') }}-${{ hashFiles('project/build.properties') }}
53+
- name: sbt update
54+
if: matrix.java == 'temurin@8' && steps.setup-java-temurin-8.outputs.cache-hit == 'false'
55+
run: sbt +update
6756

6857
- name: Check that workflows are up to date
6958
run: sbt githubWorkflowCheck
7059

7160
- name: Check headers and formatting
72-
if: matrix.java == 'temurin@8' && matrix.os == 'ubuntu-latest'
61+
if: matrix.java == 'temurin@8' && matrix.os == 'ubuntu-22.04'
7362
run: sbt '++ ${{ matrix.scala }}' headerCheckAll scalafmtCheckAll 'project /' scalafmtSbtCheck
7463

7564
- name: Test
7665
run: sbt '++ ${{ matrix.scala }}' test
7766

7867
- name: Check binary compatibility
79-
if: matrix.java == 'temurin@8' && matrix.os == 'ubuntu-latest'
68+
if: matrix.java == 'temurin@8' && matrix.os == 'ubuntu-22.04'
8069
run: sbt '++ ${{ matrix.scala }}' mimaReportBinaryIssues
8170

8271
- name: Generate API documentation
83-
if: matrix.java == 'temurin@8' && matrix.os == 'ubuntu-latest'
72+
if: matrix.java == 'temurin@8' && matrix.os == 'ubuntu-22.04'
8473
run: sbt '++ ${{ matrix.scala }}' doc
8574

8675
- name: Make target directories
8776
if: github.event_name != 'pull_request' && (startsWith(github.ref, 'refs/tags/v') || github.ref == 'refs/heads/main')
88-
run: mkdir -p target project/target
77+
run: mkdir -p target core/.jvm/target core/.native/target core/.js/target project/target
8978

9079
- name: Compress target directories
9180
if: github.event_name != 'pull_request' && (startsWith(github.ref, 'refs/tags/v') || github.ref == 'refs/heads/main')
92-
run: tar cf targets.tar target project/target
81+
run: tar cf targets.tar target core/.jvm/target core/.native/target core/.js/target project/target
9382

9483
- name: Upload target directories
9584
if: github.event_name != 'pull_request' && (startsWith(github.ref, 'refs/tags/v') || github.ref == 'refs/heads/main')
96-
uses: actions/upload-artifact@v3
85+
uses: actions/upload-artifact@v4
9786
with:
9887
name: target-${{ matrix.os }}-${{ matrix.java }}-${{ matrix.scala }}
9988
path: targets.tar
@@ -104,73 +93,71 @@ jobs:
10493
if: github.event_name != 'pull_request' && (startsWith(github.ref, 'refs/tags/v') || github.ref == 'refs/heads/main')
10594
strategy:
10695
matrix:
107-
os: [ubuntu-latest]
96+
os: [ubuntu-22.04]
10897
java: [temurin@8]
10998
runs-on: ${{ matrix.os }}
11099
steps:
111100
- name: Checkout current branch (full)
112-
uses: actions/checkout@v3
101+
uses: actions/checkout@v4
113102
with:
114103
fetch-depth: 0
115104

116-
- name: Download Java (temurin@8)
117-
id: download-java-temurin-8
118-
if: matrix.java == 'temurin@8'
119-
uses: typelevel/download-java@v2
120-
with:
121-
distribution: temurin
122-
java-version: 8
105+
- name: Setup sbt
106+
uses: sbt/setup-sbt@v1
123107

124108
- name: Setup Java (temurin@8)
109+
id: setup-java-temurin-8
125110
if: matrix.java == 'temurin@8'
126-
uses: actions/setup-java@v3
111+
uses: actions/setup-java@v4
127112
with:
128-
distribution: jdkfile
113+
distribution: temurin
129114
java-version: 8
130-
jdkFile: ${{ steps.download-java-temurin-8.outputs.jdkFile }}
115+
cache: sbt
131116

132-
- name: Cache sbt
133-
uses: actions/cache@v3
134-
with:
135-
path: |
136-
~/.sbt
137-
~/.ivy2/cache
138-
~/.coursier/cache/v1
139-
~/.cache/coursier/v1
140-
~/AppData/Local/Coursier/Cache/v1
141-
~/Library/Caches/Coursier/v1
142-
key: ${{ runner.os }}-sbt-cache-v2-${{ hashFiles('**/*.sbt') }}-${{ hashFiles('project/build.properties') }}
143-
144-
- name: Download target directories (2.13.11)
145-
uses: actions/download-artifact@v3
117+
- name: sbt update
118+
if: matrix.java == 'temurin@8' && steps.setup-java-temurin-8.outputs.cache-hit == 'false'
119+
run: sbt +update
120+
121+
- name: Download target directories (2.13)
122+
uses: actions/download-artifact@v4
146123
with:
147-
name: target-${{ matrix.os }}-${{ matrix.java }}-2.13.11
124+
name: target-${{ matrix.os }}-${{ matrix.java }}-2.13
148125

149-
- name: Inflate target directories (2.13.11)
126+
- name: Inflate target directories (2.13)
150127
run: |
151128
tar xf targets.tar
152129
rm targets.tar
153130
154-
- name: Download target directories (3.3.0)
155-
uses: actions/download-artifact@v3
131+
- name: Download target directories (3)
132+
uses: actions/download-artifact@v4
156133
with:
157-
name: target-${{ matrix.os }}-${{ matrix.java }}-3.3.0
134+
name: target-${{ matrix.os }}-${{ matrix.java }}-3
158135

159-
- name: Inflate target directories (3.3.0)
136+
- name: Inflate target directories (3)
160137
run: |
161138
tar xf targets.tar
162139
rm targets.tar
163140
164141
- name: Import signing key
165142
if: env.PGP_SECRET != '' && env.PGP_PASSPHRASE == ''
166-
run: echo $PGP_SECRET | base64 -di | gpg --import
143+
env:
144+
PGP_SECRET: ${{ secrets.PGP_SECRET }}
145+
PGP_PASSPHRASE: ${{ secrets.PGP_PASSPHRASE }}
146+
run: echo $PGP_SECRET | base64 -d -i - | gpg --import
167147

168148
- name: Import signing key and strip passphrase
169149
if: env.PGP_SECRET != '' && env.PGP_PASSPHRASE != ''
150+
env:
151+
PGP_SECRET: ${{ secrets.PGP_SECRET }}
152+
PGP_PASSPHRASE: ${{ secrets.PGP_PASSPHRASE }}
170153
run: |
171-
echo "$PGP_SECRET" | base64 -di > /tmp/signing-key.gpg
154+
echo "$PGP_SECRET" | base64 -d -i - > /tmp/signing-key.gpg
172155
echo "$PGP_PASSPHRASE" | gpg --pinentry-mode loopback --passphrase-fd 0 --import /tmp/signing-key.gpg
173156
(echo "$PGP_PASSPHRASE"; echo; echo) | gpg --command-fd 0 --pinentry-mode loopback --change-passphrase $(gpg --list-secret-keys --with-colons 2> /dev/null | grep '^sec:' | cut --delimiter ':' --fields 5 | tail -n 1)
174157
175158
- name: Publish
159+
env:
160+
SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }}
161+
SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }}
162+
SONATYPE_CREDENTIAL_HOST: ${{ secrets.SONATYPE_CREDENTIAL_HOST }}
176163
run: sbt tlCiRelease

.scalafmt.conf

+1-4
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1-
# This file was auto-generated by sbt-magine. Do not modify nor add it to gitignore.
2-
# You can re-generate this file at any time with `sbt magineGenerateScalafmtConfig`.
3-
41
align = none
52
align.arrowEnumeratorGenerator = false
63
align.openParenCallSite = false
@@ -30,7 +27,7 @@ rewrite.redundantBraces.stringInterpolation = true
3027
rewrite.redundantBraces.includeUnitMethods = false
3128
rewrite.rules = [ExpandImportSelectors, PreferCurlyFors, RedundantBraces, RedundantParens]
3229
rewrite.trailingCommas.style = keep
33-
runner.dialect = scala213
30+
runner.dialect = scala213source3
3431
version = 3.7.12
3532
verticalMultiline.arityThreshold = 3
3633
verticalMultiline.atDefnSite = true

build.sbt

+5-4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
lazy val scala213 = "2.13.11"
2-
lazy val scala3 = "3.3.0"
1+
lazy val scala213 = "2.13.16"
2+
lazy val scala3 = "3.3.5"
33
lazy val supportedScalaVersions = List(scala213, scala3)
44

55
ThisBuild / organization := "org.sqids"
@@ -9,10 +9,11 @@ ThisBuild / licenses := Seq(License.MIT)
99
ThisBuild / developers ++= List(
1010
tlGitHubDev("jesperoman", "Jesper Öman")
1111
)
12-
ThisBuild / tlBaseVersion := "0.5"
12+
ThisBuild / tlBaseVersion := "0.6"
1313
ThisBuild / crossScalaVersions := supportedScalaVersions
1414
ThisBuild / scalaVersion := scala213
15-
ThisBuild / tlSonatypeUseLegacyHost := false
15+
ThisBuild / mimaFailOnNoPrevious := false
16+
ThisBuild / tlCiDependencyGraphJob := false
1617

1718
lazy val root =
1819
project

core/src/main/scala/sqids/options/Alphabet.scala

+2-2
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import sqids.Utils.StringOps
1212

1313
sealed abstract case class Alphabet(value: Vector[Char]) {
1414
def length = value.length
15-
def indexOf(c: Char) = value.indexOf(c.toInt)
15+
def indexOf(c: Char) = value.indexOf(c)
1616
def prefix = value.head
1717
def separator: Char = value.head
1818
def removeSeparator: Alphabet = new Alphabet(value.tail) {}
@@ -55,7 +55,7 @@ sealed abstract case class Alphabet(value: Vector[Char]) {
5555
}
5656
) {}
5757

58-
def offsetFromPrefix(prefix: Char) = value.indexOf(prefix.toInt)
58+
def offsetFromPrefix(prefix: Char) = value.indexOf(prefix)
5959

6060
def getOffset(numbers: List[Long], increment: Int): Int =
6161
(numbers.indices.foldLeft(numbers.length) { (offset, i) =>

core/src/test/scala/sqids/SqidsSuite_encoding.scala

-9
Original file line numberDiff line numberDiff line change
@@ -107,15 +107,6 @@ final class SqidsSuite_encoding extends ScalaCheckSuite {
107107
sqids.encode(List(-1L)),
108108
Left(SqidsError.OutOfRange("some nr is out of range: -1, max: 9223372036854775807 min: 0"))
109109
)
110-
111-
assertEquals(
112-
sqids.encode(List(Long.MaxValue + 1)),
113-
Left(
114-
SqidsError.OutOfRange(
115-
"some nr is out of range: -9223372036854775808, max: 9223372036854775807 min: 0"
116-
)
117-
)
118-
)
119110
}
120111

121112
property("arbitrary numbers") {

project/build.properties

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
sbt.version = 1.9.3
1+
sbt.version = 1.10.7

project/plugins.sbt

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
addSbtPlugin("org.typelevel" % "sbt-typelevel" % "0.4.22")
1+
addSbtPlugin("org.typelevel" % "sbt-typelevel" % "0.7.7")
22

3-
addSbtPlugin("org.scala-native" % "sbt-scala-native" % "0.5.4")
3+
addSbtPlugin("org.scala-native" % "sbt-scala-native" % "0.5.6")
44
addSbtPlugin("org.portable-scala" % "sbt-scalajs-crossproject" % "1.3.2")
55

6-
addSbtPlugin("org.scala-js" % "sbt-scalajs" % "1.16.0")
6+
addSbtPlugin("org.scala-js" % "sbt-scalajs" % "1.18.2")
77
addSbtPlugin("org.portable-scala" % "sbt-scala-native-crossproject" % "1.3.2")

0 commit comments

Comments
 (0)