Skip to content
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
44 changes: 44 additions & 0 deletions .github/workflows/release2.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
#
# Copyright 2022 ABSA Group Limited
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#

name: Release2

on:
workflow_dispatch:

Comment on lines +19 to +21
Copy link
Contributor

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

Trigger releases on tags to publish non-SNAPSHOTs.

ci-release expects tag-driven versions (with dynver). Add a push tag trigger so “vX.Y.Z” runs a release. (github.com)

 on:
-  workflow_dispatch:
+  workflow_dispatch:
+  push:
+    tags:
+      - "v*"
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
on:
workflow_dispatch:
on:
workflow_dispatch:
push:
tags:
- "v*"
🤖 Prompt for AI Agents
In .github/workflows/release2.yaml around lines 19 to 21, the workflow is only
triggered by workflow_dispatch but needs a push tag trigger so ci-release runs
for version tags; update the on: section to include a push trigger for tag
patterns (e.g. push: tags: - 'v*.*.*') alongside workflow_dispatch so pushes of
vX.Y.Z tags will run the release workflow.

defaults:
run:
shell: bash

jobs:
publish:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/[email protected]
with:
distribution: temurin
java-version: 8
cache: sbt
- name: Build and release to Sonatype and Maven Central
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 }}
13 changes: 6 additions & 7 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,11 @@ lazy val cobrix = (project in file("."))
.disablePlugins(sbtassembly.AssemblyPlugin)
.settings(
name := "cobrix",
crossScalaVersions := List(scala211, scala212, scala213),

// No need to publish the aggregation [empty] artifact
publishArtifact := false,
publish / skip := true,
publish := {},
publishLocal := {}
)
Expand All @@ -65,13 +67,13 @@ lazy val cobolParser = (project in file("cobol-parser"))
.enablePlugins(AutomateHeaderPlugin)
.settings(
name := "cobol-parser",
crossScalaVersions := List(scala211, scala212, scala213),
libraryDependencies ++= CobolParserDependencies :+ getScalaDependency(scalaVersion.value),
shadedDependencies ++= CobolParserShadedDependencies,
shadingRules ++= Seq (
ShadingRule.moveUnder("org.antlr.v4.runtime", "za.co.absa.cobrix.cobol.parser.shaded")
),
validNamespaces ++= Set("za"),
releasePublishArtifactsAction := PgpKeys.publishSigned.value,
assemblySettings,
jacocoReportSettings := commonJacocoReportSettings.withTitle("cobrix:cobol-parser Jacoco Report"),
jacocoExcludes := commonJacocoExcludes
Expand All @@ -83,16 +85,19 @@ lazy val cobolConverters = (project in file("cobol-converters"))
.enablePlugins(AutomateHeaderPlugin)
.settings(
name := "cobol-converters",
crossScalaVersions := List(scala211, scala212, scala213),
libraryDependencies ++= CobolConvertersDependencies :+ getScalaDependency(scalaVersion.value),
// No need to publish this artifact since it has test only at the moment
publishArtifact := false,
publish / skip := true,
publish := {},
publishLocal := {}
)

lazy val sparkCobol = (project in file("spark-cobol"))
.settings(
name := "spark-cobol",
crossScalaVersions := List(scala211, scala212, scala213),
printSparkVersion := {
val log = streams.value.log
log.info(s"Building with Spark ${sparkVersion(scalaVersion.value)}, Scala ${scalaVersion.value}")
Expand All @@ -109,10 +114,8 @@ lazy val sparkCobol = (project in file("spark-cobol"))
}
},
libraryDependencies ++= SparkCobolDependencies(scalaVersion.value) :+ getScalaDependency(scalaVersion.value),
dependencyOverrides ++= SparkCobolDependenciesOverride,
Test / fork := true, // Spark tests fail randomly otherwise
populateBuildInfoTemplate,
releasePublishArtifactsAction := PgpKeys.publishSigned.value,
assemblySettings
).dependsOn(cobolParser)
.settings(
Expand All @@ -125,10 +128,6 @@ lazy val sparkCobol = (project in file("spark-cobol"))
ThisBuild / coverageExcludedPackages := ".*examples.*;.*replication.*"
ThisBuild / coverageExcludedFiles := ".*Example.*;Test.*"

// release settings
releaseCrossBuild := true
addCommandAlias("releaseNow", ";set releaseVersionBump := sbtrelease.Version.Bump.Bugfix; release with-defaults")

lazy val assemblySettings = Seq(
// This merge strategy retains service entries for all services in manifest.
// It allows custom Spark data sources to be used together, e.g. 'spark-xml' and 'spark-cobol'.
Expand Down
11 changes: 0 additions & 11 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,6 @@
<maven.release.version>2.4.2</maven.release.version>
<maven.scm.provider.gitexe.version>1.8.1</maven.scm.provider.gitexe.version>
<maven.scoverage.version>1.3.0</maven.scoverage.version>
<maven.rat.plugin.version>0.12</maven.rat.plugin.version>
<maven.gpg.plugin.version>1.6</maven.gpg.plugin.version>

<!-- Frameworks and libraries -->
Expand All @@ -111,7 +110,6 @@
<spark.version>3.5.6</spark.version>
<scalatest.version>3.2.19</scalatest.version>
<specs.version>2.4.16</specs.version>
<guava.version>15.0</guava.version>
<jackson.version>2.13.1</jackson.version>
<mockito.version>4.11.0</mockito.version>
<scala_logging.version>3.7.2</scala_logging.version>
Expand Down Expand Up @@ -250,11 +248,6 @@
<version>${mockito.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
<version>${guava.version}</version>
</dependency>
</dependencies>
</dependencyManagement>

Expand All @@ -267,10 +260,6 @@
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>${maven.compiler.version}</version>
<configuration>
<source>${maven.compiler.source}</source>
<target>${maven.compiler.target}</target>
</configuration>
</plugin>
<!-- the Maven Scala plugin -->
<plugin>
Expand Down
8 changes: 0 additions & 8 deletions project/Dependencies.scala
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
import sbt._

object Dependencies {
private val guavaVersion = "15.0"
private val scodecCoreVersion = "1.11.4"
private val antlrValue = "4.8"
private val slf4jVersion = "1.7.25"
Expand Down Expand Up @@ -62,13 +61,6 @@ object Dependencies {
"org.mockito" % "mockito-core" % mockitoVersion % Test
)

val SparkCobolDependenciesOverride: Seq[ModuleID] = Seq(
// Needs to be added as a separate dependency since Spark uses an newer
// version of Guava which has removed 'com.google.common.base.Stopwatch.elapsedMillis',
// however, the version of Hadoop imported by Spark relies on that method.
"com.google.guava" % "guava" % guavaVersion,
)

val CobolParserDependencies: Seq[ModuleID] = Seq(
// compile
"org.antlr" % "antlr4-runtime" % antlrValue,
Expand Down
2 changes: 1 addition & 1 deletion project/build.properties
Original file line number Diff line number Diff line change
@@ -1 +1 @@
sbt.version=1.10.11
sbt.version=1.11.6
12 changes: 6 additions & 6 deletions project/plugins.sbt
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
addSbtPlugin("com.github.sbt" % "sbt-pgp" % "2.2.1")
addSbtPlugin("com.github.sbt" % "sbt-release" % "1.1.0")
addSbtPlugin("org.scoverage" % "sbt-scoverage" % "1.6.0")
addSbtPlugin("de.heikoseeberger" % "sbt-header" % "5.2.0")
addSbtPlugin("com.eed3si9n" % "sbt-assembly" % "0.15.0")
addSbtPlugin("io.get-coursier" % "sbt-shading" % "2.1.5")
addSbtPlugin("com.github.sbt" % "sbt-ci-release" % "1.11.1")
addSbtPlugin("com.eed3si9n" % "sbt-projectmatrix" % "0.9.2")
addSbtPlugin("org.scoverage" % "sbt-scoverage" % "1.6.0")
addSbtPlugin("de.heikoseeberger" % "sbt-header" % "5.2.0")
addSbtPlugin("com.eed3si9n" % "sbt-assembly" % "0.15.0")
addSbtPlugin("io.get-coursier" % "sbt-shading" % "2.1.5")
Comment on lines +1 to +6
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue

Missing sbt-dynver: ci-release won’t produce proper release versions from tags.

You removed version.sbt; without sbt-dynver, version defaults to 0.1.0-SNAPSHOT, so ci-release will only publish snapshots. Add dynver so tags drive release versions. (github.com)

Apply:

+addSbtPlugin("com.github.sbt"    % "sbt-dynver"        % "5.1.0")
 addSbtPlugin("com.github.sbt"    % "sbt-ci-release"    % "1.11.1")
 addSbtPlugin("com.eed3si9n"      % "sbt-projectmatrix" % "0.9.2")
 addSbtPlugin("org.scoverage"     % "sbt-scoverage"     % "1.6.0")
 addSbtPlugin("de.heikoseeberger" % "sbt-header"        % "5.2.0")
 addSbtPlugin("com.eed3si9n"      % "sbt-assembly"      % "0.15.0")
 addSbtPlugin("io.get-coursier"   % "sbt-shading"       % "2.1.5")
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
addSbtPlugin("com.github.sbt" % "sbt-ci-release" % "1.11.1")
addSbtPlugin("com.eed3si9n" % "sbt-projectmatrix" % "0.9.2")
addSbtPlugin("org.scoverage" % "sbt-scoverage" % "1.6.0")
addSbtPlugin("de.heikoseeberger" % "sbt-header" % "5.2.0")
addSbtPlugin("com.eed3si9n" % "sbt-assembly" % "0.15.0")
addSbtPlugin("io.get-coursier" % "sbt-shading" % "2.1.5")
// project/plugins.sbt
addSbtPlugin("com.github.sbt" % "sbt-dynver" % "5.1.0")
addSbtPlugin("com.github.sbt" % "sbt-ci-release" % "1.11.1")
addSbtPlugin("com.eed3si9n" % "sbt-projectmatrix" % "0.9.2")
addSbtPlugin("org.scoverage" % "sbt-scoverage" % "1.6.0")
addSbtPlugin("de.heikoseeberger" % "sbt-header" % "5.2.0")
addSbtPlugin("com.eed3si9n" % "sbt-assembly" % "0.15.0")
addSbtPlugin("io.get-coursier" % "sbt-shading" % "2.1.5")
🤖 Prompt for AI Agents
In project/plugins.sbt around lines 1 to 6, the sbt-dynver plugin is missing so
CI release will keep publishing 0.1.0-SNAPSHOT; add the sbt-dynver plugin to
plugins.sbt (use the latest stable dynver version) so versions are derived from
Git tags, and remove any hardcoded version.sbt or ensure it does not override
dynver-generated versions; after adding the plugin, run sbt reload and verify
that sbt dynver or sbt show version returns a tag-derived version before relying
on ci-release.


addDependencyTreePlugin

Expand Down
11 changes: 0 additions & 11 deletions publish.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -44,15 +44,4 @@ ThisBuild / description := "COBOL Reading and Import Extensions for Apache Spark
ThisBuild / startYear := Some(2018)
ThisBuild / licenses += "Apache-2.0" -> url("https://www.apache.org/licenses/LICENSE-2.0.txt")

ThisBuild / pomIncludeRepository := { _ => false }
ThisBuild / publishTo := {
val nexus = "https://oss.sonatype.org/"
if (isSnapshot.value) {
Some("snapshots" at s"${nexus}content/repositories/snapshots")
} else {
Some("releases" at s"${nexus}service/local/staging/deploy/maven2")
}
}
ThisBuild / publishMavenStyle := true

ThisBuild / versionScheme := Some("semver-spec")
9 changes: 0 additions & 9 deletions spark-cobol/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -42,15 +42,6 @@
<scope>provided</scope>
</dependency>

<!-- guava -->
<!-- Needs to be added as a separate dependency since Spark uses an newer
version of Guava which has removed 'com.google.common.base.Stopwatch.elapsedMillis',
however, the version of Hadoop imported by Spark relies on that method. -->
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
</dependency>

<!-- COBOL parser -->
<dependency>
<groupId>za.co.absa.cobrix</groupId>
Expand Down
1 change: 0 additions & 1 deletion version.sbt

This file was deleted.

Loading