Skip to content

Commit

Permalink
Merge pull request #833 from splendo/ci-example
Browse files Browse the repository at this point in the history
CI example compilation and xcode 16 / macos-15
  • Loading branch information
thoutbeckers authored Nov 1, 2024
2 parents adea8b2 + 0c32c2c commit d314047
Show file tree
Hide file tree
Showing 11 changed files with 205 additions and 39 deletions.
22 changes: 21 additions & 1 deletion .github/workflows/android.yaml
Original file line number Diff line number Diff line change
@@ -1,10 +1,30 @@
name: Android tests
name: Android tests and example
on: pull_request

env:
GRADLE_OPTS: "-Dorg.gradle.jvmargs=\"-Xmx8G -XX:MaxMetaspaceSize=512m -Dorg.gradle.daemon=false -Dkotlin.incremental=false\" -Dorg.gradle.daemon=false -Dkotlin.incremental=false -Dkotlin.daemon.jvm.options=-Xmx8G,-XX:MaxMetaspaceSize=512m,-Dorg.gradle.daemon=false,-Dkotlin.incremental=false"
JAVA_OPTS: "-Xmx8G -XX:MaxMetaspaceSize=512m -Dorg.gradle.daemon=false -Dkotlin.incremental=false"

jobs:
example:
runs-on:
ubuntu-latest
steps:
- name: checkout
uses: actions/checkout@v4
with:
submodules: recursive

- name: set up JDK 17
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: 17

- name: build example
run: ./gradlew --stacktrace android:assembleDebug
working-directory: example

test:
runs-on: ubuntu-latest
steps:
Expand Down
28 changes: 18 additions & 10 deletions .github/workflows/emulator.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,25 +17,23 @@ concurrency:
cancel-in-progress: true

env:
GRADLE_OPTS: "-Dorg.gradle.jvmargs=\"-Xmx8G -XX:MaxMetaspaceSize=512m -Dorg.gradle.daemon=false -Dkotlin.incremental=false\" -Dorg.gradle.daemon=false -Dkotlin.incremental=false -Dkotlin.daemon.jvm.options=-Xmx8G,-XX:MaxMetaspaceSize=512m,-Dorg.gradle.daemon=false,-Dkotlin.incremental=false"
JAVA_OPTS: "-Xmx8G -XX:MaxMetaspaceSize=512m -Dorg.gradle.daemon=false -Dkotlin.incremental=false"
ANDROID_EMULATOR_WAIT_TIME_BEFORE_KILL: 120

jobs:
build:
uses: ./.github/workflows/setup_macos.yaml
uses: ./.github/workflows/setup_linux.yaml
with:
gradleTask: bundleLibRuntimeToJarDebug
project: ${{ inputs.project }}
projectBlacklist: hud

test:
needs: build
runs-on: macos-13
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
api-level: [24, 34]
api-level: [24, 35]
project: ${{ fromJSON(needs.build.outputs.projects) }}
steps:
- name: checkout
Expand All @@ -44,10 +42,13 @@ jobs:
submodules: recursive

- name: Setup tools and cache for workspace
uses: ./.github/workflows/setup_tools_macos/
with:
kotlinVersion: ${{ needs.build.outputs.kotlinVersion }}
arch: ${{ runner.arch == 'X86' && 'x86' || runner.arch == 'X64' && 'x86_64' || runner.arch == 'ARM' && 'arm32' || 'arm64' }}
uses: ./.github/workflows/setup_tools_linux/

- name: Enable KVM group perms
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: AVD cache
uses: actions/cache@v4
Expand All @@ -56,7 +57,7 @@ jobs:
path: |
~/.android/avd/*
~/.android/adb*
key: avd.v11-${{ matrix.api-level }}
key: avd.v12-${{ matrix.api-level }}

- name: create AVD and generate snapshot for caching
if: steps.avd-cache.outputs.cache-hit != 'true'
Expand Down Expand Up @@ -103,6 +104,13 @@ jobs:
./script/check_emulator.sh
./gradlew ${{ inputs.video && 'recordAndroid' }} :${{ matrix.project }}:connectedDebugAndroidTest
- name: Upload test reports on failure
if: failure()
uses: actions/upload-artifact@v4
with:
name: "Android UI tests for ${{ matrix.project }}"
path: "${{ matrix.project }}/build/reports/androidTests/connected/debug/**"

- name: rename video
if: always() && inputs.video
run: mv build/video.mp4 recording-${{ matrix.project }}-${{ matrix.api-level }}.mp4
Expand Down
36 changes: 33 additions & 3 deletions .github/workflows/ios.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
name: iOS tests
on: pull_request

env:
GRADLE_OPTS: "-Dorg.gradle.jvmargs=\"-Xmx8G -XX:MaxMetaspaceSize=512m -Dorg.gradle.daemon=false -Dkotlin.incremental=false\" -Dorg.gradle.daemon=false -Dkotlin.incremental=false -Dkotlin.daemon.jvm.options=-Xmx8G,-XX:MaxMetaspaceSize=512m,-Dorg.gradle.daemon=false,-Dkotlin.incremental=false"
JAVA_OPTS: "-Xmx8G -XX:MaxMetaspaceSize=512m -Dorg.gradle.daemon=false -Dkotlin.incremental=false"
Expand All @@ -12,7 +13,7 @@ jobs:

lint:
needs: build
runs-on: macos-14
runs-on: macos-15
steps:
- name: checkout
uses: actions/checkout@v4
Expand All @@ -37,7 +38,7 @@ jobs:

test:
needs: build
runs-on: macos-14
runs-on: macos-15
strategy:
fail-fast: false
matrix:
Expand All @@ -52,7 +53,6 @@ jobs:
kotlinVersion: ${{ needs.build.outputs.kotlinVersion }}
arch: ${{ runner.arch == 'X86' && 'x86' || runner.arch == 'X64' && 'x86_64' || runner.arch == 'ARM' && 'arm32' || 'arm64' }}


- name: run iOS tests
run: ./gradlew :${{ matrix.module }}:ios${{ runner.arch == 'X86' && 'X86' || runner.arch == 'X64' && 'x86_64' || runner.arch == 'ARM' && 'SimulatorArm32' || 'SimulatorArm64' }}Test
- name: Upload iOS test artifact
Expand All @@ -61,3 +61,33 @@ jobs:
with:
name: ${{ matrix.module}} iOS Test Report HTML
path: ${{ format('**{0}/build/reports/tests/ios{1}Test', matrix.module, runner.arch == 'X86' && 'X86' || runner.arch == 'X64' && 'x86_64' || runner.arch == 'ARM' && 'SimulatorArm32' || 'SimulatorArm64') }}

example:
needs: build
runs-on: macos-15
steps:
- name: checkout
uses: actions/checkout@v4

- name: Setup tools and cache for workspace
uses: ./.github/workflows/setup_tools_macos/
with:
kotlinVersion: ${{ needs.build.outputs.kotlinVersion }}
arch: ${{ runner.arch == 'X86' && 'x86' || runner.arch == 'X64' && 'x86_64' || runner.arch == 'ARM' && 'arm32' || 'arm64' }}

- name: run install
working-directory: example/ios
run: |
brew install sourcery
./install.sh
- name: build example
working-directory: example/ios
run: set -o pipefail && xcodebuild -project Demo.xcodeproj -sdk iphonesimulator -scheme Demo -destination 'platform=iOS Simulator,name=iPhone 16,OS=18.0' | tee xcodebuild.log | xcpretty
shell: bash

- name: 'upload xcodebuild.log'
uses: actions/upload-artifact@v4
with:
name: "xcodebuild.log"
path: "example/ios/xcodebuild.log"
2 changes: 1 addition & 1 deletion .github/workflows/publish.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
OSSRH_USERNAME: ${{ secrets.OSSRH_USERNAME }}
SIGNING_KEY_ID: ${{ secrets.SIGNING_KEY_ID }}
SIGNING_PASSWORD: ${{ secrets.SIGNING_PASSWORD }}
runs-on: ${{ github.ref_name == 'master' && 'tartelet' || 'macos-14' }}
runs-on: ${{ github.ref_name == 'master' && 'tartelet' || 'macos-15' }}
steps:
- name: checkout
uses: actions/checkout@v4
Expand Down
81 changes: 81 additions & 0 deletions .github/workflows/setup_linux.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
name: 'Setup macOS workspace reusable workflow'

on:
workflow_call:
inputs:
gradleTask:
required: false
type: string
project:
required: false
type: string
projectBlacklist:
required: false
type: string

outputs:
projects:
description: "Gradle projects that do not dependent on another project or have other projects dependent on them"
value: ${{ jobs.setup.outputs.projects }}
jobs:
setup:

runs-on: ubuntu-latest

outputs:
projects: ${{ steps.envFile.outputs.projects }}
kotlinVersion: ${{ steps.kotlinVersion.outputs.kotlinVersion }}

steps:
- name: checkout
uses: actions/checkout@v4
with:
submodules: recursive

- name: Enable KVM group perms
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: setup tools and enable Gradle cache writing
uses: ./.github/workflows/setup_tools_linux/
with:
gradle-cache-read-only: 'false'
restore-workspace-cache: 'false'
project: ${{ inputs.project }}

- name: generate file with projects for build matrix
if: inputs.project == ''
run: ./gradlew generateNonDependentProjectsFile -PgenerateNonDependentProjectsFile.blacklist=${{ inputs.projectBlacklist }}

- name: generate file with single requested project for build matrix
if: inputs.project != ''
run: echo "projects=['${{ inputs.project }}']" > non_dependent_projects.properties

- name: show projects for Matrix
run: cat non_dependent_projects.properties

- name: load projects for build matrix
uses: cardinalby/export-env-action@v2
id: envFile
with:
envFile: 'non_dependent_projects.properties'
export: 'false'

- name: run custom Gradle task for all projects
if: inputs.project == ''
run: ./gradlew ${{ inputs.gradleTask }}

- name: run custom Gradle task for single project
if: inputs.project != ''
run: ./gradlew :${{ inputs.project }}:${{ inputs.gradleTask }}

- name: Make cache of workspace
uses: actions/cache/save@v4
id: store-build
with:
path: |
./*
!/.gradle
key: build-linux-${{ github.sha }}-${{ inputs.project }}
2 changes: 1 addition & 1 deletion .github/workflows/setup_macos.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ on:
jobs:
setup:

runs-on: macos-14
runs-on: macos-15

outputs:
projects: ${{ steps.envFile.outputs.projects }}
Expand Down
40 changes: 40 additions & 0 deletions .github/workflows/setup_tools_linux/action.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: "setup tools and caching for macOS workspace"
description: "setup tools and caching for macOS workspace"
inputs:
gradle-cache-read-only:
default: 'true'
description: Updates gradle cache after actions if not read-only
restore-workspace-cache:
default: 'true'
description: Whether to restore the workspace cache
project:
required: false
description: single project to run

runs:
using: "composite"
steps:

- name: set up JDK 17
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: 17

- name: Gradle cache
uses: gradle/actions/setup-gradle@v4
with:
cache-read-only: ${{ inputs.gradle-cache-read-only }}
gradle-home-cache-includes: |
caches
notifications
- name: Make cache of workspace
uses: actions/cache/restore@v4
if: ${{ inputs.restore-workspace-cache != 'false' }}
id: restore-build
with:
path: |
./*
!/.gradle
key: build-linux-${{ github.sha }}-${{ inputs.project }}
4 changes: 2 additions & 2 deletions .github/workflows/setup_tools_macos/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,10 @@ runs:
distribution: 'temurin'
java-version: 17

- name: use Xcode 15
- name: use Xcode 16
uses: maxim-lobanov/setup-xcode@v1
with:
xcode-version: '15'
xcode-version: '16.0'

- name: Gradle cache
uses: gradle/actions/setup-gradle@v3
Expand Down
1 change: 1 addition & 0 deletions base/src/commonTest/kotlin/text/DateFormatterTest.kt
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ class DateFormatterTest {
}

@Test
@Ignore // fails on emulator 24
fun testParseDateWithDifferentTimezone() {
val utcFormatter = KalugaDateFormatter.patternFormat("yyyy.MM.dd G 'at' HH:mm:ss z", KalugaTimeZone.utc, KalugaLocale.enUsPosix)
val pstFormatter = KalugaDateFormatter.patternFormat("yyyy.MM.dd G 'at' HH:mm:ss z", PSTTimeZone, KalugaLocale.enUsPosix)
Expand Down
8 changes: 7 additions & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,10 @@ publishing {
artifactId = "catalog"
}
}
}
}

dependencies {
subprojects.forEach { project ->
kover(project)
}
}
20 changes: 0 additions & 20 deletions example/ios/Demo.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -591,7 +591,6 @@
buildConfigurationList = 74C754F7F747073B076C3A91 /* Build configuration list for PBXNativeTarget "Demo" */;
buildPhases = (
95D0860F27D2540B00838E57 /* Compile Kotlin/Native */,
20BB9E6A29631B600096E836 /* SwiftLint */,
744156D82DB12C1F9CC3C68F /* Sources */,
74B635A880CB81844D31A213 /* Frameworks */,
746C535FD7586B544C684D34 /* Resources */,
Expand Down Expand Up @@ -695,25 +694,6 @@
/* End PBXResourcesBuildPhase section */

/* Begin PBXShellScriptBuildPhase section */
20BB9E6A29631B600096E836 /* SwiftLint */ = {
isa = PBXShellScriptBuildPhase;
alwaysOutOfDate = 1;
buildActionMask = 2147483647;
files = (
);
inputFileListPaths = (
);
inputPaths = (
);
name = SwiftLint;
outputFileListPaths = (
);
outputPaths = (
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "# Type a script or drag a script file from your workspace to insert its path.\nexport PATH=\"$PATH:/opt/homebrew/bin\"\nif which swiftlint > /dev/null; then\n swiftlint\nelse\n echo \"warning: SwiftLint not installed, download from https://github.com/realm/SwiftLint\"\nfi\n";
};
95D0860F27D2540B00838E57 /* Compile Kotlin/Native */ = {
isa = PBXShellScriptBuildPhase;
alwaysOutOfDate = 1;
Expand Down

0 comments on commit d314047

Please sign in to comment.