Skip to content

Commit

Permalink
chore: add pr workflow ci
Browse files Browse the repository at this point in the history
  • Loading branch information
yamilmedina committed Mar 21, 2024
1 parent e675526 commit 12e1984
Show file tree
Hide file tree
Showing 3 changed files with 61 additions and 0 deletions.
58 changes: 58 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
name: CI Pipeline

on:
push:
branches:
- main
pull_request:
types: [ opened, synchronize ]

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
pipeline:
name: Release to maven central
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Set up JDK
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: 11

- name: Gradle setup
uses: gradle/actions/setup-gradle@v3

- name: Validate gradle wrapper
uses: gradle/wrapper-validation-action@v2

- name: Run unit tests
run: |
./gradlew test --parallel
- name: Publish unit test report
uses: EnricoMi/publish-unit-test-result-action/[email protected]
if: always()
with:
files: |
**/build/test-results/**/*.xml
- name: Run coverage
run: ./gradlew koverXmlReport

- name: Upload coverage reports to Codecov
uses: codecov/[email protected]
with:
token: ${{ secrets.CODECOV_TOKEN }}
slug: yamilmedina/natural-kron

- name: Cleanup gradle cache
# Remove some files from the Gradle cache, so they aren't cached by GitHub Actions.
# Restoring these files from a GitHub Actions cache might cause problems for future builds.
run: |
rm -f ~/.gradle/caches/modules-2/modules-2.lock
rm -f ~/.gradle/caches/modules-2/gc.properties
1 change: 1 addition & 0 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import org.jetbrains.kotlin.gradle.dsl.JvmTarget
plugins {
alias(libs.plugins.kotlin.jvm)
alias(libs.plugins.maven.publish)
alias(libs.plugins.kover)
}

group = "io.github.yamilmedina"
Expand Down
2 changes: 2 additions & 0 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
[versions]
kotlin = "1.9.23"
maven-publish = "0.28.0"
kover = "0.7.4"

[plugins]
kotlin-jvm = { id = "org.jetbrains.kotlin.jvm", version.ref = "kotlin" }
maven-publish = { id = "com.vanniktech.maven.publish", version.ref = "maven-publish" }
kover = { id = "org.jetbrains.kotlinx.kover", version.ref = "kover" }

[libraries]
kotlin-test = { group = "org.jetbrains.kotlin", name = "kotlin-test", version.ref = "kotlin" }

0 comments on commit 12e1984

Please sign in to comment.