Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Skall for libs #1

Merged
merged 4 commits into from
Aug 25, 2023
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
9 changes: 9 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#
# https://help.github.com/articles/dealing-with-line-endings/
#
# Linux start script should use lf
/gradlew text eol=lf

# These are Windows script files and should use crlf
*.bat text eol=crlf

17 changes: 17 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
version: 2

updates:
- package-ecosystem: gradle
directory: "/"
schedule:
interval: weekly
day: "sunday"
time: "04:00"
open-pull-requests-limit: 10

- package-ecosystem: github-actions
directory: "/"
schedule:
interval: weekly
day: "sunday"
time: "04:00"
63 changes: 63 additions & 0 deletions .github/workflows/build-deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
name: Build and Deploy
on:
push:
branches:
- 'main'

jobs:
build:
name: Build and test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

- uses: actions/setup-java@v3
with:
java-version: 17
distribution: 'temurin'
cache: 'gradle'

- uses: gradle/gradle-build-action@v2
with:
arguments: build

- name: Post build failures to Slack
if: failure()
run: |
curl -X POST --data "{\"text\": \"Build av $GITHUB_REPOSITORY feilet - $GITHUB_SERVER_URL/$GITHUB_REPOSITORY/actions/runs/$GITHUB_RUN_ID\"}" $WEBHOOK_URL
env:
WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}

release:
name: Create Release
needs: build
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3

- name: Set release tag
run: |
export TAG_NAME="$(TZ="Europe/Oslo" date +%Y.%m.%d-%H.%M).$(git rev-parse --short=12 HEAD)"
echo "RELEASE_TAG=$TAG_NAME" >> $GITHUB_ENV
#- name: Set changelog
# id: changelog
# # (Escape newlines see https://github.com/actions/create-release/issues/25)
# run: |
# text="$(git --no-pager log $(git describe --tags --abbrev=0)..HEAD --pretty=format:"%h %s")"
# echo "::set-output name=CHANGELOG::$text"

- name: Create release
uses: softprops/action-gh-release@v1
with:
name: Release ${{ env.RELEASE_TAG }}
tag_name: ${{ env.RELEASE_TAG }}
draft: false
prerelease: false

- name: Post release failures to Slack
if: failure()
run: |
curl -X POST --data "{\"text\": \"Release av $GITHUB_REPOSITORY feilet - $GITHUB_SERVER_URL/$GITHUB_REPOSITORY/actions/runs/$GITHUB_RUN_ID\"}" $WEBHOOK_URL
env:
WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
20 changes: 20 additions & 0 deletions .github/workflows/pr.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: Pull Request
on:
pull_request:

jobs:
build:
name: Build and test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

- uses: actions/setup-java@v3
with:
java-version: 17
distribution: 'temurin'
cache: 'gradle'

- uses: gradle/gradle-build-action@v2
with:
arguments: test
82 changes: 82 additions & 0 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
import org.jlleitschuh.gradle.ktlint.KtlintExtension

val javaVersion = JavaVersion.VERSION_17

plugins {
kotlin("jvm") version "1.9.10"
`maven-publish`
`java-library`
id("org.jlleitschuh.gradle.ktlint") version "11.5.1"
}

allprojects {
repositories {
mavenCentral()
}

apply(plugin = "org.jlleitschuh.gradle.ktlint")
configure<KtlintExtension> {
version.set("0.50.0")
}
}

subprojects {
group = "no.nav.tilleggsstonader-libs"

apply(plugin = "org.jetbrains.kotlin.jvm")
apply(plugin = "maven-publish")
apply(plugin = "java-library")

dependencies {
// Align versions of all Kotlin components
implementation(platform("org.jetbrains.kotlin:kotlin-bom"))
implementation(kotlin("stdlib"))
implementation(platform("org.springframework.boot:spring-boot-dependencies:3.1.2"))
testImplementation("org.junit.jupiter:junit-jupiter")
testImplementation("org.assertj:assertj-core")
}

tasks {
withType<KotlinCompile> {
kotlinOptions.jvmTarget = javaVersion.toString()
}
withType<Jar> {
duplicatesStrategy = DuplicatesStrategy.INCLUDE
}
test {
useJUnitPlatform()
}
}

java {
withSourcesJar()
withJavadocJar()
}

publishing {
publications {
create<MavenPublication>("mavenJava") {
artifactId = project.name
version = project.findProperty("version")?.toString() ?: "0.0.0"
from(components["java"])
}
}

repositories {
maven {
name = "GitHubPackages"
url = uri("https://maven.pkg.github.com/navikt/tilleggsstonader-libs")
credentials {
username = "x-access-token"
password = System.getenv("GITHUB_TOKEN")
}
}
}
}

kotlin.sourceSets["main"].kotlin.srcDirs("main")
kotlin.sourceSets["test"].kotlin.srcDirs("test")
sourceSets["main"].resources.srcDirs("main")
sourceSets["test"].resources.srcDirs("test")
}
Binary file added gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
7 changes: 7 additions & 0 deletions gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.2.1-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
Loading