Skip to content

Commit

Permalink
Merge pull request #17 from AckeeCZ/chore/ci-and-docs
Browse files Browse the repository at this point in the history
Add CI and documentation
  • Loading branch information
mottljan authored Dec 3, 2024
2 parents 30afc93 + eb63b1f commit a33b63a
Show file tree
Hide file tree
Showing 22 changed files with 556 additions and 79 deletions.
31 changes: 31 additions & 0 deletions .github/actions/basic-preflight-check/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# This action's steps must be synced with preMergeRequestCheck Gradle task's checks to ensure that
# we check required stuff on CI and at the same time developers can run the Gradle task to verify their
# changes before making a PR. This action can be used in more workflows than just PR, since these
# basic pre merge request checks (Detekt, library tests, ...) are fundamental to be checked in
# basically all situations like merging, pushing to dev, etc.
name: Basic preflight check
description: Action that contains basic checks like running Detekt or library tests that are common to multiple workflows

runs:
using: "composite"
steps:
- name: Detekt
shell: bash
run: ./gradlew detekt

- name: Assemble release variant
shell: bash
# Exclude sample app module from build. It requires the library artifacts to be published.
run: ./gradlew assembleRelease -x :app:assembleRelease

- name: Library tests
shell: bash
run: ./gradlew testDebugUnitTest -x :app:testDebugUnitTest

- name: Binary compatibility check
shell: bash
run: ./gradlew apiCheck

- name: Build logic tests
shell: bash
run: ./gradlew build-logic:logic:test
11 changes: 11 additions & 0 deletions .github/actions/setup/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
name: Setup
description: Action that performs common setup tasks like setting up Java

runs:
using: "composite"
steps:
- name: Set up JDK 17
uses: actions/setup-java@v4
with:
java-version: '17'
distribution: 'corretto'
62 changes: 62 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
name: Deploy

on:
push:
tags:
# Gradle build logic relies on this tag format, so if you need to change it, you need to change
# it there as well.
- bom-*

env:
GPG_KEY: ${{ secrets.ANDROID_GPG_KEY }}
GPG_PASSWORD: ${{ secrets.ANDROID_SIGNING_PASSWORD }}
MAVEN_USERNAME: ${{ secrets.ANDROID_MAVEN_CENTRAL_USERNAME }}
MAVEN_PASSWORD: ${{ secrets.ANDROID_MAVEN_CENTRAL_PASSWORD }}

jobs:
# This job's steps must be synced with prePublishCheck Gradle task's checks to ensure that
# we check required stuff on CI and at the same time developers can run the Gradle task to verify
# their changes before publishing.
preflight_check:
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@v4

- uses: ./.github/actions/setup
- uses: ./.github/actions/basic-preflight-check

- name: Verify publishing
run: ./gradlew verifyPublishing

- name: Verify BOM version
run: ./gradlew verifyBomVersion

- name: Artifacts tests
# We need to publish the latest versions to Maven local first before we can run tests
# on published artifacts
run: |
./gradlew publishToMavenLocal \
-PsigningInMemoryKey=$GPG_KEY \
-PsigningInMemoryKeyPassword=$GPG_PASSWORD \
-PmavenCentralUsername=$MAVEN_USERNAME \
-PmavenCentralPassword=$MAVEN_PASSWORD
./gradlew :app:testDebugUnitTest
publish:
needs: preflight_check
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@v4

- uses: ./.github/actions/setup

- name: Publish to Maven Central
run: |
./gradlew --stacktrace publishAndReleaseToMavenCentral \
-PsigningInMemoryKey=$GPG_KEY \
-PsigningInMemoryKeyPassword=$GPG_PASSWORD \
-PmavenCentralUsername=$MAVEN_USERNAME \
-PmavenCentralPassword=$MAVEN_PASSWORD
16 changes: 16 additions & 0 deletions .github/workflows/main_branch.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
name: Main branch

on:
push:
branches:
- main

jobs:
main:
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@v4

- uses: ./.github/actions/setup
- uses: ./.github/actions/basic-preflight-check
17 changes: 17 additions & 0 deletions .github/workflows/pull_request.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
name: Pull request

on:
pull_request:
types:
- opened
- synchronize

jobs:
pull_request:
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@v4

- uses: ./.github/actions/setup
- uses: ./.github/actions/basic-preflight-check
8 changes: 1 addition & 7 deletions .idea/compiler.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 0 additions & 13 deletions .idea/runConfigurations.xml

This file was deleted.

30 changes: 30 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# Changelog

All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres
to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [Unreleased]
### core
### datastore
### datastore-preferences
### jetpack

## BOM [1.0.0] - TBD

### core
#### Added
- First version of the artifact 🎉

### datastore
#### Added
- First version of the artifact 🎉

### datastore-preferences
#### Added
- First version of the artifact 🎉

### jetpack
#### Added
- First version of the artifact 🎉
2 changes: 2 additions & 0 deletions NOTICE.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
This project includes code derived from the Jetpack Security Crypto library,
developed by Google LLC, and licensed under the Apache License 2.0.
Loading

0 comments on commit a33b63a

Please sign in to comment.