Thank you for your interest in contributing! This document provides guidelines for developers working on this project.
cmp-imgcompress/
├── .github/workflows/ # CI/CD pipelines
│ ├── ci.yml # Reusable CI (lint, tests, build)
│ ├── push-ci.yml # Runs on every push/PR
│ └── release.yml # Runs on version tags (v*)
├── cmp-imgcompress/ # The actual library code
│ ├── src/
│ │ ├── commonMain/ # Shared Kotlin code
│ │ └── commonTest/ # Shared tests
│ └── build.gradle.kts # Library build config + publishing
├── sample/ # Sample app demonstrating library usage
│ ├── composeApp/ # Multiplatform sample app
│ └── iosApp/ # iOS wrapper for Compose app
├── docs/ # Documentation
├── readme_images/ # Images used in README
└── README.MD # Main documentation
- JDK 17 or later
- Android Studio Ladybug or later (for Android development)
- Xcode 15+ (for iOS development, macOS only)
- Node.js (for wasm development)
-
Clone the repository
git clone https://github.com/aryapreetam/cmp-imgcompress.git cd cmp-imgcompress -
Build the project
./gradlew build
-
Run tests
# Run all tests ./gradlew test # Platform-specific tests ./gradlew :cmp-imgcompress:jvmTest ./gradlew :cmp-imgcompress:iosSimulatorArm64Test ./gradlew :cmp-imgcompress:wasmJsBrowserTest ./gradlew :cmp-imgcompress:testDebugUnitTest # Android unit tests
- Make changes in
cmp-imgcompress/src/commonMain/kotlin/ - Write tests in
cmp-imgcompress/src/commonTest/kotlin/ - Run tests:
./gradlew :cmp-imgcompress:test - Check code style:
./gradlew lintRelease
-
Make changes in
cmp-imgcompress/ -
The sample app automatically uses the local library via
implementation(project(":cmp-imgcompress")) -
Run the sample app on your target platform:
Android:
./gradlew :sample:composeApp:assembleDebug # Or open in Android Studio and runDesktop:
./gradlew :sample:composeApp:run
iOS:
# Open sample/iosApp/iosApp.xcodeproj in Xcode # Select a simulator and press Run
Web (wasm):
./gradlew :sample:composeApp:wasmJsBrowserDevelopmentRun --continuous # Opens at http://localhost:8080
Test your library locally before publishing to Maven Central:
./gradlew :cmp-imgcompress:publishToMavenLocalThen in another project, add:
repositories {
mavenLocal()
mavenCentral()
}
dependencies {
implementation("io.github.aryapreetam:cmp-imgcompress:0.0.3")
}-
Create Sonatype Account
- Sign up at https://central.sonatype.com/
- Create a namespace (e.g.,
io.github.yourusername)
-
Generate GPG Key
# Generate key gpg --gen-key # List keys to find key ID gpg --list-secret-keys --keyid-format=long # Export for GitHub secrets (ASCII-armored) gpg --export-secret-keys --armor <KEY_ID> > private-key.asc # Upload public key to keyserver gpg --keyserver keyserver.ubuntu.com --send-keys <KEY_ID>
-
Configure GitHub Secrets
Go to:
Settings → Secrets and variables → Actions → New repository secretAdd these secrets:
MAVEN_CENTRAL_USERNAME: Your Sonatype usernameMAVEN_CENTRAL_PASSWORD: Your Sonatype password (or token)SIGNING_KEY_ID: Last 8 characters of your GPG key IDSIGNING_PASSWORD: Passphrase for your GPG keyGPG_KEY_CONTENTS: Contents ofprivate-key.asc(ASCII-armored key)
-
Configure Local Publishing (optional)
Add to
~/.gradle/gradle.properties:signing.keyId=<last 8 chars of key ID> signing.password=<your passphrase> signing.secretKeyRingFile=/Users/yourname/.gnupg/secring.gpg mavenCentralUsername=<your username> mavenCentralPassword=<your password>
-
Update version in
cmp-imgcompress/build.gradle.ktscoordinates("io.github.aryapreetam", "cmp-imgcompress", "0.0.4") // Bump this
-
Commit and push
git add . git commit -m "Release v0.0.4" git push
-
Create and push tag
git tag v0.0.4 git push origin v0.0.4
-
Monitor GitHub Actions
- Go to
Actionstab - Watch the
Publish Multiplatform Releaseworkflow - It will:
- Run all tests
- Build artifacts (APK, DMG, wasm, iOS)
- Create GitHub Release
- Publish to Maven Central
- Deploy docs to GitHub Pages
- Go to
# All platforms
./gradlew test
# Specific platforms
./gradlew :cmp-imgcompress:jvmTest
./gradlew :cmp-imgcompress:iosSimulatorArm64Test
./gradlew :cmp-imgcompress:wasmJsBrowserTest
./gradlew :cmp-imgcompress:testDebugUnitTest # Android# Android (requires emulator)
./gradlew :sample:composeApp:connectedAndroidTest./gradlew lintRelease-
Add target in
cmp-imgcompress/build.gradle.ktskotlin { // ...existing targets... tvosArm64() tvosSimulatorArm64() } -
Add target in
sample/composeApp/build.gradle.ktskotlin { // ...existing targets... tvosArm64() tvosSimulatorArm64() } -
Update CI workflows
- Add tvOS testing in
.github/workflows/ci.yml - Add tvOS artifact build in
.github/workflows/release.yml
- Add tvOS testing in
-
Test locally
./gradlew :cmp-imgcompress:tvosSimulatorArm64Test
API documentation is generated automatically via Dokka:
# Generate locally
./gradlew :cmp-imgcompress:dokkaGeneratePublicationHtml
# View at: cmp-imgcompress/build/dokka/html/index.htmlOn release, docs are automatically published to: https://yourusername.github.io/repo-name/api/
Edit README.MD - it's automatically converted to the homepage.
Issue: "Task :cmp-imgcompress:signKotlinMultiplatformPublication not found"
- Ensure GPG key is properly configured
- Check
signing.keyIdis set (local) orsigningInMemoryKey(CI)
Issue: "iOS simulator tests fail"
- Make sure Xcode is installed
- Run:
xcodebuild -downloadAllPlatforms - Check available simulators:
xcrun simctl list devices
Issue: "wasm tests fail with CHROME_BIN not found"
- Install Chrome:
brew install --cask google-chrome - Or set:
export CHROME_BIN=/path/to/chrome
Issue: "Maven Central publishing fails"
- Verify namespace ownership in Sonatype
- Check all secrets are correctly set in GitHub
- Ensure version is unique (not already published)
- Follow Kotlin Coding Conventions
- Use meaningful variable and function names
- Add KDoc comments for public APIs
- Keep functions small and focused
- Write tests for all public APIs
- Fork the repository and create a branch from
main - Make your changes with clear commits
- Add tests for new functionality
- Update documentation if needed
- Run all tests locally before submitting
- Submit PR with clear description
- Tests pass locally (
./gradlew test) - Code style checks pass (
./gradlew lintRelease) - Documentation updated (if applicable)
- Commit messages are clear
- No merge conflicts with
main
- Open an issue for bugs or questions
- Check existing issues before creating new ones
- Provide minimal reproduction steps for bugs
By contributing, you agree that your contributions will be licensed under the MIT License.