Skip to content

Commit 43352c2

Browse files
committed
scala 3-RC2, ci
1 parent 6fbec70 commit 43352c2

File tree

13 files changed

+271
-57
lines changed

13 files changed

+271
-57
lines changed

.github/workflows/ci.yml

Lines changed: 123 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,123 @@
1+
# This file was automatically generated by sbt-github-actions using the
2+
# githubWorkflowGenerate task. You should add and commit this file to
3+
# your git repository. It goes without saying that you shouldn't edit
4+
# this file by hand! Instead, if you wish to make changes, you should
5+
# change your sbt build configuration to revise the workflow description
6+
# to meet your needs, then regenerate this file.
7+
8+
name: Continuous Integration
9+
10+
on:
11+
pull_request:
12+
branches: ['*']
13+
push:
14+
branches: ['*']
15+
tags: [v*]
16+
17+
env:
18+
PGP_PASSPHRASE: ${{ secrets.PGP_PASSPHRASE }}
19+
SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }}
20+
SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }}
21+
PGP_SECRET: ${{ secrets.PGP_SECRET }}
22+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
23+
24+
jobs:
25+
build:
26+
name: Build and Test
27+
strategy:
28+
matrix:
29+
os: [ubuntu-latest]
30+
scala: [2.13.5, 3.0.0-RC2]
31+
java: [openjdk@1.11.0]
32+
runs-on: ${{ matrix.os }}
33+
steps:
34+
- name: Checkout current branch (full)
35+
uses: actions/checkout@v2
36+
with:
37+
fetch-depth: 0
38+
39+
- name: Setup Java and Scala
40+
uses: olafurpg/setup-scala@v10
41+
with:
42+
java-version: ${{ matrix.java }}
43+
44+
- name: Cache sbt
45+
uses: actions/cache@v2
46+
with:
47+
path: |
48+
~/.sbt
49+
~/.ivy2/cache
50+
~/.coursier/cache/v1
51+
~/.cache/coursier/v1
52+
~/AppData/Local/Coursier/Cache/v1
53+
~/Library/Caches/Coursier/v1
54+
key: ${{ runner.os }}-sbt-cache-v2-${{ hashFiles('**/*.sbt') }}-${{ hashFiles('project/build.properties') }}
55+
56+
- name: Check that workflows are up to date
57+
run: sbt ++${{ matrix.scala }} githubWorkflowCheck
58+
59+
- run: sbt ++${{ matrix.scala }} test website/fastLinkJS
60+
61+
- name: Compress target directories
62+
run: tar cf targets.tar target stringdiff/.jvm/target stringdiff/.js/target project/target
63+
64+
- name: Upload target directories
65+
uses: actions/upload-artifact@v2
66+
with:
67+
name: target-${{ matrix.os }}-${{ matrix.scala }}-${{ matrix.java }}
68+
path: targets.tar
69+
70+
publish:
71+
name: Publish Artifacts
72+
needs: [build]
73+
if: github.event_name != 'pull_request' && (startsWith(github.ref, 'refs/tags/v'))
74+
strategy:
75+
matrix:
76+
os: [ubuntu-latest]
77+
scala: [2.13.5]
78+
java: [openjdk@1.11.0]
79+
runs-on: ${{ matrix.os }}
80+
steps:
81+
- name: Checkout current branch (full)
82+
uses: actions/checkout@v2
83+
with:
84+
fetch-depth: 0
85+
86+
- name: Setup Java and Scala
87+
uses: olafurpg/setup-scala@v10
88+
with:
89+
java-version: ${{ matrix.java }}
90+
91+
- name: Cache sbt
92+
uses: actions/cache@v2
93+
with:
94+
path: |
95+
~/.sbt
96+
~/.ivy2/cache
97+
~/.coursier/cache/v1
98+
~/.cache/coursier/v1
99+
~/AppData/Local/Coursier/Cache/v1
100+
~/Library/Caches/Coursier/v1
101+
key: ${{ runner.os }}-sbt-cache-v2-${{ hashFiles('**/*.sbt') }}-${{ hashFiles('project/build.properties') }}
102+
103+
- name: Download target directories (2.13.5)
104+
uses: actions/download-artifact@v2
105+
with:
106+
name: target-${{ matrix.os }}-2.13.5-${{ matrix.java }}
107+
108+
- name: Inflate target directories (2.13.5)
109+
run: |
110+
tar xf targets.tar
111+
rm targets.tar
112+
113+
- name: Download target directories (3.0.0-RC2)
114+
uses: actions/download-artifact@v2
115+
with:
116+
name: target-${{ matrix.os }}-3.0.0-RC2-${{ matrix.java }}
117+
118+
- name: Inflate target directories (3.0.0-RC2)
119+
run: |
120+
tar xf targets.tar
121+
rm targets.tar
122+
123+
- run: sbt ++${{ matrix.scala }} ci-release

.github/workflows/clean.yml

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
# This file was automatically generated by sbt-github-actions using the
2+
# githubWorkflowGenerate task. You should add and commit this file to
3+
# your git repository. It goes without saying that you shouldn't edit
4+
# this file by hand! Instead, if you wish to make changes, you should
5+
# change your sbt build configuration to revise the workflow description
6+
# to meet your needs, then regenerate this file.
7+
8+
name: Clean
9+
10+
on: push
11+
12+
jobs:
13+
delete-artifacts:
14+
name: Delete Artifacts
15+
runs-on: ubuntu-latest
16+
env:
17+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
18+
steps:
19+
- name: Delete artifacts
20+
run: |
21+
# Customize those three lines with your repository and credentials:
22+
REPO=${GITHUB_API_URL}/repos/${{ github.repository }}
23+
24+
# A shortcut to call GitHub API.
25+
ghapi() { curl --silent --location --user _:$GITHUB_TOKEN "$@"; }
26+
27+
# A temporary file which receives HTTP response headers.
28+
TMPFILE=/tmp/tmp.$$
29+
30+
# An associative array, key: artifact name, value: number of artifacts of that name.
31+
declare -A ARTCOUNT
32+
33+
# Process all artifacts on this repository, loop on returned "pages".
34+
URL=$REPO/actions/artifacts
35+
while [[ -n "$URL" ]]; do
36+
37+
# Get current page, get response headers in a temporary file.
38+
JSON=$(ghapi --dump-header $TMPFILE "$URL")
39+
40+
# Get URL of next page. Will be empty if we are at the last page.
41+
URL=$(grep '^Link:' "$TMPFILE" | tr ',' '\n' | grep 'rel="next"' | head -1 | sed -e 's/.*<//' -e 's/>.*//')
42+
rm -f $TMPFILE
43+
44+
# Number of artifacts on this page:
45+
COUNT=$(( $(jq <<<$JSON -r '.artifacts | length') ))
46+
47+
# Loop on all artifacts on this page.
48+
for ((i=0; $i < $COUNT; i++)); do
49+
50+
# Get name of artifact and count instances of this name.
51+
name=$(jq <<<$JSON -r ".artifacts[$i].name?")
52+
ARTCOUNT[$name]=$(( $(( ${ARTCOUNT[$name]} )) + 1))
53+
54+
id=$(jq <<<$JSON -r ".artifacts[$i].id?")
55+
size=$(( $(jq <<<$JSON -r ".artifacts[$i].size_in_bytes?") ))
56+
printf "Deleting '%s' #%d, %'d bytes\n" $name ${ARTCOUNT[$name]} $size
57+
ghapi -X DELETE $REPO/actions/artifacts/$id
58+
done
59+
done

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# Changelog
22

3+
### 0.3.2
4+
5+
Scala 3-RC2.
6+
37
### 0.3.1
48

59
Myers algorithm.

build.sbt

Lines changed: 28 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,31 @@
1-
ThisBuild / organization := "app.tulz"
2-
ThisBuild / homepage := Some(url("https://github.com/tulz-app/stringdiff"))
3-
ThisBuild / licenses += ("MIT", url("https://github.com/tulz-app/stringdiff/blob/main/LICENSE.md"))
4-
ThisBuild / developers := List(
5-
Developer(
6-
id = "yurique",
7-
name = "Iurii Malchenko",
8-
email = "i@yurique.com",
9-
url = url("https://github.com/yurique")
1+
inThisBuild(
2+
List(
3+
organization := "app.tulz",
4+
homepage := Some(url("https://github.com/tulz-app/stringdiff")),
5+
licenses := List("MIT" -> url("https://github.com/tulz-app/stringdiff/blob/main/LICENSE.md")),
6+
scmInfo := Some(ScmInfo(url("https://github.com/tulz-app/stringdiff"), "scm:git@github.com/tulz-app/laminext.git")),
7+
developers := List(Developer("yurique", "Iurii Malchenko", "i@yurique.com", url("https://github.com/yurique"))),
8+
scalaVersion := ScalaVersions.v213,
9+
description := "String diff for Scala",
10+
crossScalaVersions := Seq(
11+
ScalaVersions.v213,
12+
ScalaVersions.v3RC2
13+
),
14+
Test / publishArtifact := false,
15+
Test / parallelExecution := false,
16+
githubWorkflowJavaVersions := Seq("openjdk@1.11.0"),
17+
githubWorkflowTargetTags ++= Seq("v*"),
18+
githubWorkflowPublishTargetBranches := Seq(RefPredicate.StartsWith(Ref.Tag("v"))),
19+
githubWorkflowPublish := Seq(WorkflowStep.Sbt(List("ci-release"))),
20+
githubWorkflowBuild := Seq(WorkflowStep.Sbt(List("test", "website/fastLinkJS"))),
21+
githubWorkflowEnv ~= (_ ++ Map(
22+
"PGP_PASSPHRASE" -> s"$${{ secrets.PGP_PASSPHRASE }}",
23+
"PGP_SECRET" -> s"$${{ secrets.PGP_SECRET }}",
24+
"SONATYPE_PASSWORD" -> s"$${{ secrets.SONATYPE_PASSWORD }}",
25+
"SONATYPE_USERNAME" -> s"$${{ secrets.SONATYPE_USERNAME }}"
26+
))
1027
)
1128
)
12-
ThisBuild / releasePublishArtifactsAction := PgpKeys.publishSigned.value
13-
ThisBuild / publishTo := sonatypePublishToBundle.value
14-
ThisBuild / pomIncludeRepository := { _ => false }
15-
ThisBuild / sonatypeProfileName := "yurique"
16-
ThisBuild / publishArtifact in Test := false
17-
ThisBuild / publishMavenStyle := true
18-
ThisBuild / releaseCrossBuild := false
19-
ThisBuild / crossScalaVersions := Seq("2.13.4")
2029

2130
lazy val noPublish = Seq(
2231
publishLocal / skip := true,
@@ -29,27 +38,9 @@ lazy val stringdiff =
2938
.crossType(CrossType.Pure)
3039
.in(file("stringdiff"))
3140
.settings(
32-
scalaVersion := "2.13.4",
33-
scalacOptions := Seq(
34-
"-unchecked",
35-
"-deprecation",
36-
"-feature",
37-
"-Xlint:nullary-unit,inaccessible,infer-any,missing-interpolator,private-shadow,type-parameter-shadow,poly-implicit-overload,option-implicit,delayedinit-select,stars-align",
38-
"-Xcheckinit",
39-
"-Ywarn-value-discard",
40-
"-language:implicitConversions",
41-
"-encoding",
42-
"utf8"
43-
),
41+
ScalaOptions.fixOptions,
4442
libraryDependencies ++= Seq(
45-
"org.scalatest" %%% "scalatest" % "3.2.0" % Test
46-
),
47-
description := "String diff for scala.",
48-
scmInfo := Some(
49-
ScmInfo(
50-
url("https://github.com/tulz-app/stringdiff"),
51-
"scm:git@github.com/tulz-app/stringdiff.git"
52-
)
43+
"org.scalatest" %%% "scalatest" % "3.2.7" % Test
5344
)
5445
)
5546

project/ScalaOptions.scala

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
import sbt.Keys._
2+
import sbt._
3+
4+
object ScalaOptions {
5+
val fixOptions = Seq(
6+
scalacOptions ~= (_.filterNot(
7+
Set(
8+
"-Wdead-code",
9+
"-Wunused:implicits",
10+
"-Wunused:explicits",
11+
"-Wunused:imports",
12+
"-Wunused:params"
13+
)
14+
)),
15+
scalacOptions ++= (CrossVersion.partialVersion(scalaVersion.value) match {
16+
case Some((2, _)) =>
17+
Seq(
18+
"-Ymacro-annotations"
19+
)
20+
case Some((3, _)) => Seq()
21+
case _ => Seq()
22+
}),
23+
(Compile / doc / scalacOptions) ~= (_.filterNot(
24+
Set(
25+
"-scalajs",
26+
"-deprecation",
27+
"-explain-types",
28+
"-explain",
29+
"-feature",
30+
"-language:existentials,experimental.macros,higherKinds,implicitConversions",
31+
"-unchecked",
32+
"-Xfatal-warnings",
33+
"-Ykind-projector",
34+
"-from-tasty",
35+
"-encoding",
36+
"utf8"
37+
)
38+
))
39+
)
40+
41+
}

project/ScalaVersions.scala

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
object ScalaVersions {
2+
val v213 = "2.13.5"
3+
val v3RC2 = "3.0.0-RC2"
4+
}

project/build.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
sbt.version=1.4.6
1+
sbt.version=1.5.0-RC2

project/plugins.sbt

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,17 @@
11
logLevel := Level.Warn
22

3-
addSbtPlugin("org.scala-js" % "sbt-scalajs" % "1.1.0")
3+
addSbtPlugin("org.scala-js" % "sbt-scalajs" % "1.5.0")
44

55
addSbtPlugin("org.portable-scala" % "sbt-scalajs-crossproject" % "1.0.0")
66

77
addSbtPlugin("org.scalameta" % "sbt-scalafmt" % "2.4.2")
88

9-
addSbtPlugin("com.jsuereth" % "sbt-pgp" % "2.0.2")
9+
addSbtPlugin("com.github.sbt" % "sbt-pgp" % "2.1.2")
1010

11-
addSbtPlugin("org.xerial.sbt" % "sbt-sonatype" % "3.9.5")
11+
addSbtPlugin("org.xerial.sbt" % "sbt-sonatype" % "3.9.7")
1212

13-
addSbtPlugin("com.github.gseitz" % "sbt-release" % "1.0.13")
13+
addSbtPlugin("com.codecommit" % "sbt-github-actions" % "0.10.1")
14+
15+
addSbtPlugin("io.github.davidgregory084" % "sbt-tpolecat" % "0.1.17")
16+
17+
addSbtPlugin("com.geirsson" % "sbt-ci-release" % "1.5.7")

stringdiff/src/main/scala/app/tulz/diff/format/AnsiDiffFormat.scala

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,6 @@ object AnsiDiffFormat extends DiffFormat[String] {
4545
sb.appendAll(second)
4646
sb.append(RESET)
4747
sb.append("]")
48-
case _ =>
4948
}
5049

5150
sb.toString()

stringdiff/src/main/scala/app/tulz/diff/format/AnsiDiffFormatBoth.scala

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@ object AnsiDiffFormatBoth extends DiffFormat[(String, String)] {
3232
sb1.append(UNDERLINED)
3333
sb1.appendAll(first)
3434
sb1.append(RESET)
35-
case _ =>
3635
}
3736

3837
val sb2 = new StringBuilder
@@ -58,7 +57,6 @@ object AnsiDiffFormatBoth extends DiffFormat[(String, String)] {
5857
sb2.append(UNDERLINED)
5958
sb2.appendAll(second)
6059
sb2.append(RESET)
61-
case _ =>
6260
}
6361

6462
(sb1.toString(), sb2.toString())

0 commit comments

Comments
 (0)