diff --git a/.github/workflows/android-check.yaml b/.github/workflows/android-check.yaml new file mode 100644 index 000000000..af1ec2ebb --- /dev/null +++ b/.github/workflows/android-check.yaml @@ -0,0 +1,94 @@ +name: Android Check +on: + schedule: + - cron: '0 1 * * *' # Once per day at 01:00 UTC + workflow_dispatch: # Manual trigger + push: + branches: + - main + +env: + JAVA_HOME: /usr/lib/jvm/temurin-17-jdk-amd64 # Java 17 is required for Android Gradle 8 plugin + +jobs: + lint: + name: Android Lint + runs-on: ubuntu-latest + steps: + - name: Checkout sources + uses: actions/checkout@v4 + with: + fetch-depth: 1 + + - name: Parallel submodules checkout + shell: bash + run: git submodule update --depth 1 --init --recursive --jobs=$(($(nproc) * 20)) + + - name: Configure repository + shell: bash + run: ./configure.sh + + - name: Lint + shell: bash + working-directory: android + run: ./gradlew -Pandroidauto=true lint + + android-check: + name: Build Android Debug + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + flavor: [WebDebug, FdroidDebug] + include: + - flavor: WebDebug + arch: arm64 + - flavor: FdroidDebug + arch: arm32 + # Cancels previous jobs if the same branch or PR was updated again. + concurrency: + group: ${{ github.workflow }}-${{ matrix.flavor }}-${{ github.event.pull_request.number || github.ref }} + cancel-in-progress: true + + steps: + - name: Install build tools and dependencies + shell: bash + run: | + sudo apt-get update -y + sudo apt-get install -y ninja-build + + - name: Checkout sources + uses: actions/checkout@v4 + with: + fetch-depth: 200 # enough to get all commits for the current day + + - name: Parallel submodules checkout + shell: bash + run: git submodule update --depth 1 --init --recursive --jobs=$(($(nproc) * 20)) + + - name: Configure repository + shell: bash + run: ./configure.sh + + - name: Configure ccache + uses: hendrikmuhs/ccache-action@v1.2 + with: + key: ${{ github.workflow }}-${{ matrix.flavor }} + + - name: Compile ${{ matrix.flavor }} + shell: bash + working-directory: android + env: + CMAKE_C_COMPILER_LAUNCHER: ccache + CMAKE_CXX_COMPILER_LAUNCHER: ccache + run: | + cmake --version + ninja --version + ./gradlew -P${{ matrix.arch }} assemble${{ matrix.flavor }} + + - name: Upload ${{ matrix.flavor }} apk + uses: actions/upload-artifact@v4 + with: + name: android-${{ matrix.flavor }} + path: android/app/build/outputs/apk/**/CoMaps-*.apk + if-no-files-found: error diff --git a/.github/workflows/ios-check.yaml b/.github/workflows/ios-check.yaml new file mode 100644 index 000000000..f879e03c8 --- /dev/null +++ b/.github/workflows/ios-check.yaml @@ -0,0 +1,76 @@ +name: iOS Check +on: + workflow_dispatch: # Manual trigger + +jobs: + ios-check: + name: Build iOS + runs-on: macos-15 + env: + DEVELOPER_DIR: /Applications/Xcode_16.app/Contents/Developer + LANG: en_US.UTF-8 # Fastlane complains that the terminal is using ASCII. + LANGUAGE: en_US.UTF-8 + LC_ALL: en_US.UTF-8 + TEST_RESULTS_BUNDLE_NAME: OMaps-Test-Results + strategy: + fail-fast: false + matrix: + buildType: [Debug, Release] + # Cancels previous jobs if the same branch or PR was updated again. + concurrency: + group: ${{ github.workflow }}-${{ matrix.buildType }}-${{ github.event.pull_request.number || github.ref }} + cancel-in-progress: true + + steps: + - name: Checkout sources + uses: actions/checkout@v4 + + - name: Parallel submodules checkout + shell: bash + run: git submodule update --depth 1 --init --recursive --jobs=$(($(sysctl -n hw.logicalcpu) * 20)) + + - name: Configure repository + shell: bash + run: ./configure.sh + + - name: Configure XCode cache + uses: irgaly/xcode-cache@v1 + with: + key: xcode-cache-deriveddata-${{ github.workflow }}-${{ matrix.buildType }}-${{ github.sha }} + restore-keys: xcode-cache-deriveddata-${{ github.workflow }}-${{ matrix.buildType }} + + - name: Build and Run Tests (Debug) + if: matrix.buildType == 'Debug' + shell: bash + run: | + xcodebuild test \ + -workspace xcode/omim.xcworkspace \ + -scheme OMaps \ + -configuration Debug \ + -sdk iphonesimulator \ + -destination 'platform=iOS Simulator,name=iPhone 16 Pro Max,OS=latest' \ + -quiet \ + -resultBundlePath ${{ env.TEST_RESULTS_BUNDLE_NAME }}.xcresult \ + CODE_SIGNING_REQUIRED=NO \ + CODE_SIGNING_ALLOWED=NO + + - name: Upload Test Results On Failure (Debug) + if: ${{ matrix.buildType == 'Debug' && failure() }} + uses: actions/upload-artifact@v4 + with: + name: ${{ env.TEST_RESULTS_BUNDLE_NAME }}-${{ github.run_number }}.xcresult + path: ${{ env.TEST_RESULTS_BUNDLE_NAME }}.xcresult + if-no-files-found: error + + - name: Build (Release) + if: matrix.buildType == 'Release' + shell: bash + run: | + xcodebuild build \ + -workspace xcode/omim.xcworkspace \ + -scheme OMaps \ + -configuration Release \ + -destination 'generic/platform=iOS' \ + -quiet \ + CODE_SIGNING_REQUIRED=NO \ + CODE_SIGNING_ALLOWED=NO