Repository navigation
123 lines (116 loc) Β· 5.98 KB
/
Copy pathbuild.yml
File metadata and controls
123 lines (116 loc) Β· 5.98 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
name: Build & Test
on:
push:
branches: [ master, main ]
# Any base branch, so work stacked on a feature branch is built and tested too.
pull_request:
concurrency:
group: build-${{ github.ref }}
cancel-in-progress: true
# Least privilege: these jobs only read the repo. Without this the default token
# permissions are far wider than anything here needs.
permissions:
contents: read
jobs:
build-android:
runs-on: ubuntu-latest
timeout-minutes: 45
steps:
- uses: actions/checkout@v7
with:
# The API removal check reads the dumps at the last release tag.
fetch-depth: 0
- uses: actions/setup-java@v6
with:
distribution: 'zulu'
java-version: '21'
- uses: gradle/actions/setup-gradle@v6
- name: Build libraries
run: ./gradlew :colorpicker-foundation:assemble :colorpicker-material3:assemble :color:assemble :color-compose:assemble
- name: Run tests
run: ./gradlew :colorpicker-foundation:allTests :colorpicker-material3:allTests :color:allTests :color-compose:allTests
# colorpicker-foundation is for apps on another design system; Material must not reach them through it.
- name: Check the foundation carries no Material
run: ./gradlew :colorpicker-foundation:checkNoMaterial
# Fails when public API drifts from each library's api/. Without this the
# binary-compatibility plugin is configured but never consulted.
- name: Check the public API matches the committed dump
run: ./gradlew apiCheck
# apiCheck compares against the dump in the working tree, which apiDump rewrites along with
# the change. This compares against the last release, so a removal cannot ride along.
- name: Check nothing the last release published was removed
run: bash scripts/check-api-removals.sh
# The references under screenshot-tests/src/screenshotTestDebug/reference are only a
# regression check if something compares against them. These render host-side, so
# ubuntu-latest needs no emulator.
- name: Validate the Compose preview goldens
run: ./gradlew :screenshot-tests:validateDebugScreenshotTest
# A failure here is a visual difference, which the log reports only as a pixel count.
# The report holds the reference, the actual and the diff for each preview.
- name: Upload the screenshot diff report
if: failure()
uses: actions/upload-artifact@v7
with:
name: screenshot-diff-report
path: screenshot-tests/build/reports/screenshotTest/
- name: Build sample APK
run: ./gradlew :sample:androidApp:assembleDebug
- name: Upload sample APK
uses: actions/upload-artifact@v7
with:
name: sample-apk
path: sample/androidApp/build/outputs/apk/debug/*.apk
build-ios:
runs-on: macos-15
timeout-minutes: 60
steps:
- uses: actions/checkout@v7
with:
# The API removal check reads the dumps at the last release tag.
fetch-depth: 0
# publish.yml runs this on macOS, whose awk, sort and comm are BSD's. Running it here
# too means a difference shows on a pull request rather than first on a release tag.
- name: Check nothing the last release published was removed
run: bash scripts/check-api-removals.sh
- uses: actions/setup-java@v6
with:
distribution: 'zulu'
java-version: '21'
- uses: gradle/actions/setup-gradle@v6
# macos-15 defaults to Xcode 16.4, whose iOS SDK predates UIViewLayoutRegion β a
# symbol Compose Multiplatform's ui-uikit references. Kotlin/Native static caches
# link whole modules rather than tree-shaking, so any iOS *test executable* fails to
# link without a 26.x SDK (the static framework link survives because an archive
# never resolves external symbols). The image ships several Xcodes; take the newest.
- name: Select the newest installed Xcode
run: |
XCODE=$(ls -d /Applications/Xcode_*.app | sort -V | tail -1)
echo "Using $XCODE"
sudo xcode-select -s "$XCODE/Contents/Developer"
xcodebuild -version
- name: Build iOS framework
run: ./gradlew :colorpicker-material3:linkDebugFrameworkIosSimulatorArm64
- name: Run iOS simulator tests
run: ./gradlew :colorpicker-foundation:iosSimulatorArm64Test :colorpicker-material3:iosSimulatorArm64Test :color:iosSimulatorArm64Test :color-compose:iosSimulatorArm64Test
# A release is the first time publish.yml runs, and what it uploads to Maven Central cannot be replaced.
# Publishing locally builds the same publications here, where only macOS builds all six of each module:
# the POMs, the sources and the Dokka javadoc jars. Nothing is signed without the key.
- name: Publish every module locally
run: ./gradlew publishToMavenLocal
- name: Check each module published its six targets
run: |
VERSION="$(sed -n 's/^VERSION_NAME=//p' gradle.properties)"
for module in color color-compose colorpicker-foundation colorpicker-material3; do
for suffix in "" -android -jvm -wasm-js -iosarm64 -iossimulatorarm64; do
pom="$HOME/.m2/repository/codes/side/$module$suffix/$VERSION/$module$suffix-$VERSION.pom"
if [ ! -f "$pom" ]; then
echo "::error::$module$suffix $VERSION was not published"
exit 1
fi
done
done
# A POM that exists says nothing of whether an app can use it. tools/consumer is a build of its own that
# depends on colorpicker-material3 alone, as an app does, and links a dynamic iOS framework against what
# was just published, which resolves every native symbol the libraries need.
- name: Link an app against the published artifacts
run: ./gradlew -p tools/consumer compileKotlinJvm linkDebugFrameworkIosSimulatorArm64 -PpickerVersion="$(sed -n 's/^VERSION_NAME=//p' gradle.properties)"