Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add the CI release #551

Merged
merged 7 commits into from
Aug 26, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions .github/release-drafter.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name-template: '$NEXT_MINOR_VERSION'
tag-template: 'v$NEXT_MINOR_VERSION'
categories:
- title: 'Added'
labels:
- 'feature'
- title: 'Changed'
labels:
- 'enhancement'
- 'dependency-update'
- title: 'Fixed'
labels:
- 'fix'
- 'bug'
exclude-labels:
- 'skip-changelog'
- 'documentation'
- 'build/process improvement'
change-template: '- $TITLE [#$NUMBER](https://github.com/sbt/sbt-jni/pull/$NUMBER) (@$AUTHOR)'
template: |
$CHANGES
41 changes: 41 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,47 @@ jobs:
- name: Upload Codecov Results
run: codecov -F ${{ matrix.scala }}

publish:
name: Publish Artifacts
needs: [build]
if: github.event_name != 'pull_request' && (github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/tags/v'))
strategy:
matrix:
os: [ubuntu-latest]
scala: [2.12.14]
java: [adopt@1.8]
runs-on: ${{ matrix.os }}
steps:
- name: Checkout current branch (full)
uses: actions/checkout@v2
with:
fetch-depth: 0

- name: Setup Java and Scala
uses: olafurpg/setup-scala@v13
with:
java-version: ${{ matrix.java }}

- name: Cache sbt
uses: actions/cache@v2

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Member Author

@pomadchin pomadchin Aug 26, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@sideeffffect this file is generated via https://github.com/djspiewak/sbt-github-actions which is used by this project; I just added an extra code here to adjust generator.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, I see

with:
path: |
~/.sbt
~/.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') }}

- name: Publish artifacts
env:
PGP_PASSPHRASE: ${{ secrets.PGP_PASSPHRASE }}
PGP_SECRET: ${{ secrets.PGP_SECRET }}
SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }}
SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }}
run: sbt ++${{ matrix.scala }} ci-release

docs:
name: Documentation
strategy:
Expand Down
16 changes: 16 additions & 0 deletions .github/workflows/release-drafter.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
name: Release Drafter

on:
push:
branches:
- main
pull_request:
types: [opened, reopened, synchronize]

jobs:
update_release_draft:
runs-on: ubuntu-latest
steps:
- uses: release-drafter/release-drafter@v5.15.0
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -27,3 +27,8 @@ bin/
# OS X
.DS_Store
node_modules

# VSCode
cchantep marked this conversation as resolved.
Show resolved Hide resolved
.history
.metals
.vscode
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@

[![Workflow Badge](https://github.com/typelevel/frameless/actions/workflows/ci.yml/badge.svg?branch=master)](https://github.com/typelevel/frameless/actions/workflows/ci.yml)
[![Codecov Badge](https://codecov.io/gh/typelevel/frameless/branch/master/graph/badge.svg)](https://codecov.io/gh/typelevel/frameless)
[![Maven Badge](https://img.shields.io/maven-central/v/org.typelevel/frameless-dataset_2.12.svg)](https://maven-badges.herokuapp.com/maven-central/org.typelevel/frameless-dataset_2.12)
[![Discord Badge](https://img.shields.io/badge/chat-on%20discord-46BC99)](https://discord.gg/ZDZsxWcBJt)
[![Maven Badge](https://img.shields.io/maven-central/v/org.typelevel/frameless-core_2.12?color=blue)](https://search.maven.org/search?q=g:org.typelevel%20and%20frameless)
[![Snapshots Badge](https://img.shields.io/nexus/s/https/oss.sonatype.org/org.typelevel/frameless-core_2.12)](https://oss.sonatype.org/content/repositories/snapshots/org/typelevel/)

Frameless is a Scala library for working with [Spark](http://spark.apache.org/) using more expressive types.
It consists of the following modules:
Expand Down
124 changes: 62 additions & 62 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -10,42 +10,11 @@ val irrecVersion = "0.4.0"

val Scala212 = "2.12.14"

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

ThisBuild / crossScalaVersions := Seq(Scala212)
ThisBuild / scalaVersion := (ThisBuild / crossScalaVersions).value.last

ThisBuild / githubWorkflowPublishTargetBranches := Seq()

ThisBuild / githubWorkflowArtifactUpload := false

ThisBuild / githubWorkflowBuild := Seq(
WorkflowStep.Use(UseRef.Public("actions", "setup-python", "v2"),
name = Some("Setup Python"),
params = Map("python-version" -> "3.x")
),
WorkflowStep.Run(List("pip install codecov"),
name = Some("Setup codecov")
),
WorkflowStep.Sbt(List("coverage", "test", "coverageReport"),
name = Some("Test & Compute Coverage")
),
WorkflowStep.Run(List("codecov -F ${{ matrix.scala }}"),
name = Some("Upload Codecov Results")
)
)

ThisBuild / githubWorkflowAddedJobs ++= Seq(
WorkflowJob(
"docs",
"Documentation",
githubWorkflowJobSetup.value.toList ::: List(
WorkflowStep.Sbt(List("doc", "mdoc"),
name = Some("Documentation")
)
),
scalas = List(Scala212)
)
)

lazy val root = Project("frameless", file("." + "frameless")).in(file("."))
.aggregate(core, cats, dataset, ml, docs)
.settings(framelessSettings: _*)
Expand All @@ -70,8 +39,8 @@ lazy val cats = project
"org.typelevel" %% "cats-effect" % catsEffectVersion,
"org.typelevel" %% "cats-mtl-core" % catsMtlVersion,
"org.typelevel" %% "alleycats-core" % catsCoreVersion,
"org.apache.spark" %% "spark-core" % sparkVersion % "provided",
"org.apache.spark" %% "spark-sql" % sparkVersion % "provided"))
"org.apache.spark" %% "spark-core" % sparkVersion % Provided,
"org.apache.spark" %% "spark-sql" % sparkVersion % Provided))
.dependsOn(dataset % "test->test;compile->compile")

lazy val dataset = project
Expand All @@ -80,8 +49,8 @@ lazy val dataset = project
.settings(framelessTypedDatasetREPL: _*)
.settings(publishSettings: _*)
.settings(libraryDependencies ++= Seq(
"org.apache.spark" %% "spark-core" % sparkVersion % "provided",
"org.apache.spark" %% "spark-sql" % sparkVersion % "provided",
"org.apache.spark" %% "spark-core" % sparkVersion % Provided,
"org.apache.spark" %% "spark-sql" % sparkVersion % Provided,
"net.ceedubs" %% "irrec-regex-gen" % irrecVersion % Test
))
.dependsOn(core % "test->test;compile->compile")
Expand All @@ -92,9 +61,9 @@ lazy val ml = project
.settings(framelessTypedDatasetREPL: _*)
.settings(publishSettings: _*)
.settings(libraryDependencies ++= Seq(
"org.apache.spark" %% "spark-core" % sparkVersion % "provided",
"org.apache.spark" %% "spark-sql" % sparkVersion % "provided",
"org.apache.spark" %% "spark-mllib" % sparkVersion % "provided"
"org.apache.spark" %% "spark-core" % sparkVersion % Provided,
"org.apache.spark" %% "spark-sql" % sparkVersion % Provided,
"org.apache.spark" %% "spark-mllib" % sparkVersion % Provided
))
.dependsOn(
core % "test->test;compile->compile",
Expand All @@ -108,9 +77,9 @@ lazy val docs = project
.settings(scalacOptions --= Seq("-Xfatal-warnings", "-Ywarn-unused-import"))
.enablePlugins(MdocPlugin)
.settings(libraryDependencies ++= Seq(
"org.apache.spark" %% "spark-core" % sparkVersion,
"org.apache.spark" %% "spark-sql" % sparkVersion,
"org.apache.spark" %% "spark-mllib" % sparkVersion
"org.apache.spark" %% "spark-core" % sparkVersion,
"org.apache.spark" %% "spark-sql" % sparkVersion,
"org.apache.spark" %% "spark-mllib" % sparkVersion
))
.settings(
addCompilerPlugin("org.typelevel" % "kind-projector" % "0.13.0" cross CrossVersion.full),
Expand Down Expand Up @@ -142,6 +111,7 @@ lazy val framelessSettings = Seq(
"-Xfuture"
),
licenses += ("Apache-2.0", url("http://opensource.org/licenses/Apache-2.0")),
homepage := Some(url("https://typelevel.org/frameless")),
Test / testOptions += Tests.Argument(TestFrameworks.ScalaTest, "-oDF"),
libraryDependencies ++= Seq(
"com.chuusai" %% "shapeless" % shapeless,
Expand Down Expand Up @@ -186,18 +156,8 @@ lazy val framelessTypedDatasetREPL = Seq(
)

lazy val publishSettings = Seq(
publishMavenStyle := true,
publishTo := {
val nexus = "https://oss.sonatype.org/"
if (isSnapshot.value)
Some(Opts.resolver.sonatypeSnapshots)
else
Some(Opts.resolver.sonatypeStaging)
},
Test / publishArtifact := false,
pomIncludeRepository := Function.const(false),
pomExtra in Global := {
<url>https://github.com/typelevel/frameless</url>
<scm>
<url>git@github.com:typelevel/frameless.git</url>
<connection>scm:git:git@github.com:typelevel/frameless.git</connection>
Expand Down Expand Up @@ -243,19 +203,59 @@ lazy val noPublishSettings = Seq(
publishArtifact := false
)

lazy val credentialSettings = Seq(
// For Travis CI - see http://www.cakesolutions.net/teamblogs/publishing-artefacts-to-oss-sonatype-nexus-using-sbt-and-travis-ci
credentials ++= (for {
username <- Option(System.getenv().get("SONATYPE_USERNAME"))
password <- Option(System.getenv().get("SONATYPE_PASSWORD"))
} yield Credentials("Sonatype Nexus Repository Manager", "oss.sonatype.org", username, password)).toSeq
)


lazy val copyReadme = taskKey[Unit]("copy for website generation")
lazy val copyReadmeImpl = Def.task {
val from = baseDirectory.value / "README.md"
val to = baseDirectory.value / "docs" / "src" / "main" / "tut" / "README.md"
sbt.IO.copy(List((from, to)), overwrite = true, preserveLastModified = true, preserveExecutable = true)
}
copyReadme := copyReadmeImpl.value

ThisBuild / githubWorkflowArtifactUpload := false

ThisBuild / githubWorkflowBuild := Seq(
WorkflowStep.Use(UseRef.Public("actions", "setup-python", "v2"),
name = Some("Setup Python"),
params = Map("python-version" -> "3.x")
),
WorkflowStep.Run(List("pip install codecov"),
name = Some("Setup codecov")
),
WorkflowStep.Sbt(List("coverage", "test", "coverageReport"),
name = Some("Test & Compute Coverage")
),
WorkflowStep.Run(List("codecov -F ${{ matrix.scala }}"),
name = Some("Upload Codecov Results")
)
)

ThisBuild / githubWorkflowPublishTargetBranches := Seq(
RefPredicate.Equals(Ref.Branch("master")),
cchantep marked this conversation as resolved.
Show resolved Hide resolved
RefPredicate.StartsWith(Ref.Tag("v"))
)

ThisBuild / githubWorkflowPublish := Seq(
WorkflowStep.Sbt(
List("ci-release"),
name = Some("Publish artifacts"),
env = Map(
"PGP_PASSPHRASE" -> "${{ secrets.PGP_PASSPHRASE }}",
"PGP_SECRET" -> "${{ secrets.PGP_SECRET }}",
"SONATYPE_PASSWORD" -> "${{ secrets.SONATYPE_PASSWORD }}",
"SONATYPE_USERNAME" -> "${{ secrets.SONATYPE_USERNAME }}"
)
)
)

ThisBuild / githubWorkflowAddedJobs ++= Seq(
WorkflowJob(
"docs",
"Documentation",
githubWorkflowJobSetup.value.toList ::: List(
WorkflowStep.Sbt(List("doc", "mdoc"),
name = Some("Documentation")
)
),
scalas = List(Scala212)
)
)
5 changes: 2 additions & 3 deletions project/plugins.sbt
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
addSbtPlugin("org.xerial.sbt" % "sbt-sonatype" % "3.9.10")
addSbtPlugin("com.github.sbt" % "sbt-pgp" % "2.1.2")
addSbtPlugin("com.geirsson" % "sbt-ci-release" % "1.5.7")
addSbtPlugin("org.scoverage" % "sbt-scoverage" % "1.8.2")
addSbtPlugin("com.codecommit" % "sbt-github-actions" % "0.13.0")
addSbtPlugin("org.scalameta" % "sbt-mdoc" % "2.2.22")
addSbtPlugin("org.scalameta" % "sbt-mdoc" % "2.2.22")