diff --git a/.github/workflows/backport-fixup.yml b/.github/workflows/backport-fixup.yml index 86b73f4e326..af96a054e22 100644 --- a/.github/workflows/backport-fixup.yml +++ b/.github/workflows/backport-fixup.yml @@ -28,7 +28,7 @@ jobs: original_pr: ${{ steps.original.outputs.pr }} steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Figure out backport PR number id: backport run: | @@ -57,7 +57,7 @@ jobs: if: ${{ needs.resolve_prs.outputs.original_pr }} steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Copy over labels env: GH_TOKEN: ${{ github.token }} diff --git a/.github/workflows/build-scala-cli-example/action.yml b/.github/workflows/build-scala-cli-example/action.yml index 6fe9fa0ed0f..0924c7c6f3d 100644 --- a/.github/workflows/build-scala-cli-example/action.yml +++ b/.github/workflows/build-scala-cli-example/action.yml @@ -26,7 +26,7 @@ runs: # Need to publishLocal to test the example - name: Publish Local shell: bash - run: sbt publishLocal + run: sbt "unipublish / publishLocal" - name: Test Scala CLI Example shell: bash run: scala-cli chisel-example.scala diff --git a/.github/workflows/enable-bincompat-checking.yml b/.github/workflows/enable-bincompat-checking.yml index 6d7e8ae7f05..b5cc9c0a8e2 100644 --- a/.github/workflows/enable-bincompat-checking.yml +++ b/.github/workflows/enable-bincompat-checking.yml @@ -37,7 +37,7 @@ jobs: branches: ${{ steps.determine-branches.outputs.branches }} steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 with: fetch-depth: 0 - name: Check Valid @@ -70,14 +70,14 @@ jobs: branch: ${{ fromJson(needs.determine_branches.outputs.branches) }} steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Create file run: | VERSION=${{ needs.determine_version.outputs.version }} VERSION_NO_V=${VERSION#v} echo $VERSION_NO_V >> project/previous-versions.txt - name: Open PR - uses: peter-evans/create-pull-request@v5 + uses: peter-evans/create-pull-request@v6 with: base: ${{ matrix.branch }} branch: bincompat/${{ matrix.branch }}/${{ needs.determine_version.outputs.version }} diff --git a/.github/workflows/install-espresso/action.yml b/.github/workflows/install-espresso/action.yml index fb1d655aafa..e43775e3df0 100644 --- a/.github/workflows/install-espresso/action.yml +++ b/.github/workflows/install-espresso/action.yml @@ -10,7 +10,7 @@ runs: using: composite steps: - id: cache-espresso - uses: actions/cache@v3 + uses: actions/cache@v4 with: path: /usr/local/bin/espresso key: espresso-${{ runner.os }}-${{ inputs.version }} diff --git a/.github/workflows/release-notes.yml b/.github/workflows/release-notes.yml index f3bac67dbaa..9535763777b 100644 --- a/.github/workflows/release-notes.yml +++ b/.github/workflows/release-notes.yml @@ -18,7 +18,7 @@ on: jobs: generate_release_notes: name: Generate Release Notes - runs-on: ubuntu-22.04 + runs-on: ubuntu-latest steps: - name: Checkout @@ -41,7 +41,7 @@ jobs: run: echo "$CHANGELOG" >> $GITHUB_STEP_SUMMARY - name: Upload Release Notes (on release) if: github.event_name == 'release' - uses: softprops/action-gh-release@v0.1.15 + uses: softprops/action-gh-release@v2.0.5 with: body: ${{ steps.release-notes.outputs.changelog }} - name: Error on uncategorized PRs diff --git a/.github/workflows/scala-cli-example.yml b/.github/workflows/scala-cli-example.yml index 329b0f12aeb..6ef9185defa 100644 --- a/.github/workflows/scala-cli-example.yml +++ b/.github/workflows/scala-cli-example.yml @@ -12,21 +12,21 @@ jobs: steps: - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 # Need to fetch full history for deriving version with: fetch-depth: 0 - name: Build and Test Scala-CLI Example uses: ./.github/workflows/build-scala-cli-example - name: Upload Example - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: name: chisel-example.scala path: chisel-example.scala retention-days: 7 - name: Upload To Release Page if: github.event_name == 'release' - uses: softprops/action-gh-release@v0.1.15 + uses: softprops/action-gh-release@v2.0.5 with: files: chisel-example.scala diff --git a/.github/workflows/setup-oss-cad-suite/action.yml b/.github/workflows/setup-oss-cad-suite/action.yml index 63d70e926bb..3b881db718b 100644 --- a/.github/workflows/setup-oss-cad-suite/action.yml +++ b/.github/workflows/setup-oss-cad-suite/action.yml @@ -10,7 +10,7 @@ runs: using: composite steps: - id: cache-oss-cad-suite - uses: actions/cache@v3 + uses: actions/cache@v4 with: path: oss-cad-suite key: oss-cad-suite-${{ runner.os }}-${{ inputs.version }} diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 412cab69fef..3c0b35a713a 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -1,15 +1,14 @@ name: Continuous Integration on: + workflow_dispatch: pull_request: push: + tags: + - '*' branches: - - master - - 3.6.x - - 3.5.x - - 3.4.x - - 3.3.x - - 3.2.x + - main + - '*.x' jobs: ci: @@ -25,7 +24,7 @@ jobs: steps: - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Install Tabby OSS Cad Suite uses: ./.github/workflows/setup-oss-cad-suite - name: Install Espresso @@ -33,7 +32,7 @@ jobs: with: version: ${{ matrix.espresso }} - name: Setup Scala - uses: actions/setup-java@v3 + uses: actions/setup-java@v4 with: distribution: 'adopt' java-version: ${{ matrix.jvm }} @@ -45,16 +44,16 @@ jobs: - name: Test run: sbt ++${{ matrix.scala }} test - name: Binary compatibility - run: sbt ++${{ matrix.scala }} mimaReportBinaryIssues + run: sbt ++${{ matrix.scala }} unipublish/mimaReportBinaryIssues doc: name: Formatting runs-on: ubuntu-20.04 steps: - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Setup Scala - uses: actions/setup-java@v3 + uses: actions/setup-java@v4 with: distribution: 'adopt' java-version: '11' @@ -66,10 +65,10 @@ jobs: integration: name: Integration Tests (w/ chiseltest) - runs-on: ubuntu-20.04 + runs-on: ubuntu-latest steps: - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Install Tabby OSS Cad Suite uses: ./.github/workflows/setup-oss-cad-suite - name: Install Espresso @@ -77,7 +76,7 @@ jobs: - name: Install CIRCT uses: ./.github/workflows/install-circt - name: Setup Scala - uses: actions/setup-java@v3 + uses: actions/setup-java@v4 with: distribution: 'adopt' java-version: '11' @@ -98,11 +97,11 @@ jobs: scala: [ "2.13.10", "2.12.17" ] steps: - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Install Tabby OSS Cad Suite uses: ./.github/workflows/setup-oss-cad-suite - name: Setup Scala - uses: actions/setup-java@v3 + uses: actions/setup-java@v4 with: distribution: 'adopt' java-version: '11' @@ -113,48 +112,12 @@ jobs: - name: Unit Tests run: sbt ++${{ matrix.scala }} standardLibrary/test - website: - name: Build Mdoc & Website - runs-on: ubuntu-latest - - steps: - - name: Checkout - uses: actions/checkout@v2 - - name: Setup Scala - uses: olafurpg/setup-scala@v10 - with: - java-version: adopt@1.8 - - name: Cache Scala - uses: coursier/cache-action@v5 - - name: Setup Ruby - uses: actions/setup-ruby@v1 - - name: Setup Jekyll - run: | - gem install jekyll -v 4.2.0 - gem install jekyll-redirect-from - - name: Install CIRCT - uses: ./.github/workflows/install-circt - #TODO: make the microsite building include building ScalaDoc - - name: Build the docs - run: sbt doc - - name: Build the microsite - run: make -C website - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - name: Tar built website - run: tar zcf website.tar.gz website/docs/target/site - - name: Share Built Website - uses: actions/upload-artifact@v3 - with: - name: website - path: website.tar.gz - scala-cli-example: name: Test Chisel Scala-CLI Example runs-on: ubuntu-latest steps: - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 # Need to fetch full history for deriving version with: fetch-depth: 0 @@ -167,7 +130,7 @@ jobs: # When adding new jobs, please add them to `needs` below check-tests: name: "check tests" - needs: [ci, integration, std, doc, website, scala-cli-example] + needs: [ci, integration, std, doc, scala-cli-example] runs-on: ubuntu-20.04 if: success() # only run if all tests have passed outputs: @@ -208,11 +171,13 @@ jobs: steps: - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 + with: + fetch-depth: 0 - name: Install CIRCT uses: ./.github/workflows/install-circt - name: Setup Scala - uses: actions/setup-java@v3 + uses: actions/setup-java@v4 with: distribution: 'adopt' java-version: '8' @@ -222,6 +187,8 @@ jobs: - name: Publish run: sbt -DdisableFatalWarnings ci-release env: + CI_SNAPSHOT_RELEASE: "+unipublish/publish" + CI_SONATYPE_RELEASE: "+unipublish/publishSigned" PGP_PASSPHRASE: ${{ secrets.PGP_PASSPHRASE }} PGP_SECRET: ${{ secrets.PGP_SECRET }} SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }} diff --git a/build.sbt b/build.sbt index fdcffa60508..4b5e7f4ecd3 100644 --- a/build.sbt +++ b/build.sbt @@ -37,19 +37,10 @@ emitVersion := { IO.write(new java.io.File("version.txt"), version.value) } -val defaultVersions = Map( - "firrtl" -> "edu.berkeley.cs" %% "firrtl" % "1.6-SNAPSHOT" - // chiseltest intentionally excluded so that release automation does not try to set its version - // The projects using chiseltest are not published, but SBT resolves dependencies for all projects - // when doing publishing and will not find a chiseltest release since chiseltest depends on - // chisel3 -) - lazy val commonSettings = Seq( resolvers ++= Resolver.sonatypeOssRepos("snapshots"), resolvers ++= Resolver.sonatypeOssRepos("releases"), organization := "edu.berkeley.cs", - version := "3.6-SNAPSHOT", autoAPIMappings := true, scalaVersion := "2.13.10", crossScalaVersions := Seq("2.13.10", "2.12.17"), @@ -97,13 +88,27 @@ lazy val warningSuppression = Seq( ).mkString(",") ) +// This should only be mixed in by projects that are published +// See 'unipublish' project below lazy val publishSettings = Seq( versionScheme := Some("pvp"), publishMavenStyle := true, Test / publishArtifact := false, + pomIncludeRepository := { x => false }, + homepage := Some(url("https://www.chisel-lang.org")), + organizationHomepage := Some(url("https://www.chipsalliance.org")), + licenses := List(License.Apache2), + developers := List( + Developer("jackbackrack", "Jonathan Bachrach", "", url("http://www.eecs.berkeley.edu/~jrb/")) + ), // We are just using 'publish / skip' as a hook to run checks required for publishing, // but that are not necessarily required for local development or running testing in CI publish / skip := { + // Check that SBT Dynver can properly derive a version which requires unshallow clone + val v = version.value + if (dynverGitDescribeOutput.value.hasNoTags) { + sys.error(s"Failed to derive version from git tags. Maybe run `git fetch --unshallow`? Version: $v") + } // Check that firtool exists on the PATH so Chisel can use the version it was tested against // in error messages if (firtoolVersion.value.isEmpty) { @@ -111,22 +116,6 @@ lazy val publishSettings = Seq( } (publish / skip).value }, - pomIncludeRepository := { x => false }, - pomExtra := http://chisel.eecs.berkeley.edu/ - - - apache-v2 - https://opensource.org/licenses/Apache-2.0 - repo - - - - - jackbackrack - Jonathan Bachrach - http://www.eecs.berkeley.edu/~jrb/ - - , publishTo := { val v = version.value val nexus = "https://oss.sonatype.org/" @@ -232,17 +221,12 @@ lazy val usePluginSettings = Seq( lazy val macros = (project in file("macros")) .settings(name := "chisel3-macros") .settings(commonSettings: _*) - .settings(publishSettings: _*) .settings( - mimaPreviousArtifacts := previousVersions.value.map { version => - organization.value %% name.value % version - } + // Published as part of unipublish + publish / skip := true ) -lazy val firrtlRef = ProjectRef(workspaceDirectory / "firrtl", "firrtl") - lazy val core = (project in file("core")) - .sourceDependency(firrtlRef, defaultVersions("firrtl")) .settings(commonSettings: _*) .enablePlugins(BuildInfoPlugin) .settings( @@ -250,22 +234,16 @@ lazy val core = (project in file("core")) buildInfoUsePackageAsPath := true, buildInfoKeys := Seq[BuildInfoKey](buildInfoPackage, version, scalaVersion, sbtVersion, firtoolVersion) ) - .settings(publishSettings: _*) .settings( - mimaPreviousArtifacts := previousVersions.value.map { version => - organization.value %% name.value % version - }, - // MiMa waivers - mimaBinaryIssueFilters ++= Seq( - // Technically users could extend LitArg but its in an internal package and there is no reason to. - ProblemFilters.exclude[ReversedMissingMethodProblem]("chisel3.internal.firrtl.LitArg.cloneWithValue") - ) + // Published as part of unipublish + publish / skip := true ) .settings(warningSuppression: _*) .settings(fatalWarningsSettings: _*) .settings( name := "chisel3-core", libraryDependencies ++= Seq( + "edu.berkeley.cs" %% "firrtl" % "1.6.0", "com.lihaoyi" %% "upickle" % "2.0.0", "com.lihaoyi" %% "os-lib" % "0.8.1" ), @@ -288,7 +266,6 @@ lazy val chisel = (project in file(".")) .enablePlugins(ScalaUnidocPlugin) .settings(commonSettings: _*) .settings(chiselSettings: _*) - .settings(publishSettings: _*) .settings(usePluginSettings: _*) .dependsOn(macros) .dependsOn(core) @@ -296,51 +273,9 @@ lazy val chisel = (project in file(".")) .settings(warningSuppression: _*) .settings(fatalWarningsSettings: _*) .settings( - mimaPreviousArtifacts := previousVersions.value.map { version => - organization.value %% name.value % version - }, - Test / scalacOptions ++= Seq("-language:reflectiveCalls"), - // Forward doc command to unidoc - Compile / doc := (ScalaUnidoc / doc).value, - // Include unidoc as the ScalaDoc for publishing - Compile / packageDoc / mappings := (ScalaUnidoc / packageDoc / mappings).value, - Compile / doc / scalacOptions ++= Seq( - "-diagrams", - "-groups", - "-skip-packages", - "chisel3.internal", - "-diagrams-max-classes", - "25", - "-doc-version", - version.value, - "-doc-title", - name.value, - "-doc-root-content", - baseDirectory.value + "/root-doc.txt", - "-sourcepath", - (ThisBuild / baseDirectory).value.toString, - "-doc-source-url", { - val branch = - if (version.value.endsWith("-SNAPSHOT")) { - "master" - } else { - s"v${version.value}" - } - s"https://github.com/chipsalliance/chisel3/tree/$branch€{FILE_PATH_EXT}#L€{FILE_LINE}" - } - ) ++ - // Suppress compiler plugin for source files in core - // We don't need this in regular compile because we just don't add the chisel3-plugin to core's scalacOptions - // This works around an issue where unidoc uses the exact same arguments for all source files. - // This is probably fundamental to how ScalaDoc works so there may be no solution other than this workaround. - // See https://github.com/sbt/sbt-unidoc/issues/107 - (core / Compile / sources).value.map("-P:chiselplugin:INTERNALskipFile:" + _) - ++ { - CrossVersion.partialVersion(scalaVersion.value) match { - case Some((2, n)) if n >= 13 => "-implicits" :: Nil - case _ => Nil - } - } + // Published as part of unipublish + publish / skip := true, + Test / scalacOptions ++= Seq("-language:reflectiveCalls") ) // tests elaborating and executing/formally verifying a Chisel circuit with chiseltest @@ -354,10 +289,96 @@ lazy val integrationTests = (project in file("integration-tests")) .settings(usePluginSettings: _*) .settings( Seq( - libraryDependencies += "edu.berkeley.cs" %% "chiseltest" % "0.6-SNAPSHOT" % "test" + libraryDependencies += "edu.berkeley.cs" %% "chiseltest" % "0.6.2" % "test" ) ) +def addUnipublishDeps(proj: Project)(deps: Project*): Project = { + def inTestScope(module: ModuleID): Boolean = module.configurations.exists(_ == "test") + deps.foldLeft(proj) { + case (p, dep) => + p.settings( + libraryDependencies ++= (dep / libraryDependencies).value.filterNot(inTestScope), + Compile / packageBin / mappings ++= (dep / Compile / packageBin / mappings).value, + Compile / packageSrc / mappings ++= (dep / Compile / packageSrc / mappings).value + ) + } +} + +// This is a pseudo-project that unifies all compilation units (excluding the plugin) into a single artifact +// It should be used for all publishing and MiMa binary compatibility checking +lazy val unipublish = + addUnipublishDeps(project in file("unipublish"))( + macros, + core, + chisel + ) + .aggregate(plugin) // Also publish the plugin when publishing this project + .settings(name := (chisel / name).value) + .enablePlugins(ScalaUnidocPlugin) + .settings(commonSettings: _*) + .settings(publishSettings: _*) + .settings(usePluginSettings: _*) + .settings(warningSuppression: _*) + .settings(fatalWarningsSettings: _*) + .settings( + mimaPreviousArtifacts := previousVersions.value.flatMap { version => + Seq( + "edu.berkeley.cs" %% "chisel3" % version, + "edu.berkeley.cs" %% "chisel3-core" % version + ) + }, + // This is a pseudo-project with no class files, use the package jar instead + mimaCurrentClassfiles := (Compile / packageBin).value, + // MiMa waivers + mimaBinaryIssueFilters ++= Seq( + // Technically users could extend LitArg but its in an internal package and there is no reason to. + ProblemFilters.exclude[ReversedMissingMethodProblem]("chisel3.internal.firrtl.LitArg.cloneWithValue") + ), + // Forward doc command to unidoc + Compile / doc := (ScalaUnidoc / doc).value, + // Include unidoc as the ScalaDoc for publishing + Compile / packageDoc / mappings := (ScalaUnidoc / packageDoc / mappings).value, + Compile / doc / scalacOptions ++= Seq( + "-diagrams", + "-groups", + "-skip-packages", + "chisel3.internal", + "-diagrams-max-classes", + "25", + "-doc-version", + version.value, + "-doc-title", + name.value, + "-doc-root-content", + baseDirectory.value + "/root-doc.txt", + "-sourcepath", + (ThisBuild / baseDirectory).value.toString, + "-doc-source-url", { + val branch = + if (version.value.endsWith("-SNAPSHOT")) { + "master" + } else { + s"v${version.value}" + } + s"https://github.com/chipsalliance/chisel/tree/$branch€{FILE_PATH_EXT}#L€{FILE_LINE}" + }, + "-language:implicitConversions" + ) ++ + // Suppress compiler plugin for source files in core + // We don't need this in regular compile because we just don't add the chisel-plugin to core's scalacOptions + // This works around an issue where unidoc uses the exact same arguments for all source files. + // This is probably fundamental to how ScalaDoc works so there may be no solution other than this workaround. + // See https://github.com/sbt/sbt-unidoc/issues/107 + (core / Compile / sources).value.map("-P:chiselplugin:INTERNALskipFile:" + _) + ++ { + CrossVersion.partialVersion(scalaVersion.value) match { + case Some((2, n)) if n >= 13 => "-implicits" :: Nil + case _ => Nil + } + } + ) + // the chisel standard library lazy val standardLibrary = (project in file("stdlib")) .dependsOn(chisel) diff --git a/project/previous-versions.txt b/project/previous-versions.txt index 40c341bdcdb..e69de29bb2d 100644 --- a/project/previous-versions.txt +++ b/project/previous-versions.txt @@ -1 +0,0 @@ -3.6.0