Repository navigation
Merge pull request #4 from SyntaxDevTeam/codex/microsoft-premium-acco… #39
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Android CI | |
| on: | |
| push: | |
| branches: [main] | |
| pull_request: | |
| branches: [main] | |
| workflow_dispatch: | |
| permissions: | |
| contents: read | |
| concurrency: | |
| group: craftconnect-${{ github.workflow }}-${{ github.ref }} | |
| cancel-in-progress: true | |
| jobs: | |
| validate: | |
| if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository | |
| runs-on: [self-hosted, linux, x64, syntaxdev-ci] | |
| timeout-minutes: 30 | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v7 | |
| - name: Set up JDK 21 | |
| uses: actions/setup-java@v5 | |
| with: | |
| distribution: temurin | |
| java-version: "21" | |
| - name: Prepare Android SDK | |
| shell: bash | |
| run: | | |
| set -euo pipefail | |
| export ANDROID_HOME="${ANDROID_HOME:-${ANDROID_SDK_ROOT:-$HOME/Android/Sdk}}" | |
| export ANDROID_SDK_ROOT="$ANDROID_HOME" | |
| export PATH="$ANDROID_HOME/cmdline-tools/latest/bin:$ANDROID_HOME/platform-tools:$PATH" | |
| if [ ! -x "$ANDROID_HOME/cmdline-tools/latest/bin/sdkmanager" ]; then | |
| CMDLINE_TOOLS_URL="https://redirector.gvt1.com/edgedl/android/repository/commandlinetools-linux-11076708_latest.zip" | |
| TMP_DIR="$(mktemp -d)" | |
| curl -fsSL "$CMDLINE_TOOLS_URL" -o "$TMP_DIR/cmdline-tools.zip" | |
| unzip -q "$TMP_DIR/cmdline-tools.zip" -d "$TMP_DIR/unzipped" | |
| mkdir -p "$ANDROID_HOME/cmdline-tools" | |
| rm -rf "$ANDROID_HOME/cmdline-tools/latest" | |
| mv "$TMP_DIR/unzipped/cmdline-tools" "$ANDROID_HOME/cmdline-tools/latest" | |
| rm -rf "$TMP_DIR" | |
| fi | |
| set +o pipefail | |
| yes | sdkmanager --licenses >/dev/null | |
| set -o pipefail | |
| sdkmanager --install "platform-tools" "platforms;android-36" "build-tools;36.0.0" | |
| echo "sdk.dir=$ANDROID_HOME" > local.properties | |
| echo "ANDROID_HOME=$ANDROID_HOME" >> "$GITHUB_ENV" | |
| echo "$ANDROID_HOME/cmdline-tools/latest/bin" >> "$GITHUB_PATH" | |
| echo "$ANDROID_HOME/platform-tools" >> "$GITHUB_PATH" | |
| - name: Set up Gradle | |
| uses: gradle/actions/setup-gradle@v6 | |
| - name: Validate Gradle wrapper | |
| uses: gradle/actions/wrapper-validation@v6 | |
| - name: Build, lint and unit tests | |
| shell: bash | |
| run: | | |
| set -euo pipefail | |
| chmod +x ./gradlew | |
| ./gradlew --no-daemon :app:assembleDebug :app:lintDebug :app:testDebugUnitTest :server-bridge:jar :server-bridge:test :bridge-protocol:test --console=plain | |
| - name: Upload debug APK | |
| if: success() | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: CraftConnect-debug | |
| path: app/build/outputs/apk/debug/*.apk | |
| if-no-files-found: error | |
| retention-days: 7 | |
| - name: Upload server bridge | |
| if: success() | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: CraftConnectBridge | |
| path: server-bridge/build/libs/CraftConnectBridge-*.jar | |
| if-no-files-found: error | |
| retention-days: 7 |