From 9f6f2848b47fc0ae4e63c8638d85308659b020fc Mon Sep 17 00:00:00 2001 From: Vighnesh Iyer Date: Wed, 20 Jul 2022 17:31:51 -0700 Subject: [PATCH 1/9] ci release flow --- .github/workflows/run-ci.yml | 2 -- build.sbt | 17 +++++++++-------- project/build.properties | 2 +- project/plugins.sbt | 1 + 4 files changed, 11 insertions(+), 11 deletions(-) diff --git a/.github/workflows/run-ci.yml b/.github/workflows/run-ci.yml index bee78381..cf4cfee1 100644 --- a/.github/workflows/run-ci.yml +++ b/.github/workflows/run-ci.yml @@ -20,8 +20,6 @@ jobs: uses: olafurpg/setup-scala@v10 - name: Cache uses: coursier/cache-action@v5 - - name: Get submodules - run: git submodule update --init - name: Test run: sbt test diff --git a/build.sbt b/build.sbt index 1a972764..1b7e3c72 100644 --- a/build.sbt +++ b/build.sbt @@ -1,15 +1,15 @@ // See LICENSE for license details. val defaultVersions = Map( - "chisel3" -> "3.5.1", + "chisel3" -> "3.5.3", "chisel-iotesters" -> "2.5.1" ) organization := "edu.berkeley.cs" -version := "0.4-SNAPSHOT" -name := "tapeout" -scalaVersion := "2.12.13" -crossScalaVersions := Seq("2.12.13", "2.13.6") +//version := "0.5-SNAPSHOT" +name := "barstools" +scalaVersion := "2.12.16" +crossScalaVersions := Seq("2.12.16", "2.13.8") scalacOptions := Seq("-deprecation", "-feature", "-language:reflectiveCalls") Test / scalacOptions ++= Seq("-language:reflectiveCalls") fork := true @@ -19,9 +19,9 @@ libraryDependencies ++= Seq("chisel3","chisel-iotesters").map { } 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" + "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" ) addCompilerPlugin("edu.berkeley.cs" % "chisel3-plugin" % defaultVersions("chisel3") cross CrossVersion.full) resolvers ++= Seq( @@ -29,3 +29,4 @@ resolvers ++= Seq( Resolver.sonatypeRepo("releases"), Resolver.mavenLocal ) +enablePlugins(GitVersioning) diff --git a/project/build.properties b/project/build.properties index 0837f7a1..c8fcab54 100644 --- a/project/build.properties +++ b/project/build.properties @@ -1 +1 @@ -sbt.version=1.3.13 +sbt.version=1.6.2 diff --git a/project/plugins.sbt b/project/plugins.sbt index 5d6b1779..d939d901 100644 --- a/project/plugins.sbt +++ b/project/plugins.sbt @@ -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") From c8d2812817afa923c045bdf90429a70658ca9f8c Mon Sep 17 00:00:00 2001 From: Vighnesh Iyer Date: Wed, 20 Jul 2022 17:33:23 -0700 Subject: [PATCH 2/9] ignore .bsp --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index 12c0f6ad..50b4a4ab 100644 --- a/.gitignore +++ b/.gitignore @@ -326,6 +326,7 @@ lib_managed/ src_managed/ project/boot/ project/plugins/project/ +.bsp # Scala-IDE specific .scala_dependencies From 8eed8be30444ef3cbbfe0e52a71476c397e2aa9d Mon Sep 17 00:00:00 2001 From: Vighnesh Iyer Date: Wed, 20 Jul 2022 17:35:47 -0700 Subject: [PATCH 3/9] use scala 2.12.15 since chisel plugin doesnt exist for .16 yet --- build.sbt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/build.sbt b/build.sbt index 1b7e3c72..7fe8b40d 100644 --- a/build.sbt +++ b/build.sbt @@ -8,8 +8,8 @@ val defaultVersions = Map( organization := "edu.berkeley.cs" //version := "0.5-SNAPSHOT" name := "barstools" -scalaVersion := "2.12.16" -crossScalaVersions := Seq("2.12.16", "2.13.8") +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 From 32bbf505485579c1e621346fdf76bf54d94a0f6d Mon Sep 17 00:00:00 2001 From: Vighnesh Iyer Date: Wed, 20 Jul 2022 18:10:43 -0700 Subject: [PATCH 4/9] cleanup build.sbt for publishing --- build.sbt | 71 +++++++++++++++++++++++++++++++++++++------------------ 1 file changed, 48 insertions(+), 23 deletions(-) diff --git a/build.sbt b/build.sbt index 7fe8b40d..73fcd03e 100644 --- a/build.sbt +++ b/build.sbt @@ -1,32 +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.3", "chisel-iotesters" -> "2.5.1" ) -organization := "edu.berkeley.cs" -//version := "0.5-SNAPSHOT" -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" +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:git@github.com: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, ) -enablePlugins(GitVersioning) + +lazy val barstools = (project in file(".")) + .settings(buildSettings) + .settings(publishSettings) From ddcc68f862b548141efaa7314da2de10a377e286 Mon Sep 17 00:00:00 2001 From: Vighnesh Iyer Date: Wed, 20 Jul 2022 18:13:40 -0700 Subject: [PATCH 5/9] ignore gpg temp files --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index 50b4a4ab..bdf44def 100644 --- a/.gitignore +++ b/.gitignore @@ -5,6 +5,7 @@ test_run_dir/ *.fir *.f *.anno.json +/gnupg-* ### XilinxISE template # intermediate build files From 3283c4bd77d4606125a459f925b27f68ae2f9d25 Mon Sep 17 00:00:00 2001 From: Vighnesh Iyer Date: Fri, 29 Jul 2022 16:40:46 -0700 Subject: [PATCH 6/9] skip publishing, tests shouldnt emit files --- README.md | 2 +- build.sbt | 1 + .../barstools/tapeout/transforms/GenerateTopSpec.scala | 8 ++++++-- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 30d55252..c050e3f0 100644 --- a/README.md +++ b/README.md @@ -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/run-ci.yml/badge.svg) **Barstools** is a collection of useful utilities for BAR projects diff --git a/build.sbt b/build.sbt index 73fcd03e..3e9c32ff 100644 --- a/build.sbt +++ b/build.sbt @@ -50,6 +50,7 @@ lazy val publishSettings = Seq( Test / publishArtifact := false, publishMavenStyle := true, + publish / skip := true // disable publishing until a tag is properly set via another PR ) lazy val barstools = (project in file(".")) diff --git a/src/test/scala/barstools/tapeout/transforms/GenerateTopSpec.scala b/src/test/scala/barstools/tapeout/transforms/GenerateTopSpec.scala index d967c8df..9a5255ea 100644 --- a/src/test/scala/barstools/tapeout/transforms/GenerateTopSpec.scala +++ b/src/test/scala/barstools/tapeout/transforms/GenerateTopSpec.scala @@ -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)) @@ -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", ) ) From c40dbc634ce420df03ab7421efcb468f954d52f5 Mon Sep 17 00:00:00 2001 From: Vighnesh Iyer Date: Thu, 4 Aug 2022 17:29:28 -0700 Subject: [PATCH 7/9] fix format --- .../scala/barstools/tapeout/transforms/GenerateTopSpec.scala | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/test/scala/barstools/tapeout/transforms/GenerateTopSpec.scala b/src/test/scala/barstools/tapeout/transforms/GenerateTopSpec.scala index 9a5255ea..b6e5ba90 100644 --- a/src/test/scala/barstools/tapeout/transforms/GenerateTopSpec.scala +++ b/src/test/scala/barstools/tapeout/transforms/GenerateTopSpec.scala @@ -28,7 +28,7 @@ class GenerateTopSpec extends AnyFreeSpec with Matchers { "-o", s"$targetDir/ExampleModuleNeedsResetInverted.top.v", "-tho", - s"$targetDir/ExampleModuleNeedsResetInverted.harness.v", + s"$targetDir/ExampleModuleNeedsResetInverted.harness.v" ) ) From c8d8fe3ec3818e5409a63af284865d26084d9cae Mon Sep 17 00:00:00 2001 From: Vighnesh Iyer Date: Fri, 5 Aug 2022 15:18:08 -0700 Subject: [PATCH 8/9] add pr and publish workflows --- .github/workflows/pr.yml | 27 ++++++++++++++++++++++ .github/workflows/publish.yml | 25 +++++++++++++++++++++ .github/workflows/run-ci.yml | 42 ----------------------------------- build.sbt | 3 +-- 4 files changed, 53 insertions(+), 44 deletions(-) create mode 100644 .github/workflows/pr.yml create mode 100644 .github/workflows/publish.yml delete mode 100644 .github/workflows/run-ci.yml diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml new file mode 100644 index 00000000..33623f91 --- /dev/null +++ b/.github/workflows/pr.yml @@ -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: openjdk@1.17 + - uses: coursier/cache-action@v6.3 + - 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: openjdk@1.17 + - run: sbt scalafmtCheckAll diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml new file mode 100644 index 00000000..20c6b3ea --- /dev/null +++ b/.github/workflows/publish.yml @@ -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: openjdk@1.17 + - uses: coursier/cache-action@v6.3 + - run: sudo apt update && sudo apt install -y gnupg + - run: echo $PGP_SECRET | base64 --decode | gpg --batch --import + env: + PGP_SECRET: ${{ secrets.PGP_SECRET }} + - run: sbt +test ciReleaseTagNextVersion ciReleaseSonatype + env: + SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }} + SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }} diff --git a/.github/workflows/run-ci.yml b/.github/workflows/run-ci.yml deleted file mode 100644 index cf4cfee1..00000000 --- a/.github/workflows/run-ci.yml +++ /dev/null @@ -1,42 +0,0 @@ -name: Test - -on: - pull_request: - push: - branches: - - master - -jobs: - test: - name: Unit Tests - runs-on: ubuntu-latest - strategy: - matrix: - scala: [ 2.12.14 ] - steps: - - name: Checkout - uses: actions/checkout@v2 - - name: Setup Scala - uses: olafurpg/setup-scala@v10 - - name: Cache - uses: coursier/cache-action@v5 - - name: Test - run: sbt test - - doc: - name: Documentation and formatting - runs-on: ubuntu-latest - steps: - - name: Checkout - uses: actions/checkout@v2 - - name: Setup Scala - uses: olafurpg/setup-scala@v10 - - name: Check Formatting - run: sbt scalafmtCheckAll - - all_test_passed: - name: "all tests passed" - runs-on: ubuntu-latest - needs: [test, doc] - steps: - - run: echo Success diff --git a/build.sbt b/build.sbt index 3e9c32ff..8bfba400 100644 --- a/build.sbt +++ b/build.sbt @@ -49,8 +49,7 @@ lazy val publishSettings = Seq( publishTo := sonatypePublishToBundle.value, Test / publishArtifact := false, - publishMavenStyle := true, - publish / skip := true // disable publishing until a tag is properly set via another PR + publishMavenStyle := true ) lazy val barstools = (project in file(".")) From 67a43b3e4c70ff2ce72eddd3d1d59e59b8941ee7 Mon Sep 17 00:00:00 2001 From: Vighnesh Iyer Date: Fri, 5 Aug 2022 16:13:26 -0700 Subject: [PATCH 9/9] fix readme badge --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index c050e3f0..36e7ebe9 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,7 @@ Barstools --- -![CI Status](https://github.com/ucb-bar/barstools/actions/workflows/run-ci.yml/badge.svg) +![CI Status](https://github.com/ucb-bar/barstools/actions/workflows/publish.yml/badge.svg) **Barstools** is a collection of useful utilities for BAR projects