Skip to content

Commit add53d3

Browse files
authored
ci: improve speed and refactor (#147)
1 parent fe4b42f commit add53d3

File tree

8 files changed

+206
-65
lines changed

8 files changed

+206
-65
lines changed

.github/workflows/analyze.yml

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
name: "Analyze"
2+
on:
3+
push:
4+
branches:
5+
- main
6+
- release/**
7+
pull_request:
8+
paths-ignore:
9+
- "**/*.md"
10+
-
11+
concurrency:
12+
group: ${{ github.workflow }}-${{ github.ref }}
13+
cancel-in-progress: true
14+
15+
jobs:
16+
analyze:
17+
runs-on: ubuntu-latest
18+
19+
steps:
20+
- uses: actions/checkout@v4
21+
22+
- name: JDK setup
23+
uses: actions/setup-java@v3
24+
with:
25+
java-version: 17
26+
distribution: temurin
27+
28+
- name: Analyze
29+
run: ./gradlew apiCheck detekt

.github/workflows/build.yml

Lines changed: 0 additions & 62 deletions
This file was deleted.
Lines changed: 124 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,124 @@
1+
name: "Lib: sentry-kotlin-multiplatform"
2+
on:
3+
push:
4+
branches:
5+
- main
6+
- release/**
7+
pull_request:
8+
paths-ignore:
9+
- "**/*.md"
10+
11+
concurrency:
12+
group: ${{ github.workflow }}-${{ github.ref }}
13+
cancel-in-progress: true
14+
15+
jobs:
16+
build-apple:
17+
runs-on: macos-latest-large
18+
19+
steps:
20+
- uses: actions/checkout@v4
21+
22+
- name: JDK setup
23+
uses: actions/setup-java@v3
24+
with:
25+
java-version: 17
26+
distribution: temurin
27+
28+
- name: Cached Konan
29+
uses: actions/cache@9b0c1fce7a93df8e3bb8926b0d6e9d89e92f20a7 #v3
30+
with:
31+
path: ~/.konan
32+
key: ${{ runner.os }}-konan-${{ hashFiles('**/*.gradle*') }}-${{ hashFiles('**/gradle/wrapper/gradle-wrapper.properties') }}
33+
restore-keys: ${{ runner.os }}-konan-
34+
35+
- name: Cached Gradle
36+
uses: gradle/gradle-build-action@842c587ad8aa4c68eeba24c396e15af4c2e9f30a
37+
38+
- name: Apple build
39+
run: |
40+
./scripts/build-apple.sh sentry-kotlin-multiplatform
41+
env:
42+
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
43+
44+
build-apple-samples:
45+
runs-on: macos-latest-large
46+
47+
steps:
48+
- uses: actions/checkout@v4
49+
50+
- name: JDK setup
51+
uses: actions/setup-java@v3
52+
with:
53+
java-version: 17
54+
distribution: temurin
55+
56+
- name: Cached Konan
57+
uses: actions/cache@9b0c1fce7a93df8e3bb8926b0d6e9d89e92f20a7 #v3
58+
with:
59+
path: ~/.konan
60+
key: ${{ runner.os }}-konan-${{ hashFiles('**/*.gradle*') }}-${{ hashFiles('**/gradle/wrapper/gradle-wrapper.properties') }}
61+
restore-keys: ${{ runner.os }}-konan-
62+
63+
- name: Cached Gradle
64+
uses: gradle/gradle-build-action@842c587ad8aa4c68eeba24c396e15af4c2e9f30a
65+
66+
- name: Apple build
67+
run: |
68+
make buildAppleSamples
69+
70+
build-jvm:
71+
runs-on: ubuntu-latest
72+
73+
steps:
74+
- uses: actions/checkout@v4
75+
76+
- name: JDK setup
77+
uses: actions/setup-java@v3
78+
with:
79+
java-version: 17
80+
distribution: temurin
81+
82+
- name: Cached Gradle
83+
uses: gradle/gradle-build-action@842c587ad8aa4c68eeba24c396e15af4c2e9f30a
84+
85+
- name: JVM build
86+
run: |
87+
./scripts/build-jvm.sh sentry-kotlin-multiplatform
88+
make createCoverageReports
89+
env:
90+
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
91+
GRADLE_OPTS: -Dorg.gradle.jvmargs="-Xmx3g"
92+
93+
# Kover coverage currently only works for JVM
94+
- name: Upload coverage to Codecov
95+
uses: codecov/codecov-action@eaaf4bedf32dbdc6b720b63067d99c4d77d6047d # pin@v3
96+
with:
97+
name: sentry-kotlin-multiplatform
98+
99+
archive-distribution:
100+
runs-on: macos-latest-large
101+
102+
steps:
103+
- uses: actions/checkout@v4
104+
105+
- name: JDK setup
106+
uses: actions/setup-java@v3
107+
with:
108+
java-version: 17
109+
distribution: temurin
110+
111+
- name: Cached Gradle
112+
uses: gradle/gradle-build-action@842c587ad8aa4c68eeba24c396e15af4c2e9f30a
113+
114+
- name: DistZip
115+
run: |
116+
./scripts/build-distribution.sh sentry-kotlin-multiplatform
117+
118+
- name: Archive packages
119+
uses: actions/upload-artifact@v3
120+
with:
121+
name: ${{ github.sha }}
122+
if-no-files-found: error
123+
path: |
124+
./*/build/distributions/*.zip

Makefile

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,13 +37,12 @@ buildProject:
3737

3838
# Build Apple Samples
3939
buildAppleSamples:
40+
./gradlew build -p sentry-samples
4041
cd ./sentry-samples/kmp-app-cocoapods/iosApp/iosApp && touch iosApp.xcconfig
41-
cd ./sentry-samples/kmp-app-spm/iosApp && touch iosApp.xcconfig
4242
cd ./sentry-samples/kmp-app-mvvm-di/iosApp && touch iosApp.xcconfig
4343
sudo xcode-select --switch /Applications/Xcode.app && /usr/bin/xcodebuild -version
4444
cd ./sentry-samples/kmp-app-cocoapods/iosApp; pod install
4545
xcodebuild -workspace ./sentry-samples/kmp-app-cocoapods/iosApp/iosApp.xcworkspace -scheme iosApp -configuration Debug -sdk iphonesimulator -arch arm64
46-
xcodebuild -project ./sentry-samples/kmp-app-spm/iosApp.xcodeproj -scheme iosApp -configuration Debug -sdk iphonesimulator -arch arm64
4746
xcodebuild -project ./sentry-samples/kmp-app-mvvm-di/iosApp.xcodeproj -scheme iosApp -configuration Debug -sdk iphonesimulator -arch arm64
4847

4948

scripts/build-apple.sh

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
#!/bin/bash
2+
3+
if [ -z "$1" ]; then
4+
echo "Please provide a gradle project name."
5+
exit 1
6+
fi
7+
8+
PROJECT_NAME="$1"
9+
10+
./gradlew "macosX64Test" \
11+
"iosX64Test" \
12+
"watchosX64Test" \
13+
"tvosX64Test" \
14+
"publishKotlinMultiplatformPublicationToMavenLocal" \
15+
"publishIosArm64PublicationToMavenLocal" \
16+
"publishIosSimulatorArm64PublicationToMavenLocal" \
17+
"publishIosX64PublicationToMavenLocal" \
18+
"publishMacosX64PublicationToMavenLocal" \
19+
"publishMacosArm64PublicationToMavenLocal" \
20+
"publishWatchosArm32PublicationToMavenLocal" \
21+
"publishWatchosArm64PublicationToMavenLocal" \
22+
"publishWatchosSimulatorArm64PublicationToMavenLocal" \
23+
"publishWatchosX64PublicationToMavenLocal" \
24+
"publishTvosArm64PublicationToMavenLocal" \
25+
"publishTvosSimulatorArm64PublicationToMavenLocal" \
26+
"publishTvosX64PublicationToMavenLocal" \
27+
-p "${PROJECT_NAME}"

scripts/build-distribution.sh

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
#!/bin/bash
2+
3+
if [ -z "$1" ]; then
4+
echo "Please provide a gradle project name."
5+
exit 1
6+
fi
7+
8+
PROJECT_NAME="$1"
9+
./gradlew "distzip" -p "${PROJECT_NAME}"

scripts/build-jvm.sh

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
#!/bin/bash
2+
3+
if [ -z "$1" ]; then
4+
echo "Please provide a gradle project name."
5+
exit 1
6+
fi
7+
8+
PROJECT_NAME="$1"
9+
./gr
10+
./gradlew "testDebugUnitTest" \
11+
"testReleaseUnitTest" \
12+
"publishAndroidReleasePublicationToMavenLocal" \
13+
"publishJvmPublicationToMavenLocal" \
14+
"publishKotlinMultiplatformPublicationToMavenLocal" \
15+
-p "${PROJECT_NAME}"

sentry-samples/kmp-app-cocoapods/iosApp/Podfile.lock

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,4 +27,4 @@ SPEC CHECKSUMS:
2727

2828
PODFILE CHECKSUM: f282da88f39e69507b0a255187c8a6b644477756
2929

30-
COCOAPODS: 1.12.0
30+
COCOAPODS: 1.13.0

0 commit comments

Comments
 (0)