Skip to content

Commit

Permalink
add ci
Browse files Browse the repository at this point in the history
  • Loading branch information
bangnh1 committed Aug 19, 2021
1 parent 7f8d860 commit 4e53f3d
Show file tree
Hide file tree
Showing 8 changed files with 92 additions and 38 deletions.
32 changes: 32 additions & 0 deletions .github/workflows/main.yml
@@ -0,0 +1,32 @@
name: Scala CI

on:
push:
branches: [ master]
tags:
- "v*"

jobs:
build:

runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2.3.4
with:
fetch-depth: 0
- uses: olafurpg/setup-scala@v10
- name: Import GPG key
id: import_gpg
uses: crazy-max/ghaction-import-gpg@v3
with:
gpg-private-key: ${{ secrets.GPG_PRIVATE_KEY }}
passphrase: ${{ secrets.PGP_PASSPHRASE }}
- name: Coursier cache
uses: coursier/cache-action@v5
- run: sbt ci-release
env:
PGP_PASSPHRASE: ${{ secrets.PGP_PASSPHRASE }}
PGP_SECRET: ${{ secrets.PGP_SECRET }}
SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }}
SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }}
CI_SONATYPE_RELEASE: ${{ secrets.CI_SONATYPE_RELEASE }}
7 changes: 6 additions & 1 deletion .gitignore
@@ -1,3 +1,8 @@
.idea
/project/target
/target
/target
.vscode
.metals
.bloop
metals.sbt
/project/project
File renamed without changes.
8 changes: 6 additions & 2 deletions README.md
@@ -1,12 +1,14 @@
# Snowflake4s
**A k-sortable unique ID generation lib using Scala.**

Snowflake4s can generate the roughly-sorted 64 bits ids as Long type. The name of this lib was inspired by a project from Twitter called "Snowflake". So, it's using the same encoded ID format as Twitter's Snowflake. But Snowflake4s providing the easier way to use Snowflake schema.
Snowflake4s can generate the roughly-sorted 64 bits ids as Long type written by Scala. The name of this lib was inspired by a project from Twitter called "Snowflake". So it's using the same encoded ID format as Twitter's Snowflake, but Snowflake4s providing the easier way to use Snowflake schema.

## Get Started
You should add the following dependency.
```sbtshell
libraryDependencies += "com.septech" %% "snowflake4s_2.12" % "0.0.1-ALPHA"
resolvers += Resolver.bintrayRepo("ngtung", "snowflake4s")
libraryDependencies += "septech.snowflake4s" % "snowflake4s_2.12" % "0.0.1"
```

Add manual config to `application.conf`:
Expand Down Expand Up @@ -38,6 +40,8 @@ val ids = IdGenerator.bulkGenerate(10)
The Snowflake4s is released under version 2.0 of the Apache License.

## References
- Slide:
- https://www.slideshare.net/nguyentungniit/distributed-unique-id-generation
- Twitter Snowflake
- https://github.com/twitter/snowflake/tree/scala_28
- https://blog.twitter.com/2010/announcing-snowflake
Expand Down
57 changes: 46 additions & 11 deletions build.sbt
@@ -1,18 +1,53 @@
name := "Snowflake4s"
ThisBuild / crossScalaVersions := List("2.12.14")
ThisBuild / version := "0.1.0-SNAPSHOT"

version := "0.0.1-ALPHA"

scalaVersion := "2.12.3"
inThisBuild(
List(
organization := "io.github.flintersvn",
homepage := Some(url("https://github.com/FlintersVN")),
licenses := List(
"Apache-2.0" -> url("http://www.apache.org/licenses/LICENSE-2.0")
),
developers := List(
Developer(
"tung_nt",
"Nguyen Thanh Tung",
"tung_nt@septeni-technology.jp",
url("https://github.com/NgTung")
),
Developer(
"huy_ngq",
"Nguyen Quang Huy",
"qhquanghuy96@gmail.com",
url("https://github.com/qhquanghuy")
),
Developer(
"bang_nh",
"Nguyen Huu Bang",
"bangnh24@gmail.com",
url("https://github.com/bangnh1")
)
)
)
)

libraryDependencies ++= Seq(
lazy val root = (project in file("."))
.settings(
name := "Snowflake4s",
libraryDependencies ++= Seq(
"com.typesafe" % "config" % "1.3.1",
"com.google.inject" % "guice" % "4.1.0",
"net.codingwell" %% "scala-guice" % "4.1.0"
)
)
)
.settings(
sonatypeCredentialHost := "s01.oss.sonatype.org",
sonatypeRepository := "https://s01.oss.sonatype.org/service/local",
sonatypeProfileName := "io.github.flintersvn"
)

// See https://www.scala-sbt.org/1.x/docs/Using-Sonatype.html for instructions on how to publish to Sonatype.

publishTo := Some(
if (isSnapshot.value)
Opts.resolver.sonatypeSnapshots
else
Opts.resolver.sonatypeStaging
Global / scalacOptions ++= Seq(
"-Xlint:unused"
)
2 changes: 1 addition & 1 deletion project/build.properties
@@ -1 +1 @@
sbt.version = 0.13.16
sbt.version=1.4.9
4 changes: 1 addition & 3 deletions project/plugins.sbt
@@ -1,3 +1 @@
// For sbt 0.13.x
addSbtPlugin("org.xerial.sbt" % "sbt-sonatype" % "1.1")
addSbtPlugin("com.jsuereth" % "sbt-pgp" % "1.0.0")
addSbtPlugin("com.geirsson" % "sbt-ci-release" % "1.5.7")
20 changes: 0 additions & 20 deletions sonatype.sbt

This file was deleted.

0 comments on commit 4e53f3d

Please sign in to comment.