diff --git a/.eslintignore b/.eslintignore index 472150eeb..848b6b004 100644 --- a/.eslintignore +++ b/.eslintignore @@ -1 +1,3 @@ -src/test.ts \ No newline at end of file +src/test.ts +android/* +src/assets/generated/* diff --git a/.eslintrc.cjs b/.eslintrc.cjs index ff3f3e8f9..18adaa757 100644 --- a/.eslintrc.cjs +++ b/.eslintrc.cjs @@ -24,4 +24,7 @@ module.exports = { browser: true, node: true, }, + rules:{ + '@typescript-eslint/no-explicit-any': 'off' + } } diff --git a/.forgejo/workflows/daily_data_maintenance.yml b/.forgejo/workflows/daily_data_maintenance.yml index b494d876e..6ad98ffb4 100644 --- a/.forgejo/workflows/daily_data_maintenance.yml +++ b/.forgejo/workflows/daily_data_maintenance.yml @@ -22,7 +22,7 @@ jobs: ssh hetzner "cd data && rm -rf community-index/ && unzip community-index.zip && rm community-index.zip" update_statistics: - runs-on: [ ubuntu-latest, hetzner-access ] + runs-on: [ hetzner-access ] steps: - uses: https://source.mapcomplete.org/actions/checkout@v4 - uses: ./.forgejo/setup diff --git a/.forgejo/workflows/on_release.yml b/.forgejo/workflows/on_release.yml index 83e4c6631..79265a241 100644 --- a/.forgejo/workflows/on_release.yml +++ b/.forgejo/workflows/on_release.yml @@ -1,4 +1,5 @@ on: + workflow_dispatch: push: tags: - 'v*' @@ -9,7 +10,8 @@ jobs: steps: - uses: https://source.mapcomplete.org/actions/checkout@v4 - - uses: https://source.mapcomplete.org/actions/setup-android@v3.2.2 + with: + persist-credentials: true - name: Set up Node.js uses: https://source.mapcomplete.org/actions/setup-node@v4 @@ -18,51 +20,58 @@ jobs: cache: "npm" cache-dependency-path: package-lock.json - - name: install deps - run: npm ci - shell: bash - - - run: npm run init - - name: clone submodule shell: bash run: | - echo -e "[submodule \"android\"]\n\tpath = android\n\turl = https://source.mapcomplete.org/MapComplete/android-wrapper.git" > .gitmodules + echo -e "[submodule \"android\"]\n\tpath = android\n\turl = https://source.mapcomplete.org/MapComplete/android-wrapper" > .gitmodules cat .gitmodules - git submodule init - git submodule update + git submodule init + git submodule update --init --recursive + cd android + git config --global --add safe.directory $(pwd) + git remote -v + git pull origin main - - name: generate layers - run: npm run generate:layeroverview + - name: install deps + run: npm ci - - name: test + + - run: npm run init + + - name: Move dependency (@capacitor) into android repo + run: | + cd android + cp -r ../node_modules/@capacitor ./ + sed "s/..\/node_modules\///g" -i capacitor.settings.gradle + + - name: set android version number + run: | + cd android/app + pwd + ls + version_code=$(grep versionCode "build.gradle" | grep -o '[0-9]\+') + new_version_code=$((version_code + 1)) + versionname="${{ github.ref_name }}" + versionname="${versionname:1}" + sed -i "s/versionCode $version_code/versionCode $new_version_code/" "build.gradle" + sed -i "s/versionName \".*\"/versionName \"$new_versionname\"/" "build.gradle" + git add build.gradle + + - name: Run tests run: npm run test - name: prepare android build run: npm run android:prepare - - name: Decode keystore - run: echo "${{ secrets.KEYSTORE_BASE64 }}" | base64 -d > ~/.gradle/release-key.jks - - - name: Grant execute permission to gradlew - run: cd android && chmod +x ./gradlew - - - name: Build signed APK + - name: Update android repo run: | cd android - export ANDROID_SDK_HOME=/home/runner/.android/sdk/ - export PATH=$ANDROID_SDK_HOME/tools:$ANDROID_SDK_HOME/platform-tools:$ANDROID_SDK_HOME/:$ANDROID_SDK_HOME/cmdline-tools/latest/tools/bin:$PATH - export storeFile=my-release-key.jks - export storePassword=${{ secrets.KEYSTORE_PASSWORD }} - export keyAlias=${{ secrets.KEY_ALIAS }} - export keyPassword=${{ secrets.KEY_PASSWORD }} - ./gradlew build - ./gradlew assembleRelease - - - name: Upload APK to hetzner - shell: bash - run: | - TAG=$( echo ${{ env.GITHUB_REF_NAME }} ) - scp android/app/build/outputs/apk/release/app-release.apk hetzner:~/public/apk/mapcomplete-$TAG.apk - ssh hetzner 'rm -f public/apk/mapcomplete-latest.apk && cp "public/apk/$(ls -v public/apk/ | tail -n 1)" public/apk/mapcomplete-latest.apk' - + git remote set-url origin "https://Bot:${{ secrets.BOT_PASSWORD }}@source.mapcomplete.org/MapComplete/android-wrapper" + git config user.name "Bot" + git config user.email "info@mapcomplete.org" + git add -f app/src/main/assets/public/* + git add capacitor.settings.gradle + git commit -am "Add files for release ${{ github.ref_name }}" + git tag "${{ github.ref_name }}" + git push origin refs/heads/main --verbose + git push origin --tags diff --git a/.forgejo/workflows/update_database.yml b/.forgejo/workflows/update_database.yml index 360c0d7f3..c2af15d39 100644 --- a/.forgejo/workflows/update_database.yml +++ b/.forgejo/workflows/update_database.yml @@ -5,7 +5,10 @@ on: jobs: - daily_data_maintenance: + update_database: + concurrency: + group: update-database + cancel-in-progress: false runs-on: [ osm-cache ] steps: - uses: https://source.mapcomplete.org/actions/checkout@v4 @@ -20,7 +23,7 @@ jobs: run: npm run build:dbscript # output: build_db.lua - - name: Print planet file date + - name: Create and fill database shell: bash run: | # LAIN has a weekly updated planet file in /data/planet-latest.osm.pbf @@ -31,7 +34,7 @@ jobs: # Create a new database in postgres npm run create:database -- -- $DATE echo "Seeding database '$DATE'" - osm2pgsql -O flex -S build_db.lua -s --flat-nodes=import-help-file -d postgresql://user:password@localhost:5444/osm-poi.${DATE} /data/planet-latest.osm.pbf + osm2pgsql --cache 100000 -O flex -S build_db.lua -d postgresql://user:password@localhost:5444/osm-poi.${DATE} /data/planet-latest.osm.pbf npm run delete:database:old diff --git a/.prettierignore b/.prettierignore index ae756d365..a78f7a20b 100644 --- a/.prettierignore +++ b/.prettierignore @@ -13,3 +13,4 @@ Docs/Schemas/ Docs/TagInfo/ src/assets/generated src/assets/svg +android/ diff --git a/404.html b/404.html index a7924c529..2c6a6a403 100644 --- a/404.html +++ b/404.html @@ -4,7 +4,7 @@ + content="default-src 'self'; script-src 'self' ; img-src *; connect-src 'self' https://www.openstreetmap.org/ https://api.openstreetmap.org/;"> @@ -41,9 +41,6 @@
-