Skip to content

Commit

Permalink
Add required build, Dependencies and github workflows
Browse files Browse the repository at this point in the history
  • Loading branch information
vimleshtna committed Sep 4, 2023
1 parent fd2fc72 commit 9fa1432
Show file tree
Hide file tree
Showing 9 changed files with 127 additions and 0 deletions.
14 changes: 14 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
name: Deploy if not a version bump PR
on:
pull_request:
types:
- closed
jobs:
deploy:
runs-on: ubuntu-latest
if: ${{ github.event.pull_request.merged == true && !contains(github.event.pull_request.labels.*.name, 'Version bump') }}
steps:
- uses: actions/checkout@v3
- run: gh workflow run deploy.yml
env:
GITHUB_TOKEN: ${{ secrets.WORKFLOW_PAT }}
15 changes: 15 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
name: TDR Deploy Metadata Validation
on:
workflow_dispatch:
jobs:
deploy:
uses: nationalarchives/tdr-github-actions/.github/workflows/sbt_release.yml@main
with:
library-name: "AWS utils"
secrets:
WORKFLOW_PAT: ${{ secrets.WORKFLOW_PAT }}
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }}
SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }}
SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }}
GPG_PRIVATE_KEY: ${{ secrets.GPG_PRIVATE_KEY }}
GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
20 changes: 20 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: TDR Run Tests
on:
pull_request:
push:
branches-ignore:
- master
- release-*
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: nationalarchives/tdr-github-actions/.github/actions/run-git-secrets@main
- uses: nationalarchives/tdr-github-actions/.github/actions/slack-send@main
if: failure()
with:
message: ":warning: Secrets found in repository ${{ inputs.repo-name }}"
slack-url: ${{ secrets.SLACK_WEBHOOK }}
- name: Run tests
run: sbt test
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,8 @@

# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
hs_err_pid*
.idea
.bsp
target
project/project
project/target
61 changes: 61 additions & 0 deletions build.sbt
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
import Dependencies._
import sbt.url
import sbtrelease.ReleaseStateTransformations.{checkSnapshotDependencies, commitNextVersion, commitReleaseVersion, inquireVersions, pushChanges, runClean, runTest, setNextVersion, setReleaseVersion, tagRelease}


ThisBuild / organization := "uk.gov.nationalarchives"
ThisBuild / organizationName := "National Archives"

scalaVersion := "2.13.11"
version := version.value


ThisBuild / scmInfo := Some(
ScmInfo(
url("https://github.com/nationalarchives/tdr-metadata-validation"),
"[email protected]:nationalarchives/tdr-metadata-validation.git"
)
)

developers := List(
Developer(
id = "tna-digital-archiving-jenkins",
name = "TNA Digital Archiving",
email = "[email protected]",
url = url("https://github.com/nationalarchives/tdr-metadata-validation")
)
)

ThisBuild / description := "A library to validate input metadata for the Transfer Digital Records"
ThisBuild / licenses := List("MIT" -> new URL("https://choosealicense.com/licenses/mit/"))
ThisBuild / homepage := Some(url("https://github.com/nationalarchives/tdr-metadata-validation"))

useGpgPinentry := true
publishTo := sonatypePublishToBundle.value
publishMavenStyle := true

releaseProcess := Seq[ReleaseStep](
checkSnapshotDependencies,
inquireVersions,
runClean,
runTest,
setReleaseVersion,
commitReleaseVersion,
tagRelease,
releaseStepCommand("publishSigned"),
releaseStepCommand("sonatypeBundleRelease"),
setNextVersion,
commitNextVersion,
pushChanges
)

resolvers +=
"Sonatype OSS Snapshots" at "https://oss.sonatype.org/content/repositories/snapshots"

lazy val root = (project in file("."))
.settings(
name := "tdr-metadata-validation",
libraryDependencies ++= Seq(
scalaTest % Test,
)
)
6 changes: 6 additions & 0 deletions project/Dependencies.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import sbt._

object Dependencies {
lazy val scalaTest = "org.scalatest" %% "scalatest" % "3.2.12"
lazy val mockito = "org.mockito" %% "mockito-scala" % "1.17.7"
}
1 change: 1 addition & 0 deletions project/build.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
sbt.version=1.9.4
4 changes: 4 additions & 0 deletions project/plugins.sbt
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
addSbtPlugin("com.github.sbt" % "sbt-release" % "1.1.0")
resolvers += Resolver.jcenterRepo
addSbtPlugin("org.xerial.sbt" % "sbt-sonatype" % "3.9.21")
addSbtPlugin("com.github.sbt" % "sbt-pgp" % "2.2.1")
1 change: 1 addition & 0 deletions version.sbt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
ThisBuild / version := "0.0.1-SNAPSHOT"

0 comments on commit 9fa1432

Please sign in to comment.