Skip to content

Commit fab6e82

Browse files
authored
Merge pull request #4 from AckeeCZ/chore/update-project
Update project
2 parents 0751999 + 24e9a22 commit fab6e82

File tree

90 files changed

+3452
-510
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

90 files changed

+3452
-510
lines changed
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
# This action's steps must be synced with preMergeRequestCheck Gradle task's checks to ensure that
2+
# we check required stuff on CI and at the same time developers can run the Gradle task to verify their
3+
# changes before making a PR. This action can be used in more workflows than just PR, since these
4+
# basic pre merge request checks (Detekt, library tests, ...) are fundamental to be checked in
5+
# basically all situations like merging, pushing to dev, etc.
6+
name: Basic preflight check
7+
description: Action that contains basic checks like running Detekt or library tests that are common to multiple workflows
8+
9+
runs:
10+
using: "composite"
11+
steps:
12+
- name: Detekt
13+
shell: bash
14+
run: ./gradlew detekt
15+
16+
- name: Assemble release variant
17+
shell: bash
18+
run: ./gradlew assembleRelease
19+
20+
- name: Library tests
21+
shell: bash
22+
run: ./gradlew testDebugUnitTest -x :sample:testDebugUnitTest
23+
24+
- name: Sample app snapshot tests
25+
shell: bash
26+
run: ./gradlew :sample:verifyPaparazziDebug
27+
28+
- name: Binary compatibility check
29+
shell: bash
30+
run: ./gradlew apiCheck
31+
32+
- name: Build logic tests
33+
shell: bash
34+
run: ./gradlew build-logic:test

.github/actions/setup/action.yml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
name: Setup
2+
description: Action that performs common setup tasks like setting up Java
3+
4+
runs:
5+
using: "composite"
6+
steps:
7+
- name: Set up JDK 17
8+
uses: actions/setup-java@v4
9+
with:
10+
java-version: '17'
11+
distribution: 'corretto'

.github/workflows/deploy.yml

Lines changed: 51 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,59 @@
1-
name: Deploy lib to Maven Central
1+
name: Deploy
22

33
on:
44
push:
55
tags:
6-
- '*'
6+
# Gradle build logic relies on this tag format, so if you need to change it, you need to change
7+
# it there as well.
8+
- bom-*
9+
10+
env:
11+
GPG_KEY: ${{ secrets.ANDROID_GPG_KEY }}
12+
GPG_PASSWORD: ${{ secrets.ANDROID_SIGNING_PASSWORD }}
13+
MAVEN_USERNAME: ${{ secrets.ANDROID_MAVEN_CENTRAL_USERNAME }}
14+
MAVEN_PASSWORD: ${{ secrets.ANDROID_MAVEN_CENTRAL_PASSWORD }}
715

816
jobs:
9-
build:
17+
# This job's steps must be synced with prePublishCheck Gradle task's checks to ensure that
18+
# we check required stuff on CI and at the same time developers can run the Gradle task to verify
19+
# their changes before publishing.
20+
preflight_checks:
1021
runs-on: ubuntu-latest
22+
steps:
23+
# actions/checkout can't be included in the composite setup action, because the composite
24+
# action needs to be first checked out by the checkout action.
25+
- name: Check out code
26+
uses: actions/checkout@v5
27+
with:
28+
# Fetch all history including all tags, because we need previous release tag for verifyPublishing task
29+
fetch-depth: 0
30+
31+
- name: Setup
32+
uses: ./.github/actions/setup
33+
34+
- name: Basic preflight checks
35+
uses: ./.github/actions/basic-preflight-check
36+
37+
- name: Verify publishing
38+
run: ./gradlew verifyPublishing
1139

40+
- name: Verify BOM version
41+
run: ./gradlew verifyBomVersion
42+
43+
publish:
44+
needs: preflight_checks
45+
runs-on: ubuntu-latest
46+
permissions:
47+
# Needed by softprops/action-gh-release to be able to create a release
48+
contents: write
1249
steps:
13-
- name: Checkout code
14-
uses: actions/checkout@v2
50+
# actions/checkout can't be included in the composite setup action, because the composite
51+
# action needs to be first checked out by the checkout action.
52+
- name: Check out code
53+
uses: actions/checkout@v5
1554

16-
- name: Set up JDK 17
17-
uses: actions/setup-java@v1
18-
with:
19-
java-version: '17'
55+
- name: Setup
56+
uses: ./.github/actions/setup
2057

2158
- name: Publish to Maven Central
2259
run: |
@@ -25,8 +62,8 @@ jobs:
2562
-PsigningInMemoryKeyPassword=$GPG_PASSWORD \
2663
-PmavenCentralUsername=$MAVEN_USERNAME \
2764
-PmavenCentralPassword=$MAVEN_PASSWORD
28-
env:
29-
GPG_KEY: ${{ secrets.ANDROID_GPG_KEY }}
30-
GPG_PASSWORD: ${{ secrets.ANDROID_SIGNING_PASSWORD }}
31-
MAVEN_USERNAME: ${{ secrets.ANDROID_MAVEN_CENTRAL_USERNAME }}
32-
MAVEN_PASSWORD: ${{ secrets.ANDROID_MAVEN_CENTRAL_PASSWORD }}
65+
66+
- name: Create GitHub release
67+
uses: softprops/action-gh-release@v2
68+
with:
69+
generate_release_notes: true

.github/workflows/main_branch.yml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
name: Main branch
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
8+
jobs:
9+
main:
10+
runs-on: ubuntu-latest
11+
steps:
12+
# actions/checkout can't be included in the composite setup action, because the composite
13+
# action needs to be first checked out by the checkout action.
14+
- name: Check out code
15+
uses: actions/checkout@v5
16+
17+
- name: Setup
18+
uses: ./.github/actions/setup
19+
20+
- name: Preflight checks
21+
uses: ./.github/actions/basic-preflight-check

.github/workflows/pull_request.yml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
name: Pull request
2+
3+
on:
4+
pull_request:
5+
types:
6+
- opened
7+
- synchronize
8+
9+
jobs:
10+
pull_request:
11+
runs-on: ubuntu-latest
12+
steps:
13+
# actions/checkout can't be included in the composite setup action, because the composite
14+
# action needs to be first checked out by the checkout action.
15+
- name: Check out code
16+
uses: actions/checkout@v5
17+
18+
- name: Setup
19+
uses: ./.github/actions/setup
20+
21+
- name: Preflight checks
22+
uses: ./.github/actions/basic-preflight-check

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,3 +31,6 @@ google-services.json
3131

3232
# Android Profiling
3333
*.hprof
34+
35+
# Kotlin
36+
.kotlin

CHANGELOG.md

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
# Changelog
2+
3+
All notable changes to this project will be documented in this file.
4+
5+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and this project adheres
6+
to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7+
8+
## [Unreleased]
9+
### annotations
10+
### framework
11+
### paparazzi
12+
13+
14+
15+
## BOM [2.0.0-paparazzialpha02] - 2025-09-16
16+
Major breaking release that brings following changes:
17+
- Versioning of the library was completely changed. There are no longer Compose and Paparazzi
18+
suffixes in the artifact versions and clients are not forced to specify dependencies explicitly
19+
(unless it is required by the basic setup itself as described in README).
20+
- Library now releases BOM version that should be used instead of particular artifact versions.
21+
- This release depends on the unstable alpha version of the Paparazzi library, because newest stable
22+
version is no longer compatible with the newest Gradle versions. This is related only to `paparazzi`
23+
artifact and BOM, which explicitly reflects this `paparazzi` versioning in its version as well.
24+
Unstable Paparazzi library is reflected in the version name by `-paparazzialphaxx` suffix, which
25+
matches the current alpha suffix version of the Paparazzi. Once Paparazzi releases stable version
26+
and Ackee Snapshots update to it, the suffix will be removed. The base semantic version `x.x.x` of
27+
the library version reflects just the version of Ackee Snapshots itself, independently on Paparazzi
28+
or any other dependency.
29+
- Update dependencies, including Kotlin to 2.2.20 and Kotest to 6.0.3.
30+
31+
### paparazzi
32+
- Paparazzi version increased to `2.0.0-alpha02`. Make sure you use at least this version for
33+
Paparazzi Gradle plugin.

CONTRIBUTING.MD

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# CONTRIBUTING
2+
If you have something useful that could be added to the library or you found some bug,
3+
feel free to open a PR.
4+
5+
## PR
6+
Before submitting a PR, please make sure that:
7+
- You added tests that cover your changes if possible.
8+
- You ran `./gradlew preMergeRequestCheck` preflight checks and all passed.

README.md

Lines changed: 38 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
# Ackee Android Snapshots
44

55
[![License](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](LICENSE)
6-
[![Maven Central](https://img.shields.io/maven-central/v/io.github.ackeecz/snapshots-annotations)](https://central.sonatype.com/artifact/io.github.ackeecz/snapshots-annotations)
6+
[![Maven Central](https://img.shields.io/maven-central/v/io.github.ackeecz/snapshots-bom)](https://central.sonatype.com/artifact/io.github.ackeecz/snapshots-bom)
77

88
## Overview
99

@@ -14,9 +14,9 @@ components. It leverages Paparazzi for rendering snapshots, Showkase for compone
1414

1515
The framework is designed with extensibility in mind, using a modular architecture:
1616

17+
- `annotations` module contains shared code for preview annotations
1718
- `framework` module defines the base interfaces (`SnapshotEngine`, `SnapshotStrategy`) and common testing infrastructure
1819
- `paparazzi` module provides a concrete implementation of the snapshot engine using Paparazzi
19-
- `annotations` module contains shared code for preview annotations
2020
- Additional snapshot engine implementations can be added by implementing the `SnapshotEngine` interface
2121

2222
## Features
@@ -34,86 +34,70 @@ The framework is designed with extensibility in mind, using a modular architectu
3434

3535
## Installation
3636

37-
Add the following dependencies to your `libs.versions.toml`:
37+
Add the following configuration, depending on what you need. You should always use BOM to be sure to
38+
get binary compatible dependencies. If you have a custom snapshots engine, you will need only
39+
`annotations` and `framework` dependencies. Additionally, you can add `paparazzi` as well for our
40+
Paparazzi engine implementation.
41+
42+
### Annotations & Framework
43+
For `annotations` and `framework` artifacts you will need the following configuration:
3844

3945
```toml
4046
[versions]
41-
ackee-snapshots-annotations = "SPECIFY_VERSION"
42-
ackee-snapshots-framework = "SPECIFY_VERSION"
43-
ackee-snapshots-paparazzi = "SPECIFY_VERSION"
44-
compose-bom = "SPECIFY_VERSION"
47+
ackee-snapshots-bom = "SPECIFY_VERSION"
4548
showkase = "SPECIFY_VERSION"
46-
paparazzi = "SPECIFY_VERSION"
4749

4850
[dependencies]
49-
ackee-snapshots-framework = { group = "io.github.ackeecz", name = "snapshots-framework", version.ref = "ackee-snapshots-framework" }
50-
ackee-snapshots-paparazzi = { group = "io.github.ackeecz", name = "snapshots-paparazzi", version.ref = "ackee-snapshots-paparazzi" }
51-
ackee-snapshots-annotations = { group = "io.github.ackeecz", name = "snapshots-annotations", version.ref = "ackee-snapshots-annotations" }
51+
ackee-snapshots-bom = { group = "io.github.ackeecz", name = "snapshots-bom", version.ref = "ackee-snapshots-bom" }
52+
ackee-snapshots-annotations = { group = "io.github.ackeecz", name = "snapshots-annotations" }
53+
ackee-snapshots-framework = { group = "io.github.ackeecz", name = "snapshots-framework" }
5254

53-
# Required dependencies - versions need to be specified by the consumer
54-
androidx-compose-bom = { group = "androidx.compose", name = "compose-bom", version = "compose-bom" }
55+
# Showcase is needed for annotating previews and passing a selected PreviewSnapshotStrategy
5556
showkase-core = { module = "com.airbnb.android:showkase", version.ref = "showkase" }
5657
showkase-processor = { module = "com.airbnb.android:showkase-processor", version.ref = "showkase" }
57-
58-
[plugins]
59-
paparazzi = { id = "app.cash.paparazzi", version.ref = "paparazzi" }
60-
```
61-
62-
Apply the Paparazzi Gradle plugin in your app's `build.gradle.kts`:
63-
64-
```kotlin
65-
plugins {
66-
id("app.cash.paparazzi")
67-
}
6858
```
6959

7060
and specify dependencies
7161

7262
```kotlin
63+
implementation(platform(libs.ackee.snapshots.bom))
7364
implementation(libs.ackee.snapshots.annotations)
65+
testImplementation(libs.ackee.snapshots.framework)
66+
7467
implementation(libs.showkase.core)
7568
ksp(libs.showkase.processor)
76-
77-
testImplementation(libs.ackee.snapshots.framework)
78-
testImplementation(libs.ackee.snapshots.paparazzi)
7969
```
8070

81-
## Versioning
71+
### Paparazzi
72+
If you use `paparazzi` artifact, you will need the following additional configuration:
8273

83-
The library uses a versioning scheme that reflects compatibility with its core dependencies:
74+
```toml
75+
[versions]
76+
# Ensure that this version is equal or greater than Paparazzi version in this project. Otherwise
77+
# there might be incompatibility between Paparazzi runtime used in Ackee Snapshots and Paparazzi
78+
# Gradle plugin used by your app.
79+
paparazzi = "SPECIFY_VERSION"
8480

85-
### Framework Module
81+
[dependencies]
82+
ackee-snapshots-paparazzi = { group = "io.github.ackeecz", name = "snapshots-paparazzi" }
8683

87-
The framework module version includes the Compose BOM version as a suffix:
88-
```
89-
{base_version}-{compose_bom_version}
84+
[plugins]
85+
paparazzi = { id = "app.cash.paparazzi", version.ref = "paparazzi" }
9086
```
9187

92-
Example: `0.1.0-2024.02.00`
88+
Apply the Paparazzi Gradle plugin in your module's `build.gradle.kts`:
9389

94-
### Paparazzi Module
95-
The Paparazzi module version includes the Paparazzi version as a suffix:
96-
```
97-
{base_version}-{paparazzi_version}
90+
```kotlin
91+
plugins {
92+
id(libs.plugins.paparazzi)
93+
}
9894
```
9995

100-
Example: `0.1.0-1.3.1`
101-
102-
### Annotations Module
96+
and specify dependencies
10397

104-
The annotations module uses only the base version without any suffix:
105-
```
106-
{base_version}
98+
```kotlin
99+
testImplementation(libs.ackee.snapshots.paparazzi)
107100
```
108-
Example: `0.1.0`
109-
110-
This versioning strategy helps users:
111-
- Track compatibility with specific Compose and Paparazzi versions
112-
- Choose the right artifact version for their setup
113-
- Avoid version conflicts with their project's dependencies
114-
115-
Note: The library intentionally does not set Compose or Paparazzi versions to prevent version conflicts. You need to specify these versions in your
116-
project to ensure compatibility with your setup.
117101

118102
## Configuration
119103

@@ -320,6 +304,7 @@ This setup will:
320304

321305
## Project Structure
322306

307+
- **bom**: BOM module
323308
- **annotations**: Shared code for preview annotations. Used in test and production source sets.
324309
- **framework**: Core framework and testing infrastructure
325310
- **paparazzi**: Paparazzi integration for snapshot generation
@@ -352,7 +337,6 @@ To verify that your UI components haven't changed unexpectedly, run:
352337
If there are any differences between the recorded and current snapshots, the test will fail and Paparazzi will generate a report showing the
353338
differences.
354339

355-
356340
## Contributing
357341

358342
Contributions are welcome! Please feel free to submit a Pull Request.

0 commit comments

Comments
 (0)