Skip to content

Commit

Permalink
Updates CI workflows and bumps action versions (#22)
Browse files Browse the repository at this point in the history
* update lint version, remove dup asset checksum

* split workflow jobs

* split lint,test,release workflows
  • Loading branch information
egaxhaj authored Feb 9, 2023
1 parent 054bee7 commit 6257b69
Show file tree
Hide file tree
Showing 5 changed files with 104 additions and 82 deletions.
81 changes: 0 additions & 81 deletions .github/workflows/ci.yml

This file was deleted.

26 changes: 26 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: Lint
# Lint workflow runs Kotlin linter (ktlint) on the code base.

# This workflow is run on every pull request and push to main.
# If no *.kt files are changed it will pass without running as these are required checks.
on:
pull_request:
paths:
- "**/*.kt"
- "*.gradle.kts"
- ".github/workflows/lint.yml"
push:
branches:
- main

# concurrency is not defined in here because this job usually doesn't
# run long enough to need cancelling, and it's okay for it to run multiple
# times for the same PR.

jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Lint
uses: vroy/gha-kotlin-linter@v4
43 changes: 43 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: Release
# Release workflow builds and releases distribution artifacts.

# This workflow is run on pushes to master & every Pull Request,
# if no *.kt files are changed it will pass without running as these are required checks
on:
push:
tags:
- "[0-9]+.[0-9]+.[0-9]+" # Push events to matching #.#.#, i.e. 1.0, 20.15.10
- "[0-9]+.[0-9]+.[0-9]+-rc*" # Push events to matching #.#.#-rc#, i.e. 1.0-rc1, 20.15.10-rc5

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

jobs:
release:
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/checkout@v3
- uses: actions/[email protected]
with:
distribution: temurin
java-version: 11
- name: Set tag version
run: |
echo "VERSION=${GITHUB_REF##*/}" >> $GITHUB_ENV
- name: Defined tag version
run: |
echo VERSION=$VERSION
- name: Build artifacts
uses: gradle/[email protected]
with:
arguments: assembleDist
- name: Upload artifacts
- uses: ncipollo/release-action@v1
with:
tag_name: ${{ github.ref }}
release_name: Release ${{ github.ref }}
artifacts: "build/distributions/*"
bodyFile: "RELEASE_CHANGELOG.md"
35 changes: 35 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: Test
# Test workflow runs unit tests and uploads a code coverage report.

# This workflow is run on every pull request and push to main.
# If no *.kt files are changed it will pass without running as these are required checks.
on:
pull_request:
paths:
- "**/*.kt"
- "*.gradle.kts"
- ".github/workflows/test.yml"
push:
branches:
- main

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

jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/[email protected]
with:
distribution: temurin
java-version: 11
- name: Test
uses: gradle/[email protected]
with:
arguments: test
- uses: codecov/[email protected]
with:
directory: "build/reports"
1 change: 0 additions & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,6 @@ tasks.withType<KotlinCompile> {
}

tasks.assembleDist {
dependsOn(tasks.test)
finalizedBy("checksumDist") // checksums are generated after assembleDist runs
}

Expand Down

0 comments on commit 6257b69

Please sign in to comment.