Skip to content
This repository has been archived by the owner on Apr 20, 2024. It is now read-only.

Release publishing flow #122

Open
wants to merge 9 commits into
base: master
Choose a base branch
from
Open
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
27 changes: 27 additions & 0 deletions .github/workflows/pr.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: Pull Request
on:
pull_request:
jobs:
test:
name: Unit Tests
runs-on: ubuntu-latest
strategy:
matrix:
scala: [ "2.12.15", "2.13.8" ]
steps:
- uses: actions/checkout@v3
- uses: olafurpg/setup-scala@v13
with:
java-version: [email protected]
- uses: coursier/[email protected]
- run: sbt ++${{ matrix.scala }} test

format:
name: Check formatting
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: olafurpg/setup-scala@v13
with:
java-version: [email protected]
- run: sbt scalafmtCheckAll
25 changes: 25 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: Publish Release
on:
push:
branches: [master, main]
tags: ["*"]
jobs:
publish:
name: Publish to Sonatype Releases
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- uses: olafurpg/setup-scala@v13
with:
java-version: [email protected]
- uses: coursier/[email protected]
- run: sudo apt update && sudo apt install -y gnupg
- run: echo $PGP_SECRET | base64 --decode | gpg --batch --import
env:
PGP_SECRET: ${{ secrets.PGP_SECRET }}
Copy link
Contributor

Choose a reason for hiding this comment

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

Ditto (see the next msg)

- run: sbt +test ciReleaseTagNextVersion ciReleaseSonatype
env:
SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }}
SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }}
Comment on lines +24 to +25
Copy link
Contributor

Choose a reason for hiding this comment

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

Who owns these? I'm concerned that these might be lost somewhere when one of the dev's leave.

44 changes: 0 additions & 44 deletions .github/workflows/run-ci.yml

This file was deleted.

2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ test_run_dir/
*.fir
*.f
*.anno.json
/gnupg-*

### XilinxISE template
# intermediate build files
Expand Down Expand Up @@ -326,6 +327,7 @@ lib_managed/
src_managed/
project/boot/
project/plugins/project/
.bsp

# Scala-IDE specific
.scala_dependencies
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ Barstools

---

![Test](https://github.com/freechipsproject/ucb-bar/barstools/Test/badge.svg)
![CI Status](https://github.com/ucb-bar/barstools/actions/workflows/publish.yml/badge.svg)
Copy link
Contributor

Choose a reason for hiding this comment

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

If we are publishing to Sonatype, we should also update the readme to mention what needs to be added to peoples build.sbt files.


**Barstools** is a collection of useful utilities for BAR projects

Expand Down
72 changes: 49 additions & 23 deletions build.sbt
Original file line number Diff line number Diff line change
@@ -1,31 +1,57 @@
// See LICENSE for license details.

enablePlugins(GitVersioning)
addCompilerPlugin("edu.berkeley.cs" % "chisel3-plugin" % defaultVersions("chisel3") cross CrossVersion.full)

val defaultVersions = Map(
"chisel3" -> "3.5.1",
"chisel3" -> "3.5.3",
"chisel-iotesters" -> "2.5.1"
Copy link
Contributor

Choose a reason for hiding this comment

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

Nit: Should we just bump this to 2.5.4 anyways.

)

organization := "edu.berkeley.cs"
version := "0.4-SNAPSHOT"
name := "tapeout"
scalaVersion := "2.12.13"
crossScalaVersions := Seq("2.12.13", "2.13.6")
scalacOptions := Seq("-deprecation", "-feature", "-language:reflectiveCalls")
Test / scalacOptions ++= Seq("-language:reflectiveCalls")
fork := true
mainClass := Some("barstools.macros.MacroCompiler")
libraryDependencies ++= Seq("chisel3","chisel-iotesters").map {
dep: String => "edu.berkeley.cs" %% dep % sys.props.getOrElse(dep + "Version", defaultVersions(dep))
}
libraryDependencies ++= Seq(
"com.typesafe.play" %% "play-json" % "2.9.2",
"org.scalatest" %% "scalatest" % "3.2.9" % "test",
"org.apache.logging.log4j" % "log4j-api" % "2.11.2",
"org.apache.logging.log4j" % "log4j-core" % "2.11.2"
lazy val buildSettings = Seq(
organization := "edu.berkeley.cs",
// version computed by sbt-ci-release-early
name := "barstools",
scalaVersion := "2.12.15",
crossScalaVersions := Seq("2.12.15", "2.13.8"),
scalacOptions := Seq("-deprecation", "-feature", "-language:reflectiveCalls"),

Test / scalacOptions ++= Seq("-language:reflectiveCalls"),
fork := true,

mainClass := Some("barstools.macros.MacroCompiler"),

libraryDependencies ++= (Seq("chisel3","chisel-iotesters").map {
dep: String => "edu.berkeley.cs" %% dep % sys.props.getOrElse(dep + "Version", defaultVersions(dep))
}),

libraryDependencies ++= Seq(
"com.typesafe.play" %% "play-json" % "2.9.2",
"org.apache.logging.log4j" % "log4j-api" % "2.18.0",
"org.apache.logging.log4j" % "log4j-core" % "2.18.0",
"org.scalatest" %% "scalatest" % "3.2.9" % "test"
),

resolvers ++= Seq(
Resolver.sonatypeRepo("snapshots"),
Resolver.sonatypeRepo("releases"),
Resolver.mavenLocal
)
)
addCompilerPlugin("edu.berkeley.cs" % "chisel3-plugin" % defaultVersions("chisel3") cross CrossVersion.full)
resolvers ++= Seq(
Resolver.sonatypeRepo("snapshots"),
Resolver.sonatypeRepo("releases"),
Resolver.mavenLocal

lazy val publishSettings = Seq(
scmInfo := Some(ScmInfo(
url("https://github.com/ucb-bar/barstools"),
"scm:[email protected]:ucb-bar/barstools.git")),
licenses := List("BSD 3-Clause" -> url("https://opensource.org/licenses/BSD-3-Clause")),
developers := List(Developer("edwardcwang", "Edward Wang", "", url("https://github.com/edwardcwang")), Developer("chick", "Chick Markley", "", url("https://github.com/chick"))),
homepage := Some(url("https://github.com/ucb-bar/barstools/")),
publishTo := sonatypePublishToBundle.value,

Test / publishArtifact := false,
publishMavenStyle := true
)

lazy val barstools = (project in file("."))
.settings(buildSettings)
.settings(publishSettings)
2 changes: 1 addition & 1 deletion project/build.properties
Original file line number Diff line number Diff line change
@@ -1 +1 @@
sbt.version=1.3.13
sbt.version=1.6.2
1 change: 1 addition & 0 deletions project/plugins.sbt
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
addSbtPlugin("com.eed3si9n" % "sbt-assembly" % "0.14.5")
addSbtPlugin("org.scalameta" % "sbt-scalafmt" % "2.4.3")
addSbtPlugin("net.virtual-void" % "sbt-dependency-graph" % "0.9.2")
addSbtPlugin("io.shiftleft" % "sbt-ci-release-early" % "2.0.32")
Copy link
Contributor

Choose a reason for hiding this comment

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

Not related to this PR. I wonder if there is another plugin/CI-flow that auto-bumps the SBT versions, scala versions, etc (and if that is really needed).

Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ class GenerateTopSpec extends AnyFreeSpec with Matchers {
"Generate top and harness" - {
"should include the following transforms" in {
val targetDir = "test_run_dir/generate_top_and_harness"
val transformListName = s"$targetDir/ExampleModuleNeesResetInvertTransforms.log"
val transformListName = s"$targetDir/ExampleModuleNeedsResetInvertTransforms.log"
FileUtils.makeDirectory(targetDir)
(new ChiselStage).emitChirrtl(new ExampleModuleNeedsResetInverted, Array("--target-dir", targetDir))

Expand All @@ -24,7 +24,11 @@ class GenerateTopSpec extends AnyFreeSpec with Matchers {
"-ll",
"info",
"--log-file",
transformListName
transformListName,
"-o",
s"$targetDir/ExampleModuleNeedsResetInverted.top.v",
"-tho",
s"$targetDir/ExampleModuleNeedsResetInverted.harness.v"
)
)

Expand Down