Skip to content

Commit

Permalink
build: jgitver
Browse files Browse the repository at this point in the history
  • Loading branch information
sargunv committed Nov 26, 2024
1 parent f2a9f7a commit 9a93037
Show file tree
Hide file tree
Showing 9 changed files with 57 additions and 18 deletions.
35 changes: 27 additions & 8 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,20 +15,36 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: ./.github/actions/setup
- run: ./gradlew spotlessCheck

check-podspec:
runs-on: macos-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: ./.github/actions/setup
- run: ./gradlew podInstall
- run: "git diff -I '^COCOAPODS: [0-9]+\.[0-9]+\.[0-9]+$' --exit-code"

lint-android:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: ./.github/actions/setup
- run: ./gradlew lint

test-android:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: ./.github/actions/setup
- name: Run with AVD ./gradlew connectedDebugAndroidTest
uses: ./.github/actions/run-with-avd
Expand All @@ -40,13 +56,17 @@ jobs:
runs-on: macos-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: ./.github/actions/setup
- run: ./gradlew iosSimulatorArm64Test

build-docs:
runs-on: macos-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: ./.github/actions/setup
- run: ./gradlew dokkaHtmlMultiModule
- uses: actions/upload-pages-artifact@v3
Expand All @@ -57,35 +77,34 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: ./.github/actions/setup
- run: ./gradlew packageDebug packageRelease
- run: ./gradlew packageDebug
- uses: actions/upload-artifact@v4
with:
if-no-files-found: error
name: demo-app-debug
path: demo-app/build/outputs/apk/debug/demo-app-debug.apk
- uses: actions/upload-artifact@v4
with:
if-no-files-found: error
name: demo-app-release-unsigned
path: demo-app/build/outputs/apk/release/demo-app-release-unsigned.apk

publish-snapshot:
needs: [test-android, test-ios]
needs: [ test-android, test-ios ]
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }}
runs-on: macos-latest
permissions:
packages: write
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: ./.github/actions/setup
- run: ./gradlew publishAllPublicationsToGitHubPackagesRepository
env:
ORG_GRADLE_PROJECT_githubToken: ${{ secrets.GITHUB_TOKEN }}
ORG_GRADLE_PROJECT_githubUser: ${{ github.actor }}

all-good:
needs: [check-format, lint-android, test-android, test-ios, build-docs, build-android-app]
needs: [ check-format, check-podspec, lint-android, test-android, test-ios, build-docs, build-android-app ]
runs-on: ubuntu-latest
steps:
- run: echo "All checks passed!"
2 changes: 2 additions & 0 deletions .github/workflows/dependency-submission.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ jobs:
contents: write
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-java@v4
with:
distribution: temurin
Expand Down
7 changes: 6 additions & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
name: Release

on:
workflow_dispatch:
push:
tags: [ 'v*.*.*' ]

jobs:
publish-maven:
Expand All @@ -11,6 +12,8 @@ jobs:
url: https://central.sonatype.com/namespace/dev.sargunv.maplibre-compose
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: ./.github/actions/setup
- run: ./gradlew publishAndReleaseToMavenCentral --no-configuration-cache
env:
Expand All @@ -30,6 +33,8 @@ jobs:
url: ${{ steps.deploy-pages.outputs.page_url }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: ./.github/actions/setup
- run: ./gradlew dokkaHtmlMultiModule
- uses: actions/upload-pages-artifact@v3
Expand Down
1 change: 0 additions & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ plugins {
alias(libs.plugins.kotlin.cocoapods) apply false
alias(libs.plugins.spotless)
alias(libs.plugins.dokka)
alias(libs.plugins.maven.publish) apply false
}

spotless {
Expand Down
14 changes: 11 additions & 3 deletions demo-app/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
@file:OptIn(ExperimentalKotlinGradlePluginApi::class)

import fr.brouillard.oss.jgitver.Strategies
import org.jetbrains.compose.ExperimentalComposeLibrary
import org.jetbrains.kotlin.gradle.ExperimentalKotlinGradlePluginApi
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
Expand All @@ -13,9 +14,13 @@ plugins {
alias(libs.plugins.kotlin.cocoapods)
alias(libs.plugins.kotlin.serialization)
alias(libs.plugins.spotless)
alias(libs.plugins.jgitver)
}

version = project.properties["LIBRARY_VERSION"]!!.toString()
jgitver {
strategy(Strategies.PATTERN)
nonQualifierBranches("main")
}

android {
namespace = "dev.sargunv.maplibrecompose.demoapp"
Expand All @@ -26,7 +31,7 @@ android {
minSdk = libs.versions.android.minSdk.get().toInt()
targetSdk = libs.versions.android.targetSdk.get().toInt()
versionCode = 1
versionName = project.properties["LIBRARY_VERSION"]!!.toString()
versionName = project.version.toString()
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
}
packaging { resources { excludes += "/META-INF/{AL2.0,LGPL2.1}" } }
Expand All @@ -53,7 +58,10 @@ kotlin {
homepage = "PLACEHOLDER HOMEPAGE"
ios.deploymentTarget = "15.3"
podfile = project.file("../iosApp/Podfile")
framework { baseName = "DemoApp" }
framework {
baseName = "DemoApp"
version = "0.0.0"
}
pod("MapLibre", libs.versions.maplibre.ios.get())
}

Expand Down
2 changes: 1 addition & 1 deletion demo-app/demo_app.podspec
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Pod::Spec.new do |spec|
spec.name = 'demo_app'
spec.version = '0.1.1-SNAPSHOT'
spec.version = '0.0.0'
spec.homepage = 'PLACEHOLDER HOMEPAGE'
spec.source = { :http=> ''}
spec.authors = ''
Expand Down
1 change: 1 addition & 0 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ android-application = { id = "com.android.application", version.ref = "agp" }
android-library = { id = "com.android.library", version.ref = "agp" }
dokka = { id = "org.jetbrains.dokka", version = "1.9.20" }
jetbrains-compose = { id = "org.jetbrains.compose", version.ref = "compose" }
jgitver = { id = "fr.brouillard.oss.gradle.jgitver", version = "0.10.0-rc03" }
kotlin-cocoapods = { id = "org.jetbrains.kotlin.native.cocoapods", version.ref = "kotlin" }
kotlin-compose = { id = "org.jetbrains.kotlin.plugin.compose", version.ref = "kotlin" }
kotlin-multiplatform = { id = "org.jetbrains.kotlin.multiplatform", version.ref = "kotlin" }
Expand Down
6 changes: 3 additions & 3 deletions iosApp/Podfile.lock
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
PODS:
- demo_app (0.1.1-SNAPSHOT):
- demo_app (0.0.0):
- MapLibre (= 6.8.1)
- MapLibre (6.8.1)

Expand All @@ -15,9 +15,9 @@ EXTERNAL SOURCES:
:path: "../demo-app"

SPEC CHECKSUMS:
demo_app: 6a2ee1ca6577a342a7fce1edcfe6aa7270d36663
demo_app: a5a32dc01c2392d3d763615568685a2318d40f44
MapLibre: 46c5f2254df2ea03bcd097778bb19c92207d8c2a

PODFILE CHECKSUM: faffe0b5720ea7a96818a908bd93100321d4e51f

COCOAPODS: 1.15.2
COCOAPODS: 1.16.1
7 changes: 6 additions & 1 deletion lib/maplibre-compose/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
@file:OptIn(ExperimentalKotlinGradlePluginApi::class, ExperimentalComposeLibrary::class)

import fr.brouillard.oss.jgitver.Strategies
import org.jetbrains.compose.ExperimentalComposeLibrary
import org.jetbrains.kotlin.gradle.ExperimentalKotlinGradlePluginApi
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
Expand All @@ -14,12 +15,16 @@ plugins {
alias(libs.plugins.spotless)
alias(libs.plugins.dokka)
alias(libs.plugins.maven.publish)
alias(libs.plugins.jgitver)
id("maven-publish")
}

group = "dev.sargunv.maplibre-compose"

version = project.properties["LIBRARY_VERSION"]!!.toString()
jgitver {
strategy(Strategies.MAVEN)
nonQualifierBranches("main")
}

android {
namespace = "dev.sargunv.maplibrecompose"
Expand Down

0 comments on commit 9a93037

Please sign in to comment.