Skip to content

Commit

Permalink
Merge branch 'main' into open-enums
Browse files Browse the repository at this point in the history
  • Loading branch information
kubukoz authored Oct 29, 2024
2 parents c309fed + c273c2e commit 5e14cc1
Show file tree
Hide file tree
Showing 113 changed files with 2,178 additions and 1,267 deletions.
96 changes: 39 additions & 57 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,17 +1,10 @@
name: "Build"
on:
pull_request:
branches: ['**']
branches: ["**"]
push:
branches: ['**']
tags: ['**']
workflow_dispatch:
inputs:
publishExtension:
description: 'Publish Extension'
required: true
default: false
type: boolean
branches: ["**"]
tags: ["**"]

concurrency:
group: ci-${{ github.ref }}
Expand All @@ -27,51 +20,40 @@ jobs:
build:
name: "Build"
runs-on: ubuntu-20.04
timeout-minutes: 30
timeout-minutes: 10
steps:

- uses: actions/[email protected]

- uses: cachix/install-nix-action@v22

- uses: cachix/cachix-action@v12
with:
name: kubukoz
authToken: '${{ secrets.CACHIX_AUTH_TOKEN }}'

- name: Cache sbt
uses: actions/[email protected]
with:
path: |
~/.sbt
~/.ivy2/local
~/.ivy2/cache
~/.coursier/cache/v1
~/.cache/coursier/v1
~/AppData/Local/Coursier/Cache/v1
~/Library/Caches/Coursier/v1
key: ${{ runner.os }}-sbt-cache-v2-${{ hashFiles('**/*.sbt') }}-${{ hashFiles('project/build.properties') }}

# This step isn't strictly necessary, but separating it means we can inspect its run time more easily.
- name: Setup environment
run: nix develop --command echo Environment ready

- name: Server tests
run: nix develop --command sbt ci

- name: VS Code extension tests
run: nix develop --command bash -c 'cd vscode-extension && yarn && SERVER_VERSION=$(cat ../.version) xvfb-run --auto-servernum yarn test'

- name: Show extension test logs
if: job.status == 'failure'
run: cat vscode-extension/fixture/smithyql-log.txt | tail --lines 1000

- name: release
if: github.event_name != 'pull_request' && (startsWith(github.ref, 'refs/tags/v') || github.ref == 'refs/heads/main')
run: nix develop --command sbt ci-release

- name: release plugin
if: github.event.inputs.publishExtension
run: nix develop --command ./release-plugin.sh
env:
VSCE_PAT: ${{ secrets.VSCE_TOKEN }}
- uses: actions/[email protected]

- uses: cachix/install-nix-action@v23

- uses: cachix/cachix-action@v12
with:
name: kubukoz
authToken: "${{ secrets.CACHIX_AUTH_TOKEN }}"

- name: Cache sbt
uses: actions/[email protected]
with:
path: |
~/.sbt
~/.ivy2/local
~/.ivy2/cache
~/.coursier/cache/v1
~/.cache/coursier/v1
~/AppData/Local/Coursier/Cache/v1
~/Library/Caches/Coursier/v1
key: ${{ runner.os }}-sbt-cache-v2-${{ hashFiles('**/*.sbt') }}-${{ hashFiles('project/build.properties') }}

# This step isn't strictly necessary, but separating it means we can inspect its run time more easily.
- name: Setup environment
run: nix develop --command echo Environment ready

- name: Server tests
run: nix develop --command sbt ci

- name: VS Code extension tests
run: nix develop --command bash -c 'cd vscode-extension && yarn && SERVER_VERSION=$(cat ../.version) xvfb-run --auto-servernum yarn test'

- name: Show extension test logs
if: job.status == 'failure'
run: cat vscode-extension/fixture/smithyql-log.txt | tail --lines 1000
2 changes: 1 addition & 1 deletion .github/workflows/dependency-graph.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,5 @@ jobs:
permissions:
contents: write
steps:
- uses: actions/checkout@v3.5.3
- uses: actions/checkout@v4.1.1
- uses: scalacenter/sbt-dependency-submission@v2
23 changes: 23 additions & 0 deletions .github/workflows/plugin.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: "Release plugin"
on:
workflow_dispatch:

jobs:
build:
name: "Release plugin"
runs-on: ubuntu-20.04
timeout-minutes: 10
steps:
- uses: actions/[email protected]

- uses: cachix/install-nix-action@v23

- uses: cachix/cachix-action@v12
with:
name: kubukoz
authToken: "${{ secrets.CACHIX_AUTH_TOKEN }}"

- name: release plugin
run: nix develop --command ./release-plugin.sh
env:
VSCE_PAT: ${{ secrets.VSCE_TOKEN }}
21 changes: 19 additions & 2 deletions .scalafmt.conf
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
runner.dialect=scala213source3
version = 3.7.2
version = 3.8.3

runner.dialect=scala3
runner.dialectOverride.allowSignificantIndentation = false
runner.dialectOverride.allowQuietSyntax = true

maxColumn = 100
align.preset = some

Expand All @@ -17,6 +21,10 @@ assumeStandardLibraryStripMargin = true

trailingCommas = "multiple"

project {
git = true
}

rewrite.rules = [
RedundantBraces,
RedundantParens,
Expand All @@ -43,3 +51,12 @@ rewrite {
sort = ascii
}
}

fileOverride {
"glob:**.sbt" {
runner.dialect = sbt1
}
"glob:**/project/**" {
runner.dialect = scala212
}
}
85 changes: 53 additions & 32 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,13 @@ inThisBuild(
)
)

import scala.sys.process._
val ScalaLTS = "3.3.4"
val ScalaNext = "3.5.2"

ThisBuild / scalaVersion := ScalaNext
ThisBuild / versionScheme := Some("early-semver")

import scala.sys.process.*

def crossPlugin(
x: sbt.librarymanagement.ModuleID
Expand All @@ -27,35 +33,45 @@ val compilerPlugins =
Nil
else
List(
crossPlugin("org.typelevel" % "kind-projector" % "0.13.2")
crossPlugin("org.typelevel" % "kind-projector" % "0.13.3")
))

ThisBuild / versionScheme := Some("early-semver")

Global / onChangedBuildSource := ReloadOnSourceChanges

ThisBuild / scalaVersion := "2.13.11"
ThisBuild / crossScalaVersions := Seq("2.13.11")

// For coursier's "latest.integration"
ThisBuild / dynverSeparator := "-"

val commonSettings = Seq(
organization := "com.kubukoz.playground",
libraryDependencies ++= Seq(
"org.typelevel" %% "cats-core" % "2.10.0",
"org.typelevel" %% "cats-mtl" % "1.3.1",
"com.disneystreaming" %% "weaver-cats" % "0.8.3" % Test,
"com.disneystreaming" %% "weaver-discipline" % "0.8.3" % Test,
"com.disneystreaming" %% "weaver-scalacheck" % "0.8.3" % Test,
"org.typelevel" %% "cats-core" % "2.12.0",
"org.typelevel" %% "cats-mtl" % "1.5.0",
"com.disneystreaming" %% "weaver-cats" % "0.8.4" % Test,
"com.disneystreaming" %% "weaver-discipline" % "0.8.4" % Test,
"com.disneystreaming" %% "weaver-scalacheck" % "0.8.4" % Test,
"com.softwaremill.diffx" %% "diffx-core" % "0.9.0" % Test,
"com.softwaremill.diffx" %% "diffx-cats" % "0.9.0" % Test,
),
compilerPlugins,
scalacOptions -= "-Xfatal-warnings",
scalacOptions -= "-Vtype-diffs",
scalacOptions += "-Wnonunit-statement",
scalacOptions ++= Seq("-Xsource:3.0"),
scalacOptions -= "-language:existentials",
// https://github.com/lampepfl/dotty/issues/18674
Test / scalacOptions -= "-Wunused:implicits",
Test / scalacOptions -= "-Wunused:explicits",
Test / scalacOptions -= "-Wunused:imports",
Test / scalacOptions -= "-Wunused:locals",
Test / scalacOptions -= "-Wunused:params",
Test / scalacOptions -= "-Wunused:privates",
//
scalacOptions += "-no-indent",
scalacOptions ++= {
if (scalaVersion.value.startsWith("3.5"))
Seq(
// for cats-tagless macros
"-experimental"
)
else
Nil
},
Test / scalacOptions += "-Wconf:cat=deprecation:silent,msg=Specify both message and version:silent",
scalacOptions ++= Seq("-release", "11"),
mimaFailOnNoPrevious := false,
Expand All @@ -73,8 +89,9 @@ lazy val pluginCore = module("plugin-core").settings(
libraryDependencies ++= Seq(
"com.disneystreaming.smithy4s" %% "smithy4s-http4s" % smithy4sVersion.value
),
// mimaPreviousArtifacts := Set(organization.value %% name.value % "0.3.0"),
// mimaPreviousArtifacts := Set(organization.value %% name.value % "0.7.0"),
mimaPreviousArtifacts := Set.empty,
scalaVersion := ScalaLTS,
)

lazy val pluginSample = module("plugin-sample")
Expand All @@ -95,10 +112,10 @@ lazy val source = module("source")
lazy val parser = module("parser")
.settings(
libraryDependencies ++= Seq(
"org.typelevel" %% "cats-parse" % "0.3.10",
"io.circe" %% "circe-generic" % "0.14.6" % Test,
"io.circe" %% "circe-parser" % "0.14.6" % Test,
"co.fs2" %% "fs2-io" % "3.9.2" % Test,
"org.typelevel" %% "cats-parse" % "1.0.0",
"io.circe" %% "circe-generic" % "0.14.10" % Test,
"io.circe" %% "circe-parser" % "0.14.10" % Test,
"co.fs2" %% "fs2-io" % "3.11.0" % Test,
)
)
.dependsOn(
Expand All @@ -110,7 +127,7 @@ lazy val parser = module("parser")
lazy val formatter = module("formatter")
.settings(
libraryDependencies ++= Seq(
"org.typelevel" %% "paiges-cats" % "0.4.3"
"org.typelevel" %% "paiges-cats" % "0.4.4"
)
)
.dependsOn(
Expand All @@ -124,15 +141,16 @@ lazy val formatter = module("formatter")
lazy val core = module("core")
.settings(
libraryDependencies ++= Seq(
"org.typelevel" %% "cats-effect" % "3.5.2",
"com.github.plokhotnyuk.jsoniter-scala" %% "jsoniter-scala-macros" % "2.24.1",
"org.typelevel" %% "cats-effect" % "3.5.5",
"com.github.plokhotnyuk.jsoniter-scala" %% "jsoniter-scala-macros" % "2.31.1",
"com.disneystreaming.smithy4s" %% "smithy4s-dynamic" % smithy4sVersion.value,
"com.disneystreaming.smithy4s" %% "smithy4s-http4s" % smithy4sVersion.value,
"com.disneystreaming.smithy4s" %% "smithy4s-aws-http4s" % smithy4sVersion.value,
"com.disneystreaming.smithy4s" % "smithy4s-protocol" % smithy4sVersion.value % Test,
"com.disneystreaming.alloy" % "alloy-core" % "0.2.8" % Test,
"software.amazon.smithy" % "smithy-aws-traits" % "1.39.1" % Test,
"com.disneystreaming.alloy" % "alloy-core" % "0.3.14" % Test,
"software.amazon.smithy" % "smithy-aws-traits" % "1.52.1" % Test,
),
// todo: move this to a separate module like "examples"
Smithy4sCodegenPlugin.defaultSettings(Test),
)
.enablePlugins(Smithy4sCodegenPlugin)
Expand All @@ -152,12 +170,15 @@ lazy val languageSupport = module("language-support")
lazy val lsp = module("lsp")
.settings(
libraryDependencies ++= Seq(
"org.eclipse.lsp4j" % "org.eclipse.lsp4j" % "0.21.1",
"io.circe" %% "circe-core" % "0.14.6",
"org.http4s" %% "http4s-ember-client" % "0.23.23",
"org.http4s" %% "http4s-ember-server" % "0.23.23" % Test,
"io.get-coursier" %% "coursier" % "2.1.7",
"org.typelevel" %% "cats-tagless-core" % "0.15.0",
"org.eclipse.lsp4j" % "org.eclipse.lsp4j" % "0.23.1",
"io.circe" %% "circe-core" % "0.14.10",
"org.http4s" %% "http4s-ember-client" % "0.23.29",
"org.http4s" %% "http4s-ember-server" % "0.23.29" % Test,
("io.get-coursier" % "coursier" % "2.1.14")
.cross(CrossVersion.for3Use2_13)
.exclude("org.scala-lang.modules", "scala-collection-compat_2.13")
.exclude("com.github.plokhotnyuk.jsoniter-scala", "jsoniter-scala-core_2.13"),
"org.typelevel" %% "cats-tagless-core" % "0.16.2",
),
buildInfoPackage := "playground.lsp.buildinfo",
buildInfoKeys ++= Seq(version, scalaBinaryVersion),
Expand Down
30 changes: 24 additions & 6 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
devShell = pkgs.mkShell {
buildInputs = [
pkgs.yarn
pkgs.nodejs-14_x
pkgs.nodejs
pkgs.sbt
pkgs.jless
pkgs.gnupg
Expand Down
Loading

0 comments on commit 5e14cc1

Please sign in to comment.