mirror of
https://github.com/pachli/pachli-android.git
synced 2025-02-02 18:37:00 +01:00
cc9efbfa7a
Abstract common CI setup tasks (setting up Java, Gradle, etc) in to a single action that can be used by all CI workflows. Run the lint, test, and assemble CI tasks in parallel for each variant rather than in series, which cuts ~ 7 minutes (approx. 50%) off the CI runtime. Update code in checks and core/navigation to fix new tests.
122 lines
3.3 KiB
YAML
122 lines
3.3 KiB
YAML
name: CI
|
|
|
|
on:
|
|
push:
|
|
tags:
|
|
- '*'
|
|
pull_request:
|
|
workflow_dispatch:
|
|
|
|
permissions: read-all
|
|
|
|
jobs:
|
|
# ktlintCheck does not have per-variant tasks, so runs once over everything
|
|
ktlint:
|
|
name: ktlintCheck
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4
|
|
|
|
- uses: ./.github/actions/setup-build-env
|
|
with:
|
|
gradle-cache-encryption-key: ${{ secrets.GRADLE_ENCRYPTION_KEY }}
|
|
|
|
- name: ktlintCheck
|
|
run: ./gradlew ktlintCheck
|
|
|
|
# Tools are not per-variant
|
|
tools:
|
|
name: Test tools
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4
|
|
|
|
- uses: ./.github/actions/setup-build-env
|
|
with:
|
|
gradle-cache-encryption-key: ${{ secrets.GRADLE_ENCRYPTION_KEY }}
|
|
|
|
- name: Test tools
|
|
working-directory: tools
|
|
run: ../gradlew test
|
|
|
|
# Custom lint rules are not per-variant
|
|
custom-lint:
|
|
name: Custom lint
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4
|
|
|
|
- uses: ./.github/actions/setup-build-env
|
|
with:
|
|
gradle-cache-encryption-key: ${{ secrets.GRADLE_ENCRYPTION_KEY }}
|
|
|
|
- name: Test custom lint rules
|
|
working-directory: checks
|
|
run: ../gradlew test
|
|
|
|
# Android lint is per-variant
|
|
lint:
|
|
strategy:
|
|
matrix:
|
|
color: ["orange"]
|
|
store: ["fdroid", "github", "google"]
|
|
type: ["debug"]
|
|
name: Android Lint
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4
|
|
|
|
- uses: ./.github/actions/setup-build-env
|
|
with:
|
|
gradle-cache-encryption-key: ${{ secrets.GRADLE_ENCRYPTION_KEY }}
|
|
|
|
- name: Regular lint ${{ matrix.color }}${{ matrix.store }}${{ matrix.type }}
|
|
run: ./gradlew lint${{ matrix.color }}${{ matrix.store }}${{ matrix.type }}
|
|
|
|
# Android tests are per variant
|
|
test:
|
|
strategy:
|
|
matrix:
|
|
color: ["orange"]
|
|
store: ["fdroid", "github", "google"]
|
|
type: ["debug"]
|
|
name: Android Test
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4
|
|
|
|
- uses: ./.github/actions/setup-build-env
|
|
with:
|
|
gradle-cache-encryption-key: ${{ secrets.GRADLE_ENCRYPTION_KEY }}
|
|
|
|
- name: test ${{ matrix.color }}${{ matrix.store }}${{ matrix.type }}
|
|
run: ./gradlew test${{ matrix.color }}${{ matrix.store }}${{ matrix.type }}
|
|
|
|
# Android assemble is per variant
|
|
assemble:
|
|
strategy:
|
|
matrix:
|
|
color: ["orange"]
|
|
store: ["fdroid", "github", "google"]
|
|
type: ["debug"]
|
|
name: Android Assemble
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4
|
|
|
|
- uses: ./.github/actions/setup-build-env
|
|
with:
|
|
gradle-cache-encryption-key: ${{ secrets.GRADLE_ENCRYPTION_KEY }}
|
|
|
|
- name: assemble ${{ matrix.color }}${{ matrix.store }}${{ matrix.type }}
|
|
run: ./gradlew assemble${{ matrix.color }}${{ matrix.store }}${{ matrix.type }}
|