thiyagu06 / zally-gradle-plugin

Gradle plugin for using the Zally linter

Home Page:https://thiyagu06.github.io/zally-gradle-plugin/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

zally-gradle-plugin

CircleCI Kotlin version badge Awesome Kotlin Badge APM codecov Maven Central

Runs zally linter as gradle task and export the report in different format.

Advantages

  • no need to host and maintain zally server
  • export violation reports into different file format (json, html)
  • setup rules to define max number of violation allowed in the spec for each severity
  • Integrate zally as part of your build task for faster feedback
  • no external dependency like nodejs or go for running webUI and CLI

How to run locally

./gradlew clean build publishToMavenLocal

After that you are able to use/apply that plugin (even in this project) like this:

// settings.gradle.kts
pluginManagement {
    repositories {
        gradlePluginPortal()
        mavenLocal()
    }
}

// build.gradke.kts
plugins {
    id("io.github.thiyagu06") version "1.0.2-dev"
}

zallyLint {
    inputSpec = File("${projectDir}/docs/petstore-spec.yml")
    reports {
        json {
            enabled = true
            destination = File("${rootDir}/zally/violation.json")
        }
        rules {
            must {
               max = 10
            }
        }
    }
}

//execute task
./gradlew clean zallyLint

How to release

Releasing to maven central is automated via circleci. Since this is public project, I disabled few environment variables in circleci to prevent access to nexus credentials.

  1. Create a separate branch with a name release-<release-version>.
  2. Update current version in server/gradle.properties from -dev to a final version.
  3. Commit server/gradle.properties with the release version
  4. Push the changes to remote origin.
     git push origin `release-<release-version>`
  5. create PR towards main branch and wait till circleci complete the build and release step.
  6. Go to https://app.circleci.com/ and approve the job releaseApproval
  7. Once the job is approved, circleci will publish the artifacts to maven central
  8. Merge the PR into main branch
  9. Checkout the latest main branch from remote origin in your local machine
     git pull origin main
  10. Create a tag
    git tag v<release-version> -m "Version <release-version>"
  11. Push the tag
     git push origin <tag-name>

License

MIT license with an exception. See license file.