ci: smart path filtering to skip heavy Android builds on doc-only PRs (#1025)
Co-authored-by: M57 <hy4ri@users.noreply.github.com>
This commit is contained in:
@@ -21,11 +21,43 @@ concurrency:
|
|||||||
cancel-in-progress: true
|
cancel-in-progress: true
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
|
# ─────────────────────────────────────────────────────────────────────
|
||||||
|
# Job 0: Detect changes — skips heavy Android build/tests for doc-only PRs
|
||||||
|
# ─────────────────────────────────────────────────────────────────────
|
||||||
|
changes:
|
||||||
|
name: Detect Changes
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
timeout-minutes: 3
|
||||||
|
outputs:
|
||||||
|
code: ${{ steps.filter.outputs.code }}
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v7
|
||||||
|
- name: Paths Filter
|
||||||
|
uses: dorny/paths-filter@v3
|
||||||
|
id: filter
|
||||||
|
with:
|
||||||
|
filters: |
|
||||||
|
code:
|
||||||
|
- 'app/**'
|
||||||
|
- 'gradle/**'
|
||||||
|
- 'build.gradle.kts'
|
||||||
|
- 'settings.gradle.kts'
|
||||||
|
- 'gradle.properties'
|
||||||
|
- 'gradlew'
|
||||||
|
- 'gradlew.bat'
|
||||||
|
- '.github/workflows/android.yml'
|
||||||
|
- '.editorconfig'
|
||||||
|
- 'flake.nix'
|
||||||
|
- 'flake.lock'
|
||||||
|
|
||||||
# ─────────────────────────────────────────────────────────────────────
|
# ─────────────────────────────────────────────────────────────────────
|
||||||
# Job 1: ktlint (code style) — fastest feedback, runs in parallel.
|
# Job 1: ktlint (code style) — fastest feedback, runs in parallel.
|
||||||
# ─────────────────────────────────────────────────────────────────────
|
# ─────────────────────────────────────────────────────────────────────
|
||||||
ktlint:
|
ktlint:
|
||||||
name: ktlint — Code Style
|
name: ktlint — Code Style
|
||||||
|
needs: [changes]
|
||||||
|
if: github.event_name != 'pull_request' || needs.changes.outputs.code == 'true'
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
timeout-minutes: 5
|
timeout-minutes: 5
|
||||||
steps:
|
steps:
|
||||||
@@ -88,6 +120,8 @@ jobs:
|
|||||||
# ─────────────────────────────────────────────────────────────────────
|
# ─────────────────────────────────────────────────────────────────────
|
||||||
android-lint:
|
android-lint:
|
||||||
name: Android Lint — Static Analysis
|
name: Android Lint — Static Analysis
|
||||||
|
needs: [changes]
|
||||||
|
if: github.event_name != 'pull_request' || needs.changes.outputs.code == 'true'
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
timeout-minutes: 10
|
timeout-minutes: 10
|
||||||
steps:
|
steps:
|
||||||
@@ -125,6 +159,8 @@ jobs:
|
|||||||
# ─────────────────────────────────────────────────────────────────────
|
# ─────────────────────────────────────────────────────────────────────
|
||||||
unit-tests:
|
unit-tests:
|
||||||
name: Unit & Integration Tests
|
name: Unit & Integration Tests
|
||||||
|
needs: [changes]
|
||||||
|
if: github.event_name != 'pull_request' || needs.changes.outputs.code == 'true'
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
timeout-minutes: 10
|
timeout-minutes: 10
|
||||||
steps:
|
steps:
|
||||||
@@ -162,7 +198,8 @@ jobs:
|
|||||||
# ─────────────────────────────────────────────────────────────────────
|
# ─────────────────────────────────────────────────────────────────────
|
||||||
build:
|
build:
|
||||||
name: Build Debug APK
|
name: Build Debug APK
|
||||||
needs: [ktlint, android-lint, unit-tests]
|
needs: [changes, ktlint, android-lint, unit-tests]
|
||||||
|
if: github.event_name != 'pull_request' || needs.changes.outputs.code == 'true'
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
timeout-minutes: 10
|
timeout-minutes: 10
|
||||||
steps:
|
steps:
|
||||||
@@ -204,7 +241,8 @@ jobs:
|
|||||||
# ─────────────────────────────────────────────────────────────────────
|
# ─────────────────────────────────────────────────────────────────────
|
||||||
release-compile:
|
release-compile:
|
||||||
name: Release Compile Check
|
name: Release Compile Check
|
||||||
needs: [ktlint, android-lint, unit-tests]
|
needs: [changes, ktlint, android-lint, unit-tests]
|
||||||
|
if: github.event_name != 'pull_request' || needs.changes.outputs.code == 'true'
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
timeout-minutes: 10
|
timeout-minutes: 10
|
||||||
steps:
|
steps:
|
||||||
@@ -236,6 +274,8 @@ jobs:
|
|||||||
# ─────────────────────────────────────────────────────────────────────
|
# ─────────────────────────────────────────────────────────────────────
|
||||||
instrumented-tests:
|
instrumented-tests:
|
||||||
name: Instrumented Tests
|
name: Instrumented Tests
|
||||||
|
needs: [changes]
|
||||||
|
if: github.event_name != 'pull_request' || needs.changes.outputs.code == 'true'
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
timeout-minutes: 20
|
timeout-minutes: 20
|
||||||
steps:
|
steps:
|
||||||
@@ -299,7 +339,7 @@ jobs:
|
|||||||
# ─────────────────────────────────────────────────────────────────────
|
# ─────────────────────────────────────────────────────────────────────
|
||||||
ci-summary:
|
ci-summary:
|
||||||
name: CI Summary
|
name: CI Summary
|
||||||
needs: [ktlint, android-lint, unit-tests, build, release-compile]
|
needs: [changes, ktlint, android-lint, unit-tests, build, release-compile]
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
timeout-minutes: 2
|
timeout-minutes: 2
|
||||||
if: always()
|
if: always()
|
||||||
@@ -323,7 +363,7 @@ jobs:
|
|||||||
name="${entry%%:*}"
|
name="${entry%%:*}"
|
||||||
result="${entry#*:}"
|
result="${entry#*:}"
|
||||||
echo "::notice::$name = $result"
|
echo "::notice::$name = $result"
|
||||||
if [[ "$result" != "success" ]]; then
|
if [[ "$result" != "success" && "$result" != "skipped" ]]; then
|
||||||
FAILED=1
|
FAILED=1
|
||||||
FAILED_JOBS+="$name "
|
FAILED_JOBS+="$name "
|
||||||
fi
|
fi
|
||||||
|
|||||||
@@ -3,8 +3,34 @@ name: "CodeQL Analysis"
|
|||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
branches: [ "main", "dev" ]
|
branches: [ "main", "dev" ]
|
||||||
|
paths-ignore:
|
||||||
|
- '**.md'
|
||||||
|
- 'docs/**'
|
||||||
|
- '.github/PULL_REQUEST_TEMPLATE.md'
|
||||||
|
- '.github/workflows/pr-labeler.yml'
|
||||||
|
- '.github/workflows/stale.yml'
|
||||||
|
- '.github/workflows/merge-conflict-detector.yml'
|
||||||
|
- 'LICENSE'
|
||||||
|
- 'fastlane/**'
|
||||||
|
- '.gitignore'
|
||||||
|
- '.editorconfig'
|
||||||
|
- '.envrc'
|
||||||
|
- '*.html'
|
||||||
pull_request:
|
pull_request:
|
||||||
branches: [ "main", "dev" ]
|
branches: [ "main", "dev" ]
|
||||||
|
paths-ignore:
|
||||||
|
- '**.md'
|
||||||
|
- 'docs/**'
|
||||||
|
- '.github/PULL_REQUEST_TEMPLATE.md'
|
||||||
|
- '.github/workflows/pr-labeler.yml'
|
||||||
|
- '.github/workflows/stale.yml'
|
||||||
|
- '.github/workflows/merge-conflict-detector.yml'
|
||||||
|
- 'LICENSE'
|
||||||
|
- 'fastlane/**'
|
||||||
|
- '.gitignore'
|
||||||
|
- '.editorconfig'
|
||||||
|
- '.envrc'
|
||||||
|
- '*.html'
|
||||||
schedule:
|
schedule:
|
||||||
- cron: '30 3 * * 1' # Runs at 03:30 UTC every Monday
|
- cron: '30 3 * * 1' # Runs at 03:30 UTC every Monday
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user