-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
* add infra and CI * udpate readme * update perm * fix compile * fix lint * more linting * fix readme * fix CI * add jrelease * add jrelease * Change var name * test * Fix build * Fix build * Fix build * Fix build * Fix build * Fix build * Fix build * Fix build * Fix build * Fix build * Fix build * Update README.md --------- Co-authored-by: Joel Dickson <[email protected]>
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
############################################################################### | ||
# Set default behavior to automatically normalize line endings. | ||
############################################################################### | ||
*.txt text eol=crlf diff | ||
*.sln text eol=crlf diff | ||
*.cs text eol=crlf diff | ||
*.csproj text eol=crlf diff | ||
*.css text eol=crlf diff | ||
*.json text eol=crlf diff | ||
*.ts text eol=crlf diff | ||
*.tsx text eol=crlf diff | ||
*.cshtml encoding=UTF-8 | ||
*.cs encoding=UTF-8 | ||
*.sh text eol=lf | ||
*.py text eol=lf | ||
*.properties text eol=lf | ||
gradlew text eol=lf | ||
|
||
############################################################################### | ||
# Set default behavior for command prompt diff. | ||
# | ||
# This is need for earlier builds of msysgit that does not have it on by | ||
# default for csharp files. | ||
# Note: This is only used by command line | ||
############################################################################### | ||
#*.cs diff=csharp | ||
|
||
############################################################################### | ||
# Set the merge driver for project and solution files | ||
# | ||
# Merging from the command prompt will add diff markers to the files if there | ||
# are conflicts (Merging from VS is not affected by the settings below, in VS | ||
# the diff markers are never inserted). Diff markers may cause the following | ||
# file extensions to fail to load in VS. An alternative would be to treat | ||
# these files as binary and thus will always conflict and require user | ||
# intervention with every merge. To do so, just uncomment the entries below | ||
############################################################################### | ||
#*.sln merge=binary | ||
#*.csproj merge=binary | ||
#*.vbproj merge=binary | ||
#*.vcxproj merge=binary | ||
#*.vcproj merge=binary | ||
#*.dbproj merge=binary | ||
#*.fsproj merge=binary | ||
#*.lsproj merge=binary | ||
#*.wixproj merge=binary | ||
#*.modelproj merge=binary | ||
#*.sqlproj merge=binary | ||
#*.wwaproj merge=binary | ||
|
||
############################################################################### | ||
# behavior for image files | ||
# | ||
# image files are treated as binary by default. | ||
############################################################################### | ||
#*.jpg binary | ||
#*.png binary | ||
#*.gif binary | ||
|
||
############################################################################### | ||
# diff behavior for common document formats | ||
# | ||
# Convert binary document formats to text before diffing them. This feature | ||
# is only available from the command line. Turn it on by uncommenting the | ||
# entries below. | ||
############################################################################### | ||
#*.doc diff=astextplain | ||
#*.DOC diff=astextplain | ||
#*.docx diff=astextplain | ||
#*.DOCX diff=astextplain | ||
#*.dot diff=astextplain | ||
#*.DOT diff=astextplain | ||
#*.pdf diff=astextplain | ||
#*.PDF diff=astextplain | ||
#*.rtf diff=astextplain | ||
#*.RTF diff=astextplain |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,99 @@ | ||
name: Agoda Kraft CI | ||
on: | ||
push: | ||
env: | ||
JAVA_VERSION: 11 | ||
JAVA_DISTRIBUTION: "adopt" | ||
MAJOR_MINOR_VERSION: 0.1. | ||
|
||
jobs: | ||
build: | ||
name: Build | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Setup Java | ||
uses: actions/setup-java@v4 | ||
with: | ||
java-version: ${{ env.JAVA_VERSION }} | ||
distribution: ${{ env.JAVA_DISTRIBUTION }} | ||
- name: Build | ||
run: ./gradlew clean build | ||
- name: Test | ||
run: ./gradlew test | ||
|
||
release-dryrun: | ||
name: Release Dry-Run | ||
needs: build | ||
runs-on: ubuntu-latest | ||
if: github.ref != 'refs/heads/main' | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Setup Java | ||
uses: actions/setup-java@v4 | ||
with: | ||
java-version: ${{ env.JAVA_VERSION }} | ||
distribution: ${{ env.JAVA_DISTRIBUTION }} | ||
- name: Create staging repositories | ||
run: ./gradlew -Pversion=${{ env.MAJOR_MINOR_VERSION }}${{ github.run_number }} publish | ||
- name: Run JReleaser | ||
uses: jreleaser/release-action@v2 | ||
with: | ||
arguments: full-release --dry-run | ||
env: | ||
JRELEASER_PROJECT_VERSION: ${{ env.MAJOR_MINOR_VERSION }}${{ github.run_number }} | ||
JRELEASER_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
JRELEASER_GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }} | ||
JRELEASER_GPG_PUBLIC_KEY: ${{ secrets.GPG_PUBLIC_KEY }} | ||
JRELEASER_GPG_SECRET_KEY: ${{ secrets.GPG_SECRET_KEY }} | ||
JRELEASER_MAVENCENTRAL_USERNAME: ${{ secrets.OSSRH_USERNAME }} | ||
JRELEASER_MAVENCENTRAL_PASSWORD: ${{ secrets.OSSRH_TOKEN }} | ||
- name: JReleaser release output | ||
if: always() | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: jreleaser-release | ||
path: | | ||
out/jreleaser/trace.log | ||
out/jreleaser/output.properties | ||
release: | ||
name: Release | ||
needs: build | ||
runs-on: ubuntu-latest | ||
if: github.ref == 'refs/heads/main' | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Setup Java | ||
uses: actions/setup-java@v4 | ||
with: | ||
java-version: ${{ env.JAVA_VERSION }} | ||
distribution: ${{ env.JAVA_DISTRIBUTION }} | ||
- name: Create staging repositories | ||
run: ./gradlew -Pversion=${{ env.MAJOR_MINOR_VERSION }}${{ github.run_number }} publish | ||
- name: Run JReleaser | ||
uses: jreleaser/release-action@v2 | ||
env: | ||
JRELEASER_PROJECT_VERSION: ${{ env.MAJOR_MINOR_VERSION }}${{ github.run_number }} | ||
JRELEASER_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
JRELEASER_GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }} | ||
JRELEASER_GPG_PUBLIC_KEY: ${{ secrets.GPG_PUBLIC_KEY }} | ||
JRELEASER_GPG_SECRET_KEY: ${{ secrets.GPG_SECRET_KEY }} | ||
JRELEASER_MAVENCENTRAL_USERNAME: ${{ secrets.OSSRH_USERNAME }} | ||
JRELEASER_MAVENCENTRAL_TOKEN: ${{ secrets.OSSRH_TOKEN }} | ||
continue-on-error: true | ||
- name: JReleaser release output | ||
if: always() | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: jreleaser-release | ||
path: | | ||
out/jreleaser/trace.log | ||
out/jreleaser/output.properties | ||
continue-on-error: true | ||
- name: Verify Published Artifact | ||
env: | ||
SONATYPE_USERNAME: ${{ secrets.OSSRH_USERNAME }} | ||
SONATYPE_PASSWORD: ${{ secrets.OSSRH_TOKEN }} | ||
working-directory: .github/tools | ||
run: sh check_publish.sh --namespace io.agodadev --bundle-name agoda-kraft --bundle-version ${{ env.MAJOR_MINOR_VERSION }}${{ github.run_number }} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,78 @@ | ||
# agoda-kraft | ||
# Agoda Kraft | ||
|
||
Welcome to Agoda Kraft, where we kraftily craft Kotlin code quality tools! 🛠️ | ||
|
||
## What is Agoda Kraft? | ||
|
||
Agoda Kraft is a collection of opinionated Kotlin code quality tools, born from Agoda's experience working with Kotlin at scale. It includes custom rules for both Ktlint and Detekt, ensuring your codebase stays as robust as a fortress. | ||
|
||
## Features | ||
|
||
- Custom Ktlint rules to keep your code style consistent | ||
- Detekt rules that detect code smells | ||
- Battle-tested at Agoda, because what doesn't break production makes the code stronger | ||
|
||
## Getting Started | ||
|
||
### Prerequisites | ||
|
||
- JDK 11 or higher | ||
- Gradle 7.0 or higher | ||
- An undying love for clean code (or at least a strong tolerance for it) | ||
|
||
### Installation | ||
|
||
Add the following to your project's `build.gradle.kts`: | ||
|
||
```kotlin | ||
dependencies { | ||
implementation("io.agodadev:kraft-ktlint:1.0.0") | ||
implementation("io.agodadev:kraft-detekt:1.0.0") | ||
} | ||
``` | ||
|
||
### Usage | ||
|
||
Configure Ktlint and Detekt in your project to use Agoda Kraft rules. Don't worry, they don't bite. | ||
|
||
## Development Setup | ||
|
||
1. Clone the repository: | ||
|
||
```bash | ||
git clone https://github.com/agoda-com/agoda-kraft.git | ||
``` | ||
|
||
2. Open the project in IntelliJ IDEA. | ||
|
||
What's that? You prefer VS Code? Well, we suppose you could use it, but let's just say JetB... Just kidding, use whatever you like – we're not the IDE police. | ||
|
||
3. Build the project: | ||
|
||
```bash | ||
./gradlew build | ||
``` | ||
|
||
4. Run tests: | ||
|
||
```bash | ||
./gradlew test | ||
``` | ||
|
||
## Contributing | ||
|
||
We welcome contributions! If you've found a bug or have a feature request, please open an issue. If you'd like to contribute code, please fork the repository and submit a pull request. | ||
|
||
Remember, static code analysis isn't about enforcing, its about educating people, there's a reason we write code in a particular way to keep it consistent and have less bugs, we all should be brought in and understand why we are writing code in a particular way. Let code analysis tools be a teacher, not a police officers, and it'll make for better engineering culture. | ||
|
||
## License | ||
|
||
This project is licensed under the Apache 2.0 license - see the [LICENSE](LICENSE) file for details. | ||
|
||
## Acknowledgments | ||
|
||
- The Kotlin community, for creating a language that's a joy to write (and lint) | ||
- Coffee, for powering our late-night coding sessions | ||
- You, for reading this far. You're the real MVP! | ||
|
||
Remember, in the world of code quality, you're either Krafty or you're not. Choose wisely! |