Skip to content

Commit

Permalink
CI
Browse files Browse the repository at this point in the history
  • Loading branch information
sargunv committed Nov 22, 2024
1 parent 7245937 commit 87a43f4
Show file tree
Hide file tree
Showing 24 changed files with 150 additions and 27 deletions.
10 changes: 9 additions & 1 deletion .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,14 @@ root = true
end_of_line = lf
insert_final_newline = true

[*.yml]
indent_style = space
indent_size = 2

[*.{kt,kts}]
indent_style = space
indent_size = 2
indent_size = 2

[*.{swift}]
indent_style = space
indent_size = 2
43 changes: 43 additions & 0 deletions .github/actions/run-with-avd/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: 'Execute with AVD'
description: 'Set up an Android virtual device, cache it, and run a script'
inputs:
api-level:
description: 'API level of the platform system image'
required: true
script:
description: 'Custom script to run'
required: true
runs:
using: "composite"
steps:
- name: Configure KVM
shell: bash
run: |
echo 'KERNEL=="kvm", GROUP="kvm", MODE="0666", OPTIONS+="static_node=kvm"' | sudo tee /etc/udev/rules.d/99-kvm4all.rules
sudo udevadm control --reload-rules
sudo udevadm trigger --name-match=kvm
- name: Cache AVD
uses: actions/cache@v4
id: avd-cache
with:
path: |
~/.android/avd/*
~/.android/adb*
key: avd-v${{ inputs.api-level }}
- name: Create AVD for caching
if: steps.avd-cache.outputs.cache-hit != 'true'
uses: reactivecircus/android-emulator-runner@v2
with:
api-level: ${{ inputs.api-level }}
arch: x86_64
force-avd-creation: false
emulator-options: -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none
script: echo "Generated AVD snapshot for caching."
- name: ${{ inputs.script }}
uses: reactivecircus/android-emulator-runner@v2
with:
api-level: ${{ matrix.api-level }}
arch: x86_64
force-avd-creation: false
emulator-options: -no-snapshot-save -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none
script: ${{ inputs.script }}
46 changes: 46 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
name: CI

on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]

env:
GRADLE_OPTS: "-Dorg.gradle.jvmargs=-Xmx4g -Dorg.gradle.daemon=false -Dkotlin.incremental=false"

jobs:
gradle:
name: ${{ matrix.name }}
strategy:
fail-fast: false
matrix:
include:
- name: Spotless
os: ubuntu-latest
task: spotlessCheck
- name: Lint Android
os: ubuntu-latest
task: lint
- name: Test Android
os: ubuntu-latest
task: connectedDebugAndroidTest
use-android-emulator: true
- name: Test iOS
os: macos-latest
task: iosSimulatorArm64Test
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- uses: actions/setup-java@v4
with:
java-version: '23'
distribution: 'temurin'
cache: gradle
- if: ${{ matrix.use-android-emulator }}
uses: ./.github/actions/run-with-avd.yml
with:
api-level: 35
script: ./gradlew '${{ matrix.task }}'
- if: ${{ !matrix.use-android-emulator }}
run: ./gradlew '${{ matrix.task }}'
2 changes: 1 addition & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,6 @@ subprojects {
spotless {
format("swift") {
target("iosApp/iosApp/**/*.swift")
nativeCmd("swiftFormat","/usr/bin/env", listOf("swift-format"))
nativeCmd("swiftFormat","/usr/bin/env", listOf("swift", "format"))
}
}
2 changes: 2 additions & 0 deletions maplibre-compose/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -99,3 +99,5 @@ spotless {
ktfmt().googleStyle()
}
}

// tasks.get("test").dependsOn("connectedAndroidTest", "iosSimulatorArm64Test")
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ internal actual class CircleLayer actual constructor(id: String, source: Source)
FeatureLayer(source) {
override val impl = MLNCircleLayer(id, source.id)

override var sourceLayer: String by impl::sourceLayer
actual override var sourceLayer: String by impl::sourceLayer

override fun setFilter(filter: Expression<Boolean>) {
actual override fun setFilter(filter: Expression<Boolean>) {
impl.setFilter(filter.toMLNExpression() ?: MLNExpression.literal(true))
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@ internal actual class FillExtrusionLayer actual constructor(id: String, source:
FeatureLayer(source) {
override val impl = MLNFillExtrusionLayer(id, source.id)

override var sourceLayer: String by impl::sourceLayer
actual override var sourceLayer: String by impl::sourceLayer

override fun setFilter(filter: Expression<Boolean>) {
actual override fun setFilter(filter: Expression<Boolean>) {
impl.setFilter(filter.toMLNExpression() ?: MLNExpression.literal(true))
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@ internal actual class FillLayer actual constructor(id: String, source: Source) :
FeatureLayer(source) {
override val impl = MLNFillLayer(id, source.id)

override var sourceLayer: String by impl::sourceLayer
actual override var sourceLayer: String by impl::sourceLayer

override fun setFilter(filter: Expression<Boolean>) {
actual override fun setFilter(filter: Expression<Boolean>) {
impl.setFilter(filter.toMLNExpression() ?: MLNExpression.literal(true))
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ internal actual class HeatmapLayer actual constructor(id: String, source: Source
FeatureLayer(source) {
override val impl = MLNHeatmapLayer(id, source.id)

override var sourceLayer: String by impl::sourceLayer
actual override var sourceLayer: String by impl::sourceLayer

override fun setFilter(filter: Expression<Boolean>) {
actual override fun setFilter(filter: Expression<Boolean>) {
impl.setFilter(filter.toMLNExpression() ?: MLNExpression.literal(true))
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ internal actual class LineLayer actual constructor(id: String, source: Source) :

override val impl = MLNLineLayer(id, source.id)

override var sourceLayer: String by impl::sourceLayer
actual override var sourceLayer: String by impl::sourceLayer

override fun setFilter(filter: Expression<Boolean>) {
actual override fun setFilter(filter: Expression<Boolean>) {
impl.setFilter(filter.toMLNExpression() ?: MLNExpression.literal(true))
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@ internal actual class SymbolLayer actual constructor(id: String, source: Source)
FeatureLayer(source) {
override val impl = MLNSymbolLayer(id, source.id)

override var sourceLayer: String by impl::sourceLayer
actual override var sourceLayer: String by impl::sourceLayer

override fun setFilter(filter: Expression<Boolean>) {
actual override fun setFilter(filter: Expression<Boolean>) {
impl.setFilter(filter.toMLNExpression() ?: MLNExpression.literal(true))
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ import dev.sargunv.maplibrecompose.core.source.Source

@PublishedApi
internal expect class CircleLayer(id: String, source: Source) : FeatureLayer {
override var sourceLayer: String

override fun setFilter(filter: Expression<Boolean>)

fun setCircleSortKey(sortKey: Expression<Number>)

fun setCircleRadius(radius: Expression<Number>)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@ import dev.sargunv.maplibrecompose.core.source.Source

@PublishedApi
internal expect class FillExtrusionLayer(id: String, source: Source) : FeatureLayer {
override var sourceLayer: String

override fun setFilter(filter: Expression<Boolean>)

fun setFillExtrusionOpacity(opacity: Expression<Number>)

fun setFillExtrusionColor(color: Expression<Color>)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@ import dev.sargunv.maplibrecompose.core.source.Source

@PublishedApi
internal expect class FillLayer(id: String, source: Source) : FeatureLayer {
override var sourceLayer: String

override fun setFilter(filter: Expression<Boolean>)

fun setFillSortKey(sortKey: Expression<Number>)

fun setFillAntialias(antialias: Expression<Boolean>)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ import dev.sargunv.maplibrecompose.core.source.Source

@PublishedApi
internal expect class HeatmapLayer(id: String, source: Source) : FeatureLayer {
override var sourceLayer: String

override fun setFilter(filter: Expression<Boolean>)

fun setHeatmapRadius(radius: Expression<Number>)

fun setHeatmapWeight(weight: Expression<Number>)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@ import dev.sargunv.maplibrecompose.core.source.Source

@PublishedApi
internal expect class LineLayer(id: String, source: Source) : FeatureLayer {
override var sourceLayer: String

override fun setFilter(filter: Expression<Boolean>)

fun setLineCap(cap: Expression<String>)

fun setLineJoin(join: Expression<String>)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@ import dev.sargunv.maplibrecompose.core.source.Source

@PublishedApi
internal expect class SymbolLayer(id: String, source: Source) : FeatureLayer {
override var sourceLayer: String

override fun setFilter(filter: Expression<Boolean>)

fun setSymbolPlacement(placement: Expression<String>)

fun setSymbolSpacing(spacing: Expression<Number>)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,13 @@ internal actual class CircleLayer actual constructor(id: String, source: Source)

override val impl = MLNCircleStyleLayer(id, source.impl)

override var sourceLayer: String
actual override var sourceLayer: String
get() = impl.sourceLayerIdentifier!!
set(value) {
impl.sourceLayerIdentifier = value
}

override fun setFilter(filter: Expression<Boolean>) {
actual override fun setFilter(filter: Expression<Boolean>) {
impl.predicate = filter.toPredicate()
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,13 @@ internal actual class FillExtrusionLayer actual constructor(id: String, source:

override val impl = MLNFillExtrusionStyleLayer(id, source.impl)

override var sourceLayer: String
actual override var sourceLayer: String
get() = impl.sourceLayerIdentifier!!
set(value) {
impl.sourceLayerIdentifier = value
}

override fun setFilter(filter: Expression<Boolean>) {
actual override fun setFilter(filter: Expression<Boolean>) {
impl.predicate = filter.toPredicate()
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,13 @@ internal actual class FillLayer actual constructor(id: String, source: Source) :

override val impl = MLNFillStyleLayer(id, source.impl)

override var sourceLayer: String
actual override var sourceLayer: String
get() = impl.sourceLayerIdentifier!!
set(value) {
impl.sourceLayerIdentifier = value
}

override fun setFilter(filter: Expression<Boolean>) {
actual override fun setFilter(filter: Expression<Boolean>) {
impl.predicate = filter.toPredicate()
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,13 @@ internal actual class HeatmapLayer actual constructor(id: String, source: Source

override val impl = MLNHeatmapStyleLayer(id, source.impl)

override var sourceLayer: String
actual override var sourceLayer: String
get() = impl.sourceLayerIdentifier!!
set(value) {
impl.sourceLayerIdentifier = value
}

override fun setFilter(filter: Expression<Boolean>) {
actual override fun setFilter(filter: Expression<Boolean>) {
impl.predicate = filter.toPredicate()
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,13 @@ internal actual class LineLayer actual constructor(id: String, source: Source) :

override val impl = MLNLineStyleLayer(id, source.impl)

override var sourceLayer: String
actual override var sourceLayer: String
get() = impl.sourceLayerIdentifier!!
set(value) {
impl.sourceLayerIdentifier = value
}

override fun setFilter(filter: Expression<Boolean>) {
actual override fun setFilter(filter: Expression<Boolean>) {
impl.predicate = filter.toPredicate()
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,13 @@ internal actual class SymbolLayer actual constructor(id: String, source: Source)

override val impl = MLNSymbolStyleLayer(id, source.impl)

override var sourceLayer: String
actual override var sourceLayer: String
get() = impl.sourceLayerIdentifier!!
set(value) {
impl.sourceLayerIdentifier = value
}

override fun setFilter(filter: Expression<Boolean>) {
actual override fun setFilter(filter: Expression<Boolean>) {
impl.predicate = filter.toPredicate()
}

Expand Down
2 changes: 1 addition & 1 deletion settings.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
@file:Suppress("UnstableApiUsage")

rootProject.name = "maplibre-compose-root"
rootProject.name = "root"

enableFeaturePreview("TYPESAFE_PROJECT_ACCESSORS")

Expand Down

0 comments on commit 87a43f4

Please sign in to comment.