diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000000..1801680484 --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,231 @@ + +name: Build Navit Binarys + +on: [push, pull_request] + +jobs: + sanity_check: + runs-on: ubuntu-latest + container: + image: navit/sanity_check:latest + steps: + - uses: actions/checkout@v2 + with: + fetch-depth: 0 + ##- name: run sanity check script + ## run: bash scripts/ci_sanity_checks.sh + ##- uses: reviewdog/action-suggester@v1 + ## with: + ## github_token: ${{ secrets.github_token }} + ## tool_name: Navit sanity Check + ## level: error + ## fail_on_error: false + # FIXME: deactivated as somethings broken with it + #- name: Run CheckStyle Test + # run: ./gradlew checkstyleMain + #- uses: actions/upload-artifact@v4 + # with: + # name: Store checkstyle report + # path: navit/android/checkstyle + + build_linux: + runs-on: ubuntu-latest + needs: sanity_check + container: + image: debian:latest + steps: + - uses: actions/checkout@v2 + - run: | + apt-get update && apt-get install -y git + - name: Setup requirements + run: | + bash scripts/setup_common_requirements.sh + apt-get install -y libpng-dev libfreetype6-dev libdbus-glib-1-dev libgtk2.0-dev curl + - name: Build for Linux + run: bash scripts/build_linux.sh + - uses: actions/upload-artifact@v4 + with: + name: Linux Artifacts + path: linux/_CPack_Packages + - name: Update Navit-Download-Center + run: | + bash scripts/update_download_center.sh + run_doxygen: + runs-on: ubuntu-latest + needs: [build_android, build_wince, build_tomtom_minimal, build_linux, build_tomtom_plugin, build_win32] + container: + image: debian:latest + steps: + - uses: actions/checkout@v2 + - name: Install doxygen and other essentials + run: apt-get update && apt-get -y install doxygen ca-certificates git rsync + - name: Run doxygen + run: cd navit && doxygen + - name: Update results to Github + run: bash scripts/update_doxygen.sh + - uses: actions/upload-artifact@v4 + with: + path: /root/project/doc + build_sailfish: + runs-on: ubuntu-latest + needs: sanity_check + container: + image: coderus/sailfishos-platform-sdk:4.4.0.64 + steps: + - uses: actions/checkout@v1 + # TODO currently broken because of USER in Dockerimage and probably because of double containers as well + - name: run build + run: sudo -E bash contrib/sailfish/build_sailfish_ci.sh + env: + VERSION_ID: 4.4.0.64 + - uses: actions/upload-artifact@v4 + with: + name: Store rpm + path: rpmbuild/RPMS/ + build_android: + runs-on: ubuntu-latest + needs: sanity_check + steps: + - uses: actions/checkout@v2 + with: + fetch-depth: 0 + - run: if [ "X$UID" == X0 ]; then apt update && apt install -y sudo; fi + - name: Install requirements + run: bash scripts/setup_android.sh + - name: Setup Keystore and Playstore Keys + run: scripts/setup_publish_keys.sh + - name: Setup Android SDK + uses: android-actions/setup-android@v2 + - name: Install NDK + run: sdkmanager "ndk;23.0.7599858" + - name: Build and upload Android + run: fastlane github_actions + - name: Run Lint Test + run: | + ln -sf navit/navit.dtd navit.dtd + mkdir test-results + ./gradlew lint test + - name: Run Javadoc + run: ./gradlew generateDebugJavadoc + - uses: actions/upload-artifact@v4 + with: + name: Store APK + path: build/outputs/apk + - uses: actions/upload-artifact@v4 + with: + name: Store logs + path: build/outputs/logs + - uses: actions/upload-artifact@v4 + with: + name: Store Javadoc + path: build/outputs/docs/javadoc + - uses: actions/upload-artifact@v4 + with: + name: Store Lint reports + path: build/reports + - uses: actions/upload-artifact@v4 + with: + name: Android Test-results + path: test-results + - name: Update Navit-Download-Center + run: | + bash scripts/update_download_center.sh + build_win32: + runs-on: ubuntu-latest + needs: sanity_check + container: + image: ubuntu:24.04 + steps: + - uses: actions/checkout@v2 + - run: | + apt-get update && apt-get install -y git + - name: Prepare the Windows build environment + run: bash scripts/setup_win32.sh + - name: Build for Windows + run: | + bash scripts/build_win32.sh + - uses: actions/upload-artifact@v4 + with: + name: Win32 + path: win32/navit.exe + - name: Update Navit-Download-Center + run: | + bash scripts/update_download_center.sh + build_wince: + runs-on: ubuntu-latest + needs: sanity_check + container: + image: ghcr.io/enlyze/windows-ce-build-environment-arm + steps: + - uses: actions/checkout@v1 + + #- run: apt-get update && apt-get install -y git-core + + - name: Prepare the WinCE build environment + run: bash scripts/setup_wince.sh + + - name: Build for Windows CE + run: bash scripts/build_wince.sh + + - uses: actions/upload-artifact@v4 + with: + path: wince/output + name: WinCE Binary + + - name: Update Navit-Download-Center + run: bash scripts/update_download_center.sh + + build_tomtom_minimal: + runs-on: ubuntu-latest + needs: sanity_check + container: + image: ghcr.io/navit-gps/tomtom:master + steps: + - uses: actions/checkout@v2 + - name: Prepare the tomtom build environment + run: | + bash scripts/setup_common_requirements.sh + apt-get install -y xsltproc + - name: Build for Tomtom (minimal) + run: bash scripts/build_tomtom_minimal.sh + - uses: actions/upload-artifact@v4 + with: + name: Tomtom Minimal + path: /output + - name: Update Navit-Download-Center + run: | + bash scripts/update_download_center.sh + build_tomtom_plugin: + runs-on: ubuntu-latest + needs: sanity_check + container: + image: ghcr.io/navit-gps/tomtom:master + steps: + - uses: actions/checkout@v2 + - name: Prepare the tomtom build environment + run: | + bash scripts/setup_common_requirements.sh + apt-get install -y xsltproc + - name: Build for Tomtom (plugin) + run: | + bash scripts/build_tomtom_plugin.sh + - uses: actions/upload-artifact@v4 + with: + name: Tomtom Plugin + path: /output + - name: Update Navit-Download-Center + run: | + bash scripts/update_download_center.sh + merge_trunk_in_master: + runs-on: ubuntu-latest + needs: [build_android, build_wince, build_tomtom_minimal, build_linux, build_tomtom_plugin, build_win32] + if: github.ref == 'trunk' + steps: + - uses: actions/checkout@master + - name: Merge to master branch + uses: devmasx/merge-branch@v1.1.0 + with: + type: now + target_branch: 'master' + env: + GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}} diff --git a/build.gradle b/build.gradle index d284d54a06..08459f6ff2 100644 --- a/build.gradle +++ b/build.gradle @@ -12,7 +12,7 @@ buildscript { } } dependencies { - classpath 'com.android.tools.build:gradle:3.5.0' + classpath 'com.android.tools.build:gradle:7.1.3' // NOTE: Do not place your application dependencies here; they belong // in the individual module build.gradle files @@ -38,6 +38,7 @@ task clean(type: Delete) { android { compileSdkVersion 29 buildToolsVersion "29.0.2" + ndkVersion "23.0.7599858" signingConfigs { release { // We can leave these in environment variables diff --git a/contrib/sailfish/build_sailfish_ci.sh b/contrib/sailfish/build_sailfish_ci.sh index 9b5849f9ff..eccf89abdb 100755 --- a/contrib/sailfish/build_sailfish_ci.sh +++ b/contrib/sailfish/build_sailfish_ci.sh @@ -10,7 +10,7 @@ if [ -z ${VERSION_ID+x} ]; then echo "VERSION_ID not set. Forgot to export VERSI # Makes calling it directly from docker easier. SCRIPTPATH="$( cd "$(dirname "$0")" ; pwd -P )" cd $SCRIPTPATH -ls -lah /navit + mkdir $HOME/rpmbuild #arm devices diff --git a/fastlane/Fastfile b/fastlane/Fastfile index fd4044762e..08dac331d8 100644 --- a/fastlane/Fastfile +++ b/fastlane/Fastfile @@ -25,17 +25,24 @@ end platform :android do desc "Description of what the lane does" + lane :github_actions do + # Here we can add other things that Github Actions should do + build + end lane :circleci do - # Here we can add other things that circleci should do + # Here we can add other things that CircleCI should do + build playstore end - lane :playstore do + lane :build do sh("cd ..;bash scripts/build_android.sh") gradle( task: 'assemble', build_type: 'Release' ) + end + lane :playstore do isOnMasterBranch = currentBranch() == "master" isOnMasterBranch = false # Workarount do not push to google as its curently broken if isOnMasterBranch diff --git a/gradle/scripts/git-scm-version.gradle b/gradle/scripts/git-scm-version.gradle index c6a7cfa094..a8ad84d0fb 100644 --- a/gradle/scripts/git-scm-version.gradle +++ b/gradle/scripts/git-scm-version.gradle @@ -2,7 +2,7 @@ buildscript { repositories { - jcenter() + mavenCentral() } dependencies { classpath 'org.ajoberstar:grgit:2.3.0' diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 7292aa85e7..bcc1aa9039 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -2,5 +2,5 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-5.6-all.zip -distributionSha256Sum=33214524e686838c88a88e14e8b30e2323589cc9698186bc8e0594758b132b31 +distributionUrl=https\://services.gradle.org/distributions/gradle-7.2-all.zip +distributionSha256Sum=a8da5b02437a60819cad23e10fc7e9cf32bcb57029d9cb277e26eeff76ce014b diff --git a/navit/android/src/org/navitproject/navit/NavitTraff.java b/navit/android/src/org/navitproject/navit/NavitTraff.java index fd499b70b5..75d19841c3 100644 --- a/navit/android/src/org/navitproject/navit/NavitTraff.java +++ b/navit/android/src/org/navitproject/navit/NavitTraff.java @@ -357,7 +357,7 @@ private void fetchMessages(Context context, Uri uri) { } StringBuilder builder = new StringBuilder("\n"); while (cursor.moveToNext()) - builder.append(cursor.getString(cursor.getColumnIndex(COLUMN_DATA))).append("\n"); + builder.append(cursor.getString(cursor.getColumnIndexOrThrow(COLUMN_DATA))).append("\n"); builder.append(""); cursor.close(); onFeedReceived(mCbid, builder.toString()); diff --git a/scripts/ci_sanity_checks.sh b/scripts/ci_sanity_checks.sh index de46d5f150..7e08feedb7 100755 --- a/scripts/ci_sanity_checks.sh +++ b/scripts/ci_sanity_checks.sh @@ -19,7 +19,6 @@ check_diff(){ if [[ $code -ne 0 ]]; then echo "[ERROR] You may need to do some cleanup in the files you commited, see the git diff output above." fi - git checkout -- . return_code=$(($return_code + $code)) } @@ -57,5 +56,4 @@ for f in $(git diff --name-only refs/remotes/origin/trunk | sort -u); do fi fi done - -exit $return_code +git diff \ No newline at end of file diff --git a/scripts/setup_android.sh b/scripts/setup_android.sh index 357cdc9904..98d1747a54 100755 --- a/scripts/setup_android.sh +++ b/scripts/setup_android.sh @@ -2,6 +2,7 @@ set -e sudo apt-get update -sudo apt-get install -y cmake gettext libsaxonb-java librsvg2-bin pkg-config rename -gem install --no-document fastlane git +sudo apt-get install -y cmake gettext libsaxonb-java librsvg2-bin pkg-config rename ruby ruby-dev build-essential rake-compiler git default-jdk-headless +sudo gem install rake +sudo gem install --no-document fastlane git