-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add static code analysis, linting and code coverage reporting
- Loading branch information
1 parent
a684dd1
commit 462198c
Showing
12 changed files
with
173 additions
and
48 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
name: CI | ||
|
||
on: | ||
pull_request: | ||
branches: [ "main" ] | ||
paths-ignore: | ||
- '.github/workflows/release.yml' | ||
- '**/*.md' | ||
- 'LICENSE' | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: read | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Set up JDK | ||
uses: actions/setup-java@v4 | ||
with: | ||
java-version: '23' | ||
distribution: 'liberica' | ||
|
||
- name: Setup Gradle | ||
uses: gradle/actions/setup-gradle@v4 | ||
|
||
- name: Build with Gradle Wrapper | ||
run: ./gradlew build --s | ||
|
||
- name: Add coverage report to PR | ||
id: kover | ||
uses: mi-kas/kover-report@v1.9 | ||
with: | ||
path: ${{ github.workspace }}/build/reports/kover/report.xml | ||
title: Code Coverage | ||
update-comment: true | ||
min-coverage-overall: 80 | ||
min-coverage-changed-files: 80 | ||
coverage-counter-type: LINE |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
# 🛠️ Installation and Usage | ||
|
||
1. **Use the Template:** | ||
- Fork the repository or use it directly as a GitHub Template. | ||
- Customize `settings.gradle.kts` and `build.gradle.kts` to suit your project. | ||
- change package name | ||
- add or remove targets to the kotlin multiplatform extension in the [build.gradle.kts](build.gradle.kts) | ||
- Give Github Actions required permissions to be able to open pull requests and commit tags to your repository. | ||
- [x] Repository > Settings > Actions > General > Workflow permissions > Read and write permissions | ||
- [x] Repository > Settings > Actions > General > Workflow permissions > Allow GitHub Actions to create and approve pull requests | ||
|
||
2. **Adjust Modules:** | ||
- Modify the `core` and `example` modules, or add new ones to expand functionality. | ||
|
||
3. **Automated Releases:** | ||
- Use GitHub Actions for automated CI/CD workflows. | ||
- The GitHub action requires the following secrets to be set in your [project settings](settings/secrets/actions) to be able to publish to Maven Central: | ||
- `MAVEN_CENTRAL_USERNAME` | ||
- `MAVEN_CENTRAL_PASSWORD` | ||
- `SIGNING_IN_MEMORY_KEY` | ||
- `SIGNING_IN_MEMORY_KEY_ID` | ||
- `SIGNING_IN_MEMORY_KEY_PASSWORD` | ||
- You can find more information about how to get the required maven central credentials [here](https://medium.com/@iRYO400/how-to-upload-your-android-library-to-maven-central-central-portal-in-2024-af7348742247) or [here](https://medium.com/@efthymiou.dimitrios1/how-to-publish-your-library-to-maven-central-3923139967e1) or in the [official documentation](https://central.sonatype.org/register/central-portal/). | ||
- Publishing To Maven Local: | ||
- ```bash | ||
./gradlew publishToMavenLocal | ||
``` | ||
|
||
--- | ||
|
||
## 🤖 Preconfigured CI/CD Workflows | ||
|
||
This template includes ready-to-use GitHub Actions workflows for: | ||
- **Build & Test:** Ensures your library is reliable and bug-free. | ||
- **Release:** Automatically publishes new versions when a release tag is created. | ||
- **Linting:** Keeps your code clean and adherent to Kotlin standards. | ||
- **Maintenance:** Automatic updates of your dependencies via Pull Request. | ||
--- | ||
|
||
## ⚡️ Troubleshooting | ||
### How to get the signing key | ||
Please change the `<key id>` placeholder in the following command to your signing key id. | ||
```bash | ||
gpg --export-secret-keys --armor <key id> | grep -v '\-\-' | grep -v '^=.' | tr -d '\n' | ||
``` | ||
|
||
--- | ||
|
||
## 📄 License | ||
|
||
This repository is licensed under the [MIT License](LICENSE). | ||
|
||
--- | ||
|
||
With this template, you can focus on writing great code while the boilerplate tasks are taken care of. Happy coding! 🎉 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
build: | ||
maxIssues: 0 | ||
excludeCorrectable: false | ||
weights: | ||
# complexity: 2 | ||
# LongParameterList: 1 | ||
# style: 1 | ||
# comments: 1 |
12 changes: 12 additions & 0 deletions
12
core/src/commonTest/kotlin/codes/draeger/example/core/ExampleTest.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
package codes.draeger.example.core | ||
|
||
import kotlin.test.Test | ||
import kotlin.test.assertEquals | ||
|
||
internal class ExampleTest { | ||
|
||
@Test | ||
fun exampleTest() { | ||
assertEquals(Example().foo(), "bar") | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters