diff --git a/.github/workflows/analyze.yml b/.github/workflows/analyze.yml new file mode 100644 index 00000000..ee498dd0 --- /dev/null +++ b/.github/workflows/analyze.yml @@ -0,0 +1,29 @@ +name: "Analyze" +on: + push: + branches: + - main + - release/** + pull_request: + paths-ignore: + - "**/*.md" + - +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +jobs: + analyze: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + + - name: JDK setup + uses: actions/setup-java@v3 + with: + java-version: 17 + distribution: temurin + + - name: Analyze + run: ./gradlew apiCheck detekt \ No newline at end of file diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml deleted file mode 100644 index e7296d61..00000000 --- a/.github/workflows/build.yml +++ /dev/null @@ -1,62 +0,0 @@ -name: "Build" -on: - push: - branches: - - main - - release/** - pull_request: - -jobs: - build: - name: Build Job ${{ matrix.os }} - runs-on: ${{ matrix.os }} - - strategy: - fail-fast: false - matrix: - os: [macos-latest] - java: ["11"] - - steps: - - name: Git checkout - uses: actions/checkout@v3 - - - name: "Set up Java: ${{ matrix.java }}" - uses: actions/setup-java@v3 - with: - java-version: ${{ matrix.java }} - distribution: "adopt" - - - name: Cache Gradle packages - uses: actions/cache@v2 - with: - path: | - ~/.gradle/caches - ~/.gradle/wrapper - key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }} - restore-keys: | - ${{ runner.os }}-gradle- - - # Clean, build - - name: Make all - run: make all - env: - SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }} - - # We stop gradle at the end to make sure the cache folders - # don't contain any lock files and are free to be cached. - - name: Make stop - run: make stop - - - name: Archive packages - uses: actions/upload-artifact@v3 - with: - name: ${{ github.sha }} - if-no-files-found: error - path: | - ./*/build/distributions/*.zip - - - name: Upload coverage to Codecov - uses: codecov/codecov-action@eaaf4bedf32dbdc6b720b63067d99c4d77d6047d # pin@v3 - with: - name: sentry-kotlin-multiplatform diff --git a/.github/workflows/kotlin-multiplatform.yml b/.github/workflows/kotlin-multiplatform.yml new file mode 100644 index 00000000..24b84a57 --- /dev/null +++ b/.github/workflows/kotlin-multiplatform.yml @@ -0,0 +1,124 @@ +name: "Lib: sentry-kotlin-multiplatform" +on: + push: + branches: + - main + - release/** + pull_request: + paths-ignore: + - "**/*.md" + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +jobs: + build-apple: + runs-on: macos-latest-large + + steps: + - uses: actions/checkout@v4 + + - name: JDK setup + uses: actions/setup-java@v3 + with: + java-version: 17 + distribution: temurin + + - name: Cached Konan + uses: actions/cache@9b0c1fce7a93df8e3bb8926b0d6e9d89e92f20a7 #v3 + with: + path: ~/.konan + key: ${{ runner.os }}-konan-${{ hashFiles('**/*.gradle*') }}-${{ hashFiles('**/gradle/wrapper/gradle-wrapper.properties') }} + restore-keys: ${{ runner.os }}-konan- + + - name: Cached Gradle + uses: gradle/gradle-build-action@842c587ad8aa4c68eeba24c396e15af4c2e9f30a + + - name: Apple build + run: | + ./scripts/build-apple.sh sentry-kotlin-multiplatform + env: + SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }} + + build-apple-samples: + runs-on: macos-latest-large + + steps: + - uses: actions/checkout@v4 + + - name: JDK setup + uses: actions/setup-java@v3 + with: + java-version: 17 + distribution: temurin + + - name: Cached Konan + uses: actions/cache@9b0c1fce7a93df8e3bb8926b0d6e9d89e92f20a7 #v3 + with: + path: ~/.konan + key: ${{ runner.os }}-konan-${{ hashFiles('**/*.gradle*') }}-${{ hashFiles('**/gradle/wrapper/gradle-wrapper.properties') }} + restore-keys: ${{ runner.os }}-konan- + + - name: Cached Gradle + uses: gradle/gradle-build-action@842c587ad8aa4c68eeba24c396e15af4c2e9f30a + + - name: Apple build + run: | + make buildAppleSamples + + build-jvm: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + + - name: JDK setup + uses: actions/setup-java@v3 + with: + java-version: 17 + distribution: temurin + + - name: Cached Gradle + uses: gradle/gradle-build-action@842c587ad8aa4c68eeba24c396e15af4c2e9f30a + + - name: JVM build + run: | + ./scripts/build-jvm.sh sentry-kotlin-multiplatform + make createCoverageReports + env: + SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }} + GRADLE_OPTS: -Dorg.gradle.jvmargs="-Xmx3g" + + # Kover coverage currently only works for JVM + - name: Upload coverage to Codecov + uses: codecov/codecov-action@eaaf4bedf32dbdc6b720b63067d99c4d77d6047d # pin@v3 + with: + name: sentry-kotlin-multiplatform + + archive-distribution: + runs-on: macos-latest-large + + steps: + - uses: actions/checkout@v4 + + - name: JDK setup + uses: actions/setup-java@v3 + with: + java-version: 17 + distribution: temurin + + - name: Cached Gradle + uses: gradle/gradle-build-action@842c587ad8aa4c68eeba24c396e15af4c2e9f30a + + - name: DistZip + run: | + ./scripts/build-distribution.sh sentry-kotlin-multiplatform + + - name: Archive packages + uses: actions/upload-artifact@v3 + with: + name: ${{ github.sha }} + if-no-files-found: error + path: | + ./*/build/distributions/*.zip diff --git a/Makefile b/Makefile index e3398fd4..cad92b41 100644 --- a/Makefile +++ b/Makefile @@ -37,13 +37,12 @@ buildProject: # Build Apple Samples buildAppleSamples: + ./gradlew build -p sentry-samples cd ./sentry-samples/kmp-app-cocoapods/iosApp/iosApp && touch iosApp.xcconfig - cd ./sentry-samples/kmp-app-spm/iosApp && touch iosApp.xcconfig cd ./sentry-samples/kmp-app-mvvm-di/iosApp && touch iosApp.xcconfig sudo xcode-select --switch /Applications/Xcode.app && /usr/bin/xcodebuild -version cd ./sentry-samples/kmp-app-cocoapods/iosApp; pod install xcodebuild -workspace ./sentry-samples/kmp-app-cocoapods/iosApp/iosApp.xcworkspace -scheme iosApp -configuration Debug -sdk iphonesimulator -arch arm64 - xcodebuild -project ./sentry-samples/kmp-app-spm/iosApp.xcodeproj -scheme iosApp -configuration Debug -sdk iphonesimulator -arch arm64 xcodebuild -project ./sentry-samples/kmp-app-mvvm-di/iosApp.xcodeproj -scheme iosApp -configuration Debug -sdk iphonesimulator -arch arm64 diff --git a/scripts/build-apple.sh b/scripts/build-apple.sh new file mode 100755 index 00000000..fb1c37c5 --- /dev/null +++ b/scripts/build-apple.sh @@ -0,0 +1,27 @@ +#!/bin/bash + +if [ -z "$1" ]; then + echo "Please provide a gradle project name." + exit 1 +fi + +PROJECT_NAME="$1" + +./gradlew "macosX64Test" \ + "iosX64Test" \ + "watchosX64Test" \ + "tvosX64Test" \ + "publishKotlinMultiplatformPublicationToMavenLocal" \ + "publishIosArm64PublicationToMavenLocal" \ + "publishIosSimulatorArm64PublicationToMavenLocal" \ + "publishIosX64PublicationToMavenLocal" \ + "publishMacosX64PublicationToMavenLocal" \ + "publishMacosArm64PublicationToMavenLocal" \ + "publishWatchosArm32PublicationToMavenLocal" \ + "publishWatchosArm64PublicationToMavenLocal" \ + "publishWatchosSimulatorArm64PublicationToMavenLocal" \ + "publishWatchosX64PublicationToMavenLocal" \ + "publishTvosArm64PublicationToMavenLocal" \ + "publishTvosSimulatorArm64PublicationToMavenLocal" \ + "publishTvosX64PublicationToMavenLocal" \ + -p "${PROJECT_NAME}" diff --git a/scripts/build-distribution.sh b/scripts/build-distribution.sh new file mode 100755 index 00000000..261c084d --- /dev/null +++ b/scripts/build-distribution.sh @@ -0,0 +1,9 @@ +#!/bin/bash + +if [ -z "$1" ]; then + echo "Please provide a gradle project name." + exit 1 +fi + +PROJECT_NAME="$1" +./gradlew "distzip" -p "${PROJECT_NAME}" \ No newline at end of file diff --git a/scripts/build-jvm.sh b/scripts/build-jvm.sh new file mode 100755 index 00000000..31ec07a0 --- /dev/null +++ b/scripts/build-jvm.sh @@ -0,0 +1,15 @@ +#!/bin/bash + +if [ -z "$1" ]; then + echo "Please provide a gradle project name." + exit 1 +fi + +PROJECT_NAME="$1" +./gr +./gradlew "testDebugUnitTest" \ + "testReleaseUnitTest" \ + "publishAndroidReleasePublicationToMavenLocal" \ + "publishJvmPublicationToMavenLocal" \ + "publishKotlinMultiplatformPublicationToMavenLocal" \ + -p "${PROJECT_NAME}" \ No newline at end of file diff --git a/sentry-samples/kmp-app-cocoapods/iosApp/Podfile.lock b/sentry-samples/kmp-app-cocoapods/iosApp/Podfile.lock index c32432f8..ac971868 100644 --- a/sentry-samples/kmp-app-cocoapods/iosApp/Podfile.lock +++ b/sentry-samples/kmp-app-cocoapods/iosApp/Podfile.lock @@ -27,4 +27,4 @@ SPEC CHECKSUMS: PODFILE CHECKSUM: f282da88f39e69507b0a255187c8a6b644477756 -COCOAPODS: 1.12.0 +COCOAPODS: 1.13.0