diff --git a/.forgejo/workflows/android-check-metadata.yaml b/.forgejo/workflows/android-check-metadata.yaml index a0da1c5de..c0439b316 100644 --- a/.forgejo/workflows/android-check-metadata.yaml +++ b/.forgejo/workflows/android-check-metadata.yaml @@ -1,4 +1,4 @@ -name: Android Check Metadata +name: Android Check Store Metadata on: workflow_dispatch: # Manual trigger pull_request: @@ -21,5 +21,8 @@ jobs: android tools/python/check_store_metadata.py - - name: Check metadata - run: ./tools/python/check_store_metadata.py android + - name: Check Google Play metadata + run: ./tools/python/check_store_metadata.py gplay + + - name: Check F-Droid metadata + run: ./tools/python/check_store_metadata.py fdroid \ No newline at end of file diff --git a/.forgejo/workflows/android-release-metadata.yaml b/.forgejo/workflows/android-release-metadata.yaml index eb47f95b8..824199177 100644 --- a/.forgejo/workflows/android-release-metadata.yaml +++ b/.forgejo/workflows/android-release-metadata.yaml @@ -8,21 +8,19 @@ jobs: runs-on: ubuntu-latest environment: production steps: - - name: Checkout sources - # TODO: use shallow (and sparse?) checkout + - name: Checkout uses: actions/checkout@v4 - -# - name: Parallel submodules checkout -# shell: bash -# run: git submodule update --depth 1 --init --recursive --jobs=$(($(nproc) * 20)) + with: + fetch-depth: 1 + sparse-checkout: | + android + tools/python/check_store_metadata.py - name: Restore release keys shell: bash run: | - echo "$PRIVATE_H" | base64 -d > private.h echo "$GOOGLE_PLAY_JSON" | base64 -d > android/app/google-play.json env: - PRIVATE_H: ${{ secrets.PRIVATE_H }} GOOGLE_PLAY_JSON: ${{ secrets.GOOGLE_PLAY_JSON }} - name: Upload diff --git a/tools/python/check_store_metadata.py b/tools/python/check_store_metadata.py index c5942f6e4..8c3b2bf67 100755 --- a/tools/python/check_store_metadata.py +++ b/tools/python/check_store_metadata.py @@ -130,7 +130,7 @@ def check_raw(path, max_length, ignoreEmptyFilesAndNewLines=False): ok = error(path, "missing new line") else: text = text.strip() - + cur_length = len(text) if cur_length > max_length: ok = error(path, "too long: got={}, expected={}", cur_length, max_length) @@ -164,28 +164,28 @@ def check_exact(path, expected): return done(path, ok) -def check_android(): +def check_android(is_gplay): ok = True - flavor = 'android/app/src/fdroid/play/' + flavor = "google" if is_gplay else "fdroid" + flavor = f'android/app/src/{flavor}/play/' ok = check_url(flavor + 'contact-website.txt') and ok ok = check_email(flavor + 'contact-email.txt') and ok ok = check_exact(flavor + 'default-language.txt', 'en-US') and ok for locale in glob.glob(flavor + 'listings/*/'): - if locale.split('/')[-2] not in GPLAY_LOCALES: + if is_gplay and locale.split('/')[-2] not in GPLAY_LOCALES: ok = error(locale, 'unsupported locale') and ok continue - ok = check_text(locale + 'title.txt', 50) and ok - ok = check_text(locale + 'title-google.txt', 30) and ok + ok = check_text(locale + 'title.txt', 30 if is_gplay else 50) and ok ok = check_text(locale + 'short-description.txt', 80) and ok - ok = check_text(locale + 'short-description-google.txt', 80, True) and ok ok = check_text(locale + 'full-description.txt', 4000) and ok - ok = check_text(locale + 'full-description-google.txt', 4000, True) and ok - ok = check_text(locale + 'release-notes.txt', 499) and ok + ok = check_text(locale + 'release-notes.txt', 499, optional=True) and ok + ''' TODO: relnotes not necessary exist for all languages, but symlinks are made for all for locale in glob.glob(flavor + 'release-notes/*/'): if locale.split('/')[-2] not in GPLAY_LOCALES: ok = error(locale, 'unsupported locale') and ok continue ok = check_text(locale + 'default.txt', 499) and ok + ''' return ok @@ -195,13 +195,13 @@ def check_ios(): if locale.split('/')[-2] not in APPSTORE_LOCALES: ok = error(locale, "unsupported locale") and ok continue - + locale_complete = True for name in ["description.txt", "keywords.txt", "marketing_url.txt", "privacy_url.txt", "subtitle.txt", "support_url.txt"]: name_path = os.path.join(locale, name) if not os.path.exists(name_path): locale_complete = False - + if locale_complete: ok = check_text(locale + "subtitle.txt", 30, False, True) and ok ok = check_text(locale + "description.txt", 4000, False, True) and ok @@ -210,13 +210,17 @@ def check_ios(): ok = check_url(locale + "support_url.txt", True) and ok ok = check_url(locale + "marketing_url.txt", True) and ok ok = check_url(locale + "privacy_url.txt", True) and ok - + return ok if __name__ == "__main__": ok = True - if len(sys.argv) == 2 and sys.argv[1] == 'android': - if check_android(): + if len(sys.argv) == 2 and sys.argv[1] == 'gplay': + if check_android(is_gplay=True): + sys.exit(0) + sys.exit(2) + if len(sys.argv) == 2 and sys.argv[1] == 'fdroid': + if check_android(is_gplay=False): sys.exit(0) sys.exit(2) elif len(sys.argv) == 2 and sys.argv[1] == "ios": @@ -224,5 +228,5 @@ if __name__ == "__main__": sys.exit(0) sys.exit(2) else: - print("Usage:", sys.argv[0], "android|ios", file=sys.stderr) + print("Usage:", sys.argv[0], "gplay|fdroid|ios", file=sys.stderr) sys.exit(1)