Skip to content

Commit

Permalink
rewrite
Browse files Browse the repository at this point in the history
  • Loading branch information
kitlangton committed Mar 29, 2024
1 parent 3653e62 commit 873eb88
Show file tree
Hide file tree
Showing 57 changed files with 1,750 additions and 2,129 deletions.
27 changes: 0 additions & 27 deletions .github/workflows/ci.yaml

This file was deleted.

89 changes: 37 additions & 52 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -1,86 +1,71 @@
on: push

jobs:

build-and-upload:
name: build and upload
name: Build and Upload
strategy:
matrix:
os: [macos, ubuntu]
os: [ubuntu-latest, macos-latest]
include:
- os: ubuntu
runs: ubuntu-latest
- os: ubuntu-latest
artifact-name: sup-linux-amd
- os: macos
runs: macos-latest
- os: macos-latest
artifact-name: sup-macos-amd
runs-on: ${{ matrix.runs }}
runs-on: ${{ matrix.os }}

steps:
- name: checkout
uses: actions/checkout@v2
- uses: coursier/cache-action@v6
- name: Checkout
uses: actions/checkout@v3

- name: test for ${{ matrix.os }}
run: |
./sbt test
- name: Setup Scala
uses: olafurpg/setup-scala@v14
with:
java-version: adopt@1.11

- uses: olafurpg/setup-scala@v13
- run: sbt ci-release
if: ${{ matrix.os == 'macos' }}
env:
PGP_PASSPHRASE: ${{ secrets.PGP_PASSPHRASE }}
PGP_SECRET: ${{ secrets.PGP_SECRET }}
SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }}
SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }}
- name: Test for ${{ matrix.os }}
run: sbt test

- uses: graalvm/setup-graalvm@v1
if: ${{ startsWith(github.ref, 'refs/tags/') }}
- name: Setup GraalVM (for tagged commits)
uses: graalvm/setup-graalvm@v1
if: startsWith(github.ref, 'refs/tags/')
with:
version: 'latest'
java-version: '17'
components: 'native-image'
java-version: "21"
github-token: ${{ secrets.GITHUB_TOKEN }}

- name: build for ${{ matrix.os }}
if: ${{ startsWith(github.ref, 'refs/tags/') }}
run: |
./sbt graalvm-native-image:packageBin
- name: Build Native Image (for tagged commits)
run: sbt nativeImage
if: startsWith(github.ref, 'refs/tags/')

# disable on window: https://github.com/upx/upx/issues/559
- name: run upx on ${{ matrix.os }}
- name: Compress using UPX (not on Windows)
uses: svenstaro/upx-action@v2
if: ${{ startsWith(github.ref, 'refs/tags/') }}
if: startsWith(github.ref, 'refs/tags/') && matrix.os != 'windows-latest'
with:
file: target/graalvm-native-image/scala-update
file: target/native-image/scala-update
args: --best --lzma

- name: upload ${{ matrix.os }}
uses: actions/upload-artifact@v2
if: ${{ startsWith(github.ref, 'refs/tags/') }}
- name: Upload Artifact
uses: actions/upload-artifact@v3
if: startsWith(github.ref, 'refs/tags/')
with:
name: ${{ matrix.artifact-name }}
path: target/graalvm-native-image/scala-update
path: target/native-image/scala-update

- name: release binaries
- name: Release Binaries
uses: svenstaro/upload-release-action@v2
if: ${{ startsWith(github.ref, 'refs/tags/') }}
if: startsWith(github.ref, 'refs/tags/')
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: target/graalvm-native-image/scala-update
file: target/native-image/scala-update
asset_name: ${{ matrix.artifact-name }}
overwrite: true
tag: ${{ github.ref }}

- id: get_version
if: ${{ matrix.os == 'macos' && startsWith(github.ref, 'refs/tags/') }}
uses: battila7/get-version-action@v2

- name: bump homebrew formula
env:
HOMEBREW_GITHUB_API_TOKEN: ${{ secrets.HOMEBREW_GITHUB_TOKEN }}
if: ${{ matrix.os == 'macos' && startsWith(github.ref, 'refs/tags/') }}
- name: Prepare Homebrew Formula Update (macOS only)
if: startsWith(github.ref, 'refs/tags/') && matrix.os == 'macos-latest'
run: |
brew tap kitlangton/tap
brew bump-formula-pr kitlangton/tap/scala-update -f --no-browse --no-audit \
--url="https://github.com/kitlangton/scala-update/releases/download/${{ steps.get_version.outputs.version }}/${{ matrix.artifact-name }}"
version=$(echo "${{ github.ref }}" | sed 's/refs\/tags\///')
brew bump-formula-pr kitlangton/tap/scala-update --no-browse --no-audit \
--url="https://github.com/kitlangton/scala-update/releases/download/${version}/${{ matrix.artifact-name }}"
env:
HOMEBREW_GITHUB_API_TOKEN: ${{ secrets.HOMEBREW_GITHUB_API_TOKEN }}
11 changes: 7 additions & 4 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@

.bsp
.idea
.bloop
.metals
.vscode
project/project/target/config-classes
project/target
target
.vscode
.metals
.bloop
project/project
project/metals.sbt
.DS_Store
3 changes: 0 additions & 3 deletions .scalafix.conf

This file was deleted.

17 changes: 6 additions & 11 deletions .scalafmt.conf
Original file line number Diff line number Diff line change
@@ -1,15 +1,10 @@
version = "3.0.6"
version = "3.8.0"
runner.dialect = scala3

maxColumn = 120
align.preset = most
align.multiline = false
continuationIndent.defnSite = 2
assumeStandardLibraryStripMargin = true
docstrings.style = Asterisk
rewrite.rules = [RedundantBraces, RedundantParens]
rewrite.scala3.convertToNewSyntax = true
rewrite.scala3.removeOptionalBraces = true
docstrings.wrapMaxColumn = 80
lineEndings = preserve
includeCurlyBraceInSelectChains = false
danglingParentheses.preset = true
optIn.annotationNewlines = true
newlines.alwaysBeforeMultilineDef = false
runner.dialect = scala213
rewrite.rules = [RedundantBraces, RedundantParens]
132 changes: 21 additions & 111 deletions build.sbt
Original file line number Diff line number Diff line change
@@ -1,121 +1,31 @@
inThisBuild(
List(
name := "scala-update",
normalizedName := "scala-update",
organization := "io.github.kitlangton",
scalaVersion := "2.13.8",
crossScalaVersions := Seq("2.13.8"),
homepage := Some(url("https://github.com/kitlangton/scala-update")),
licenses := List("Apache-2.0" -> url("http://www.apache.org/licenses/LICENSE-2.0")),
semanticdbEnabled := true,
semanticdbVersion := scalafixSemanticdb.revision,
developers := List(
Developer(
"kitlangton",
"Kit Langton",
"kit.langton@gmail.com",
url("https://github.com/kitlangton")
)
)
)
)
ThisBuild / version := "0.1.0-SNAPSHOT"

ThisBuild / scalaVersion := "3.4.1"

val zioVersion = "2.0.21"

val commonConfigurationVersion = "2.9.0"
val coursierVersion = "2.1.9"
val scalaMetaVersion = "4.9.2"
val zioCliVersion = "0.5.0"
val zioJsonVersion = "0.6.2"
val zioNioVersion = "2.0.2"
val zioTuiVersion = "0.2.2"
val zioVersion = "2.0.21"
// /Users/kit/code/terminus
//val terminusLocal = ProjectRef(file("/Users/kit/code/terminus"), "terminusZioJVM")

lazy val root = (project in file("."))
.enablePlugins(JavaAppPackaging)
.enablePlugins(NativeImagePlugin)
.settings(
name := "scala-update",
libraryDependencies ++= Seq(
"org.apache.commons" % "commons-configuration2" % commonConfigurationVersion,
"dev.zio" %% "zio" % zioVersion,
"dev.zio" %% "zio-cli" % zioCliVersion,
"dev.zio" %% "zio-macros" % zioVersion,
"dev.zio" %% "zio-nio" % zioNioVersion,
"dev.zio" %% "zio-json" % zioJsonVersion,
"dev.zio" %% "zio-streams" % zioVersion,
"dev.zio" %% "zio-test" % zioVersion % Test,
"dev.zio" %% "zio-test-magnolia" % zioVersion % Test,
"dev.zio" %% "zio-test-sbt" % zioVersion % Test,
"io.get-coursier" %% "coursier" % coursierVersion,
"org.scalameta" %% "scalameta" % scalaMetaVersion,
"io.github.kitlangton" %% "zio-tui" % zioTuiVersion
"org.scala-lang" %% "scala3-compiler" % "3.4.1",
"io.get-coursier" % "interface" % "1.0.19",
"com.lihaoyi" %% "pprint" % "0.8.1",
"dev.zio" %% "zio-nio" % "2.0.2",
"dev.zio" %% "zio" % zioVersion,
"dev.zio" %% "zio-streams" % zioVersion,
"dev.zio" %% "zio-test" % zioVersion % Test,
"io.github.kitlangton" %% "terminus-zio" % "0.0.9"
),
Compile / mainClass := Some("update.Main"),
testFrameworks += new TestFramework("zio.test.sbt.ZTestFramework"),
graalVMNativeImageOptions ++= Seq(
"--no-fallback",
"--enable-url-protocols=https",
"--report-unsupported-elements-at-runtime"
),
scalacOptions ++= Seq(
"-deprecation",
"-unchecked",
"-Wunused"
// "-Xfatal-warnings"
)
mainClass := Some("update.Main"),
nativeImageVersion := "21.0.2",
nativeImageJvm := "graalvm-java21"
)
.enablePlugins(GraalVMNativeImagePlugin)
// .dependsOn(terminusLocal)

Global / onChangedBuildSource := ReloadOnSourceChanges

// I use this so I can run `sbt run` in this project. Very lazy hack.
//lazy val example = Seq(
// "dev.zio" %% "zio" % "1.0.14",
// "dev.zio" %% "zio-macros" % "1.0.14",
// "dev.zio" %% "zio-nio" % zioNioVersion,
// "dev.zio" %% "zio-streams" % "1.0.14",
// "dev.zio" %% "zio-test" % "1.0.14" % Test,
// "dev.zio" %% "zio-test-sbt" % "1.0.14" % Test,
// "io.get-coursier" %% "coursier" % coursierVersion,
// "org.scalameta" %% "scalameta" % "4.5.8",
// "io.github.kitlangton" %% "zio-tui" % "0.1.1",
// "io.github.neurodyne" %% "zio-aws-s3" % "0.4.12",
// "io.d11" %% "zhttp" % "2.0.0-RC8",
// "com.coralogix" %% "zio-k8s-client" % "1.4.6",
// "com.softwaremill.sttp.client3" %% "async-http-client-backend-zio" % "3.6.1",
// "nl.vroste" %% "zio-kinesis" % "0.21.1",
// "com.vladkopanev" %% "zio-saga-core" % "0.3.0",
// "io.scalac" %% "zio-slick-interop" % "0.3",
// "com.typesafe.slick" %% "slick-hikaricp" % "3.3.2",
// "info.senia" %% "zio-test-akka-http" % "1.0.14",
// "io.getquill" %% "quill-jdbc-zio" % "3.18.0",
// "dev.zio" %% "zio-akka-cluster" % "0.3.0",
// "dev.zio" %% "zio-cache" % "0.2.0",
// "dev.zio" %% "zio-config-magnolia" % "3.0.1",
// "dev.zio" %% "zio-config-typesafe" % "3.0.1",
// "dev.zio" %% "zio-config-refined" % "3.0.1",
// "dev.zio" %% "zio-ftp" % "0.3.6",
// "dev.zio" %% "zio-json" % "0.3.0-RC8",
// // "dev.zio" %% "zio-kafka" % "2.0.0-RC5",
// "dev.zio" %% "zio-logging" % "0.5.14",
// "dev.zio" %% "zio-metrics-prometheus" % "1.0.14",
// "dev.zio" %% "zio-nio" % "1.0.0-RC11",
// "dev.zio" %% "zio-optics" % "0.2.0",
// "dev.zio" %% "zio-prelude" % "1.0.0-RC9",
// "dev.zio" %% "zio-process" % "0.7.0",
// "dev.zio" %% "zio-rocksdb" % "0.3.2",
// "dev.zio" %% "zio-s3" % "0.3.7",
// "dev.zio" %% "zio-schema" % "0.2.0",
// "dev.zio" %% "zio-sqs" % "0.4.3",
// "dev.zio" %% "zio-opentracing" % "0.8.3",
// "io.laserdisc" %% "tamer-db" % "0.18.1",
// "io.jaegertracing" % "jaeger-core" % "1.6.0",
// "io.jaegertracing" % "jaeger-client" % "1.6.0",
// "io.jaegertracing" % "jaeger-zipkin" % "1.6.0",
// "io.zipkin.reporter2" % "zipkin-reporter" % "2.16.3",
// "io.zipkin.reporter2" % "zipkin-sender-okhttp3" % "2.16.3",
// "dev.zio" %% "zio-interop-cats" % "3.3.0",
// "dev.zio" %% "zio-interop-scalaz7x" % "7.3.3.0",
// "dev.zio" %% "zio-interop-reactivestreams" % "1.3.12",
// "dev.zio" %% "zio-interop-twitter" % "20.10.2",
// "dev.zio" %% "zio-zmx" % "0.0.13",
// "dev.zio" %% "zio-query" % "0.3.0",
// "org.polynote" %% "uzhttp" % "0.2.8"
//)
2 changes: 1 addition & 1 deletion project/build.properties
Original file line number Diff line number Diff line change
@@ -1 +1 @@
sbt.version = 1.9.9
sbt.version = 1.9.9
11 changes: 7 additions & 4 deletions project/plugins.sbt
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
//addSbtPlugin("org.scalameta" % "sbt-native-image" % "0.3.2")
addSbtPlugin("com.github.sbt" % "sbt-native-packager" % "1.9.11")
addSbtPlugin("com.github.sbt" % "sbt-ci-release" % "1.5.11")
addSbtPlugin("ch.epfl.scala" % "sbt-scalafix" % "0.10.4")
addSbtPlugin("com.github.sbt" % "sbt-native-packager" % "1.9.16")
//addSbtPlugin("com.github.sbt" % "sbt-ci-release" % "1.0.0")
//addSbtPlugin("ch.epfl.scala" % "sbt-scalafix" % "2.0.1")
//addSbtPlugin("org.scalameta" % "sbt-native-image" % "0.6.0")
addSbtPlugin("org.scalameta" % "sbt-native-image" % "0.3.4")
addSbtPlugin("org.portable-scala" % "sbt-scala-native-crossproject" % "1.3.2")
addSbtPlugin("org.scala-native" % "sbt-scala-native" % "0.5.0-RC2")
28 changes: 0 additions & 28 deletions sbt

This file was deleted.

Binary file removed sbt-launch.jar
Binary file not shown.
2 changes: 0 additions & 2 deletions sbt.bat

This file was deleted.

7 changes: 0 additions & 7 deletions src/main/scala/update/AppError.scala

This file was deleted.

Loading

0 comments on commit 873eb88

Please sign in to comment.