Skip to content

CircleToSearch with multi search engine support for all android

Kotlin

ci: add GitHub Actions CI/CD workflows

AKS Labs5ed64a5a702b
diff --git a/.github/dependabot.yml b/.github/dependabot.yml
new file mode 100644
index 0000000..94cd2d5
--- /dev/null
+++ b/.github/dependabot.yml
@@ -0,0 +1,20 @@
+version: 2
+
+updates:
+ - package-ecosystem: "gradle"
+ directory: "/"
+ schedule:
+ interval: "weekly"
+ day: "monday"
+ open-pull-requests-limit: 10
+ labels:
+ - "dependencies"
+
+ - package-ecosystem: "github-actions"
+ directory: "/"
+ schedule:
+ interval: "weekly"
+ day: "monday"
+ open-pull-requests-limit: 5
+ labels:
+ - "ci"
diff --git a/.github/workflows/build-apk.yml b/.github/workflows/build-apk.yml
new file mode 100644
index 0000000..da15af3
--- /dev/null
+++ b/.github/workflows/build-apk.yml
@@ -0,0 +1,69 @@
+name: Build APK
+
+on:
+ push:
+ branches: ["*"]
+ tags-ignore:
+ - 'v*'
+
+permissions:
+ contents: read
+
+jobs:
+ build:
+ name: Build Release APK
+ runs-on: ubuntu-latest
+
+ steps:
+ - name: Checkout code
+ uses: actions/checkout@v4
+
+ - name: Set up JDK 21
+ uses: actions/setup-java@v4
+ with:
+ java-version: '21'
+ distribution: 'temurin'
+
+ - name: Setup Gradle
+ uses: gradle/actions/setup-gradle@v4
+
+ - name: Make gradlew executable
+ run: chmod +x gradlew
+
+ - name: Clean build
+ run: ./gradlew clean
+
+ - name: Build Debug APK
+ run: ./gradlew assembleDebug
+
+ - name: Run unit tests
+ run: ./gradlew testDebugUnitTest
+
+ - name: Run Android lint
+ run: ./gradlew lintDebug
+
+ - name: Build Release APK (unsigned)
+ run: ./gradlew assembleRelease
+
+ - name: Find release APKs
+ id: find-apk
+ run: |
+ APK_DIR="app/build/outputs/apk/release"
+ if [ -d "$APK_DIR" ]; then
+ APK_COUNT=$(find "$APK_DIR" -name "*.apk" | wc -l)
+ echo "apk_dir=$APK_DIR" >> $GITHUB_OUTPUT
+ echo "apk_count=$APK_COUNT" >> $GITHUB_OUTPUT
+ echo "Found $APK_COUNT release APK(s)"
+ else
+ echo "No release APK directory found"
+ echo "apk_count=0" >> $GITHUB_OUTPUT
+ fi
+
+ - name: Upload release APKs
+ if: steps.find-apk.outputs.apk_count != '0'
+ uses: actions/upload-artifact@v4
+ with:
+ name: release-apk
+ path: app/build/outputs/apk/release/*.apk
+ if-no-files-found: error
+ retention-days: 14
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
new file mode 100644
index 0000000..152c003
--- /dev/null
+++ b/.github/workflows/ci.yml
@@ -0,0 +1,68 @@
+name: CI
+
+on:
+ pull_request:
+ branches: ["*"]
+
+permissions:
+ contents: read
+ security-events: write
+
+jobs:
+ build:
+ name: Build & Validate
+ runs-on: ubuntu-latest
+
+ steps:
+ - name: Checkout PR code
+ uses: actions/checkout@v4
+
+ - name: Set up JDK 21
+ uses: actions/setup-java@v4
+ with:
+ java-version: '21'
+ distribution: 'temurin'
+
+ - name: Setup Gradle
+ uses: gradle/actions/setup-gradle@v4
+
+ - name: Make gradlew executable
+ run: chmod +x gradlew
+
+ - name: Clean build
+ run: ./gradlew clean
+
+ - name: Build Debug APK
+ run: ./gradlew assembleDebug
+
+ - name: Run unit tests
+ run: ./gradlew testDebugUnitTest
+
+ - name: Run Android lint
+ run: ./gradlew lintDebug
+
+ - name: Upload lint report
+ if: always()
+ uses: actions/upload-artifact@v4
+ with:
+ name: lint-report
+ path: app/build/reports/lint-results-debug.html
+ if-no-files-found: ignore
+
+ dependency-review:
+ name: Dependency Review
+ runs-on: ubuntu-latest
+ if: github.event_name == 'pull_request'
+
+ permissions:
+ contents: read
+ pull-requests: write
+
+ steps:
+ - name: Checkout PR code
+ uses: actions/checkout@v4
+
+ - name: Dependency Review
+ uses: actions/dependency-review-action@v4
+ with:
+ fail-on-severity: moderate
diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml
new file mode 100644
index 0000000..f62c7da
--- /dev/null
+++ b/.github/workflows/release.yml
@@ -0,0 +1,96 @@
+name: Release
+
+on:
+ push:
+ tags:
+ - 'v*'
+
+permissions:
+ contents: write
+
+jobs:
+ release:
+ name: Build & Release
+ runs-on: ubuntu-latest
+
+ steps:
+ - name: Checkout tagged code
+ uses: actions/checkout@v4
+
+ - name: Set up JDK 21
+ uses: actions/setup-java@v4
+ with:
+ java-version: '21'
+ distribution: 'temurin'
+
+ - name: Setup Gradle
+ uses: gradle/actions/setup-gradle@v4
+
+ - name: Make gradlew executable
+ run: chmod +x gradlew
+
+ - name: Clean build
+ run: ./gradlew clean
+
+ - name: Build Debug APK
+ run: ./gradlew assembleDebug
+
+ - name: Run unit tests
+ run: ./gradlew testDebugUnitTest
+
+ - name: Run Android lint
+ run: ./gradlew lintDebug
+
+ - name: Decode signing keystore
+ env:
+ KEYSTORE_BASE64: ${{ secrets.KEYSTORE_BASE64 }}
+ run: |
+ echo "$KEYSTORE_BASE64" | base64 --decode > /tmp/release.keystore
+
+ - name: Build signed release APK
+ env:
+ KEYSTORE_FILE: /tmp/release.keystore
+ KEYSTORE_PASSWORD: ${{ secrets.KEYSTORE_PASSWORD }}
+ KEY_ALIAS: ${{ secrets.KEY_ALIAS }}
+ KEY_PASSWORD: ${{ secrets.KEY_PASSWORD }}
+ run: ./gradlew assembleRelease
+
+ - name: Verify APK signature
+ run: |
+ APK_DIR="app/build/outputs/apk/release"
+ for apk in "$APK_DIR"/*.apk; do
+ echo "Verifying signature: $apk"
+ apksigner verify --print-certs "$apk"
+ done
+
+ - name: Generate SHA-256 checksums
+ working-directory: app/build/outputs/apk/release
+ run: |
+ sha256sum *.apk > SHA256SUMS.txt
+ echo "Checksums generated:"
+ cat SHA256SUMS.txt
+
+ - name: Extract version from tag
+ id: version
+ run: |
+ TAG_NAME="${GITHUB_REF#refs/tags/}"
+ VERSION="${TAG_NAME#v}"
+ echo "tag_name=$TAG_NAME" >> $GITHUB_OUTPUT
+ echo "version=$VERSION" >> $GITHUB_OUTPUT
+
+ - name: Create GitHub Release
+ uses: softprops/action-gh-release@v2
+ with:
+ tag_name: ${{ steps.version.outputs.tag_name }}
+ name: Release ${{ steps.version.outputs.tag_name }}
+ draft: false
+ prerelease: false
+ files: |
+ app/build/outputs/apk/release/*.apk
+ app/build/outputs/apk/release/SHA256SUMS.txt
+ env:
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+
+ - name: Clean up keystore
+ if: always()
+ run: rm -f /tmp/release.keystore
diff --git a/app/build.gradle.kts b/app/build.gradle.kts
index 83fc14d..48c888d 100644
--- a/app/build.gradle.kts
+++ b/app/build.gradle.kts
@@ -29,6 +29,17 @@ android {
version = release(36)
}
+ signingConfigs {
+ create("release") {
+ val ksFile = System.getenv("KEYSTORE_FILE")
+ if (ksFile != null) {
+ storeFile = file(ksFile)
+ storePassword = System.getenv("KEYSTORE_PASSWORD")
+ keyAlias = System.getenv("KEY_ALIAS")
+ keyPassword = System.getenv("KEY_PASSWORD")
+ }
+ }
+ }
defaultConfig {
applicationId = "com.akslabs.circletosearch"
@@ -52,6 +63,9 @@ android {
getDefaultProguardFile("proguard-android-optimize.txt"),
"proguard-rules.pro"
)
+ if (System.getenv("KEYSTORE_FILE") != null) {
+ signingConfig = signingConfigs.getByName("release")
+ }
}
getByName("debug") {