mirror of
https://codeberg.org/comaps/comaps
synced 2025-12-20 05:13:58 +00:00
[android] Separate GPlay and F-Droid metadata checks
Signed-off-by: Konstantin Pastbin <konstantin.pastbin@gmail.com>
This commit is contained in:
@@ -1,4 +1,4 @@
|
|||||||
name: Android Check Metadata
|
name: Android Check Store Metadata
|
||||||
on:
|
on:
|
||||||
workflow_dispatch: # Manual trigger
|
workflow_dispatch: # Manual trigger
|
||||||
pull_request:
|
pull_request:
|
||||||
@@ -21,5 +21,8 @@ jobs:
|
|||||||
android
|
android
|
||||||
tools/python/check_store_metadata.py
|
tools/python/check_store_metadata.py
|
||||||
|
|
||||||
- name: Check metadata
|
- name: Check Google Play metadata
|
||||||
run: ./tools/python/check_store_metadata.py android
|
run: ./tools/python/check_store_metadata.py gplay
|
||||||
|
|
||||||
|
- name: Check F-Droid metadata
|
||||||
|
run: ./tools/python/check_store_metadata.py fdroid
|
||||||
@@ -8,21 +8,19 @@ jobs:
|
|||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
environment: production
|
environment: production
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout sources
|
- name: Checkout
|
||||||
# TODO: use shallow (and sparse?) checkout
|
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
|
with:
|
||||||
# - name: Parallel submodules checkout
|
fetch-depth: 1
|
||||||
# shell: bash
|
sparse-checkout: |
|
||||||
# run: git submodule update --depth 1 --init --recursive --jobs=$(($(nproc) * 20))
|
android
|
||||||
|
tools/python/check_store_metadata.py
|
||||||
|
|
||||||
- name: Restore release keys
|
- name: Restore release keys
|
||||||
shell: bash
|
shell: bash
|
||||||
run: |
|
run: |
|
||||||
echo "$PRIVATE_H" | base64 -d > private.h
|
|
||||||
echo "$GOOGLE_PLAY_JSON" | base64 -d > android/app/google-play.json
|
echo "$GOOGLE_PLAY_JSON" | base64 -d > android/app/google-play.json
|
||||||
env:
|
env:
|
||||||
PRIVATE_H: ${{ secrets.PRIVATE_H }}
|
|
||||||
GOOGLE_PLAY_JSON: ${{ secrets.GOOGLE_PLAY_JSON }}
|
GOOGLE_PLAY_JSON: ${{ secrets.GOOGLE_PLAY_JSON }}
|
||||||
|
|
||||||
- name: Upload
|
- name: Upload
|
||||||
|
|||||||
@@ -130,7 +130,7 @@ def check_raw(path, max_length, ignoreEmptyFilesAndNewLines=False):
|
|||||||
ok = error(path, "missing new line")
|
ok = error(path, "missing new line")
|
||||||
else:
|
else:
|
||||||
text = text.strip()
|
text = text.strip()
|
||||||
|
|
||||||
cur_length = len(text)
|
cur_length = len(text)
|
||||||
if cur_length > max_length:
|
if cur_length > max_length:
|
||||||
ok = error(path, "too long: got={}, expected={}", 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)
|
return done(path, ok)
|
||||||
|
|
||||||
|
|
||||||
def check_android():
|
def check_android(is_gplay):
|
||||||
ok = True
|
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_url(flavor + 'contact-website.txt') and ok
|
||||||
ok = check_email(flavor + 'contact-email.txt') and ok
|
ok = check_email(flavor + 'contact-email.txt') and ok
|
||||||
ok = check_exact(flavor + 'default-language.txt', 'en-US') and ok
|
ok = check_exact(flavor + 'default-language.txt', 'en-US') and ok
|
||||||
for locale in glob.glob(flavor + 'listings/*/'):
|
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
|
ok = error(locale, 'unsupported locale') and ok
|
||||||
continue
|
continue
|
||||||
ok = check_text(locale + 'title.txt', 50) and ok
|
ok = check_text(locale + 'title.txt', 30 if is_gplay else 50) and ok
|
||||||
ok = check_text(locale + 'title-google.txt', 30) and ok
|
|
||||||
ok = check_text(locale + 'short-description.txt', 80) 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.txt', 4000) and ok
|
||||||
ok = check_text(locale + 'full-description-google.txt', 4000, True) and ok
|
ok = check_text(locale + 'release-notes.txt', 499, optional=True) and ok
|
||||||
ok = check_text(locale + 'release-notes.txt', 499) and ok
|
''' TODO: relnotes not necessary exist for all languages, but symlinks are made for all
|
||||||
for locale in glob.glob(flavor + 'release-notes/*/'):
|
for locale in glob.glob(flavor + 'release-notes/*/'):
|
||||||
if locale.split('/')[-2] not in GPLAY_LOCALES:
|
if locale.split('/')[-2] not in GPLAY_LOCALES:
|
||||||
ok = error(locale, 'unsupported locale') and ok
|
ok = error(locale, 'unsupported locale') and ok
|
||||||
continue
|
continue
|
||||||
ok = check_text(locale + 'default.txt', 499) and ok
|
ok = check_text(locale + 'default.txt', 499) and ok
|
||||||
|
'''
|
||||||
return ok
|
return ok
|
||||||
|
|
||||||
|
|
||||||
@@ -195,13 +195,13 @@ def check_ios():
|
|||||||
if locale.split('/')[-2] not in APPSTORE_LOCALES:
|
if locale.split('/')[-2] not in APPSTORE_LOCALES:
|
||||||
ok = error(locale, "unsupported locale") and ok
|
ok = error(locale, "unsupported locale") and ok
|
||||||
continue
|
continue
|
||||||
|
|
||||||
locale_complete = True
|
locale_complete = True
|
||||||
for name in ["description.txt", "keywords.txt", "marketing_url.txt", "privacy_url.txt", "subtitle.txt", "support_url.txt"]:
|
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)
|
name_path = os.path.join(locale, name)
|
||||||
if not os.path.exists(name_path):
|
if not os.path.exists(name_path):
|
||||||
locale_complete = False
|
locale_complete = False
|
||||||
|
|
||||||
if locale_complete:
|
if locale_complete:
|
||||||
ok = check_text(locale + "subtitle.txt", 30, False, True) and ok
|
ok = check_text(locale + "subtitle.txt", 30, False, True) and ok
|
||||||
ok = check_text(locale + "description.txt", 4000, 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 + "support_url.txt", True) and ok
|
||||||
ok = check_url(locale + "marketing_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
|
ok = check_url(locale + "privacy_url.txt", True) and ok
|
||||||
|
|
||||||
return ok
|
return ok
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
ok = True
|
ok = True
|
||||||
if len(sys.argv) == 2 and sys.argv[1] == 'android':
|
if len(sys.argv) == 2 and sys.argv[1] == 'gplay':
|
||||||
if check_android():
|
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(0)
|
||||||
sys.exit(2)
|
sys.exit(2)
|
||||||
elif len(sys.argv) == 2 and sys.argv[1] == "ios":
|
elif len(sys.argv) == 2 and sys.argv[1] == "ios":
|
||||||
@@ -224,5 +228,5 @@ if __name__ == "__main__":
|
|||||||
sys.exit(0)
|
sys.exit(0)
|
||||||
sys.exit(2)
|
sys.exit(2)
|
||||||
else:
|
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)
|
sys.exit(1)
|
||||||
|
|||||||
Reference in New Issue
Block a user