Skip to content

Commit

Permalink
Publish JAR to GitHub Maven package repo (ONSdigital#111)
Browse files Browse the repository at this point in the history
Adds publishTo for uploading to GitHub Maven packages.
Set org to io.github.gss-cogs.
Bump version to current tagged version.
Revert Akka to last open source version.
Bump logback to 1.5.3.
Checkout code before setting up Java/Scala as it needs build.sbt
Use temurin rather than adopt JDK due to deprecation.
Add sbt publish step.
Add copyright & license headers to source.
  • Loading branch information
ajtucker authored Aug 19, 2024
1 parent cbdcb23 commit a9089b4
Show file tree
Hide file tree
Showing 57 changed files with 908 additions and 57 deletions.
18 changes: 12 additions & 6 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,16 @@ jobs:

runs-on: ubuntu-latest
steps:
- name: Set up Scala
uses: actions/setup-java@v2
with:
distribution: adopt
java-version: 11
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Scala
uses: actions/setup-java@v4
with:
distribution: temurin
java-version: 11
cache: sbt
- name: Show output of sed to build.sbt command for logs
run: |
VERS_TAG=$(echo $GIT_REF | sed 's/refs\/tags\/v//g')
Expand All @@ -38,6 +39,11 @@ jobs:
- name: Run tests
run: sbt test

- name: Publish package
run: sbt publish
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Build Universal Artifact
run: sbt Universal/packageBin

Expand Down
67 changes: 16 additions & 51 deletions build.sbt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name := "csvw-check"

organization := "ONS"
version := "0.0.1"
organization := "io.github.gss-cogs"
version := "0.0.3"
maintainer := "[email protected]"

scalaVersion := "2.13.4"
Expand All @@ -28,8 +28,8 @@ libraryDependencies += "io.spray" %% "spray-json" % "1.3.6"
libraryDependencies += "org.apache.jena" % "jena-arq" % "4.4.0"
libraryDependencies += "joda-time" % "joda-time" % "2.12.2"
libraryDependencies += "com.github.scopt" %% "scopt" % "4.1.0"
libraryDependencies += "com.typesafe.akka" %% "akka-stream" % "2.8.0"
libraryDependencies += "ch.qos.logback" % "logback-classic" % "1.4.6"
libraryDependencies += "com.typesafe.akka" %% "akka-stream" % "2.6.21"
libraryDependencies += "ch.qos.logback" % "logback-classic" % "1.5.3"
libraryDependencies += "com.typesafe.scala-logging" %% "scala-logging" % "3.9.5"
libraryDependencies += "com.fasterxml.jackson.core" % "jackson-databind" % "2.14.2"
libraryDependencies += "com.fasterxml.jackson.core" % "jackson-annotations" % "2.14.2"
Expand All @@ -38,51 +38,16 @@ libraryDependencies += "com.softwaremill.sttp.client3" %% "core" % "3.8.15"
libraryDependencies += "com.ibm.icu" % "icu4j" % "72.1"
libraryDependencies += "org.apache.commons" % "commons-csv" % "1.10.0"
libraryDependencies += "com.chuusai" %% "shapeless" % "2.3.10"
// Here, `libraryDependencies` is a set of dependencies, and by using `+=`,
// we're adding the scala-parser-combinators dependency to the set of dependencies
// that sbt will go and fetch when it starts up.
// Now, in any Scala file, you can import classes, objects, etc., from
// scala-parser-combinators with a regular import.

// TIP: To find the "dependency" that you need to add to the
// `libraryDependencies` set, which in the above example looks like this:

// "org.scala-lang.modules" %% "scala-parser-combinators" % "1.1.2"

// You can use Scaladex, an index of all known published Scala libraries. There,
// after you find the library you want, you can just copy/paste the dependency
// information that you need into your build file. For example, on the
// scala/scala-parser-combinators Scaladex page,
// https://index.scala-lang.org/scala/scala-parser-combinators, you can copy/paste
// the sbt dependency from the sbt box on the right-hand side of the screen.

// IMPORTANT NOTE: while build files look _kind of_ like regular Scala, it's
// important to note that syntax in *.sbt files doesn't always behave like
// regular Scala. For example, notice in this build file that it's not required
// to put our settings into an enclosing object or class. Always remember that
// sbt is a bit different, semantically, than vanilla Scala.

// ============================================================================

// Most moderately interesting Scala projects don't make use of the very simple
// build file style (called "bare style") used in this build.sbt file. Most
// intermediate Scala projects make use of so-called "multi-project" builds. A
// multi-project build makes it possible to have different folders which sbt can
// be configured differently for. That is, you may wish to have different
// dependencies or different testing frameworks defined for different parts of
// your codebase. Multi-project builds make this possible.

// Here's a quick glimpse of what a multi-project build looks like for this
// build, with only one "subproject" defined, called `root`:

// lazy val root = (project in file(".")).
// settings(
// inThisBuild(List(
// organization := "ch.epfl.scala",
// scalaVersion := "2.13.1"
// )),
// name := "hello-world"
// )

// To learn more about multi-project builds, head over to the official sbt
// documentation at http://www.scala-sbt.org/documentation.html
publishTo := Some("GitHub Maven package repo for GSS-Cogs" at "https://maven.pkg.github.com/gss-cogs/csvw-check")
publishMavenStyle := true
credentials += Credentials(
"GitHub Package Registry",
"maven.pkg.github.com",
"gss-cogs",
sys.env.getOrElse("GITHUB_TOKEN", "")
)

organizationName := "Crown Copyright (Office for National Statistics)"
startYear := Some(2020)
licenses += ("Apache-2.0", new URL("https://www.apache.org/licenses/LICENSE-2.0.txt"))
16 changes: 16 additions & 0 deletions src/main/scala/csvwcheck/ConfiguredObjectMapper.scala
Original file line number Diff line number Diff line change
@@ -1,3 +1,19 @@
/*
* Copyright 2020 Crown Copyright (Office for National Statistics)
*
* 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.
*/

package csvwcheck

import com.fasterxml.jackson.databind.node.JsonNodeFactory
Expand Down
16 changes: 16 additions & 0 deletions src/main/scala/csvwcheck/Main.scala
Original file line number Diff line number Diff line change
@@ -1,3 +1,19 @@
/*
* Copyright 2020 Crown Copyright (Office for National Statistics)
*
* 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.
*/

package csvwcheck

import akka.actor.ActorSystem
Expand Down
16 changes: 16 additions & 0 deletions src/main/scala/csvwcheck/NameSpaces.scala
Original file line number Diff line number Diff line change
@@ -1,3 +1,19 @@
/*
* Copyright 2020 Crown Copyright (Office for National Statistics)
*
* 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.
*/

package csvwcheck

import scala.collection.mutable
Expand Down
16 changes: 16 additions & 0 deletions src/main/scala/csvwcheck/Validator.scala
Original file line number Diff line number Diff line change
@@ -1,3 +1,19 @@
/*
* Copyright 2020 Crown Copyright (Office for National Statistics)
*
* 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.
*/

package csvwcheck

import akka.NotUsed
Expand Down
16 changes: 16 additions & 0 deletions src/main/scala/csvwcheck/XsdDataTypes.scala
Original file line number Diff line number Diff line change
@@ -1,3 +1,19 @@
/*
* Copyright 2020 Crown Copyright (Office for National Statistics)
*
* 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.
*/

package csvwcheck

import scala.collection.mutable
Expand Down
16 changes: 16 additions & 0 deletions src/main/scala/csvwcheck/enums/PropertyType.scala
Original file line number Diff line number Diff line change
@@ -1,3 +1,19 @@
/*
* Copyright 2020 Crown Copyright (Office for National Statistics)
*
* 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.
*/

package csvwcheck.enums

object PropertyType extends Enumeration {
Expand Down
16 changes: 16 additions & 0 deletions src/main/scala/csvwcheck/enums/TrimType.scala
Original file line number Diff line number Diff line change
@@ -1,3 +1,19 @@
/*
* Copyright 2020 Crown Copyright (Office for National Statistics)
*
* 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.
*/

package csvwcheck.enums

object TrimType extends Enumeration {
Expand Down
16 changes: 16 additions & 0 deletions src/main/scala/csvwcheck/errors/CascadeToOtherFilesError.scala
Original file line number Diff line number Diff line change
@@ -1,3 +1,19 @@
/*
* Copyright 2020 Crown Copyright (Office for National Statistics)
*
* 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.
*/

package csvwcheck.errors

/**
Expand Down
16 changes: 16 additions & 0 deletions src/main/scala/csvwcheck/errors/CsvwLoadError.scala
Original file line number Diff line number Diff line change
@@ -1,3 +1,19 @@
/*
* Copyright 2020 Crown Copyright (Office for National Statistics)
*
* 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.
*/

package csvwcheck.errors

/**
Expand Down
16 changes: 16 additions & 0 deletions src/main/scala/csvwcheck/errors/DateFormatError.scala
Original file line number Diff line number Diff line change
@@ -1,3 +1,19 @@
/*
* Copyright 2020 Crown Copyright (Office for National Statistics)
*
* 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.
*/

package csvwcheck.errors

final case class DateFormatError(
Expand Down
16 changes: 16 additions & 0 deletions src/main/scala/csvwcheck/errors/ErrorWithoutContext.scala
Original file line number Diff line number Diff line change
@@ -1,3 +1,19 @@
/*
* Copyright 2020 Crown Copyright (Office for National Statistics)
*
* 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.
*/

package csvwcheck.errors

case class ErrorWithoutContext(`type`: String, content: String)
16 changes: 16 additions & 0 deletions src/main/scala/csvwcheck/errors/GeneralCsvwLoadError.scala
Original file line number Diff line number Diff line change
@@ -1,3 +1,19 @@
/*
* Copyright 2020 Crown Copyright (Office for National Statistics)
*
* 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.
*/

package csvwcheck.errors

/**
Expand Down
16 changes: 16 additions & 0 deletions src/main/scala/csvwcheck/errors/MessageWithCsvContext.scala
Original file line number Diff line number Diff line change
@@ -1,3 +1,19 @@
/*
* Copyright 2020 Crown Copyright (Office for National Statistics)
*
* 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.
*/

package csvwcheck.errors

/**
Expand Down
Loading

0 comments on commit a9089b4

Please sign in to comment.