Skip to content

Commit d755442

Browse files
authored
Merge branch 'master' into master
2 parents 76a8fe0 + 2b5acf0 commit d755442

File tree

8 files changed

+214
-28
lines changed

8 files changed

+214
-28
lines changed

.github/workflows/android.yml

Lines changed: 17 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -2,62 +2,58 @@ name: Android CI
22

33
on:
44
workflow_dispatch:
5-
# schedule:
6-
# - cron: '0 22 * * *' # run at 0:00 GMT+2
5+
push:
6+
tags:
7+
- '*'
78

89
jobs:
9-
# hasChanged:
10-
# continue-on-error: true
11-
# name: Verify that changes have occured in the last 24h
12-
# if: ${{ github.event_name == 'schedule' }}
13-
# run: test -z $(git rev-list --after="24 hours" ${{ github.sha }}) && echo "::set-output name=hasChanged::false"
14-
1510
createArtifacts:
16-
# needs: hasChanged
17-
# if: ${{ needs.hasChanged.outputs.hasChanged != 'false' }}
1811
runs-on: ubuntu-latest
1912
steps:
20-
- uses: actions/checkout@v3
13+
- uses: actions/checkout@v4
14+
- name: Read Go version from project
15+
run: echo "GO_VERSION=$(grep -E "^de\.felixnuesse\.extract\.goVersion=" gradle.properties | cut -d'=' -f2)"
2116
- name: Set up JDK 17
2217
uses: actions/setup-java@v3
2318
with:
2419
java-version: '17'
2520
distribution: 'temurin'
2621
cache: gradle
27-
- name: Set up Go 1.19.8
22+
- name: Set up Go from gradle.properties
2823
uses: actions/setup-go@v4
2924
with:
30-
go-version: 1.19.8
25+
go-version: '${{env.GO_VERSION}}'
3126
id: go
32-
- name: Install NDK
27+
- name: Setup Android SDK/NDK
28+
uses: android-actions/setup-android@v3
29+
- name: Install NDK from gradle.properties
3330
run: |
3431
NDK_VERSION="$(grep -E "^de\.felixnuesse\.extract\.ndkVersion=" gradle.properties | cut -d'=' -f2)"
35-
yes | sudo "${ANDROID_HOME}/tools/bin/sdkmanager" --licenses
36-
sudo "${ANDROID_HOME}/tools/bin/sdkmanager" "ndk;${NDK_VERSION}"
32+
sdkmanager "ndk;${NDK_VERSION}"
3733
- name: Build app
3834
run: ./gradlew assembleOssRelease
3935
- name: Upload APK (arm)
40-
uses: actions/upload-artifact@v3
36+
uses: actions/upload-artifact@v4
4137
with:
4238
name: nightly-armeabi.apk
4339
path: app/build/outputs/apk/oss/debug/roundsync_v*?(-beta)-oss-armeabi-v7a-debug.apk
4440
- name: Upload APK (arm64)
45-
uses: actions/upload-artifact@v3
41+
uses: actions/upload-artifact@v4
4642
with:
4743
name: nightly-arm64.apk
4844
path: app/build/outputs/apk/oss/debug/roundsync_v*?(-beta)-oss-arm64-v8a-debug.apk
4945
- name: Upload APK (x86)
50-
uses: actions/upload-artifact@v3
46+
uses: actions/upload-artifact@v4
5147
with:
5248
name: nightly-x86.apk
5349
path: app/build/outputs/apk/oss/debug/roundsync_v*?(-beta)-oss-x86-debug.apk
5450
- name: Upload APK (arm)
55-
uses: actions/upload-artifact@v3
51+
uses: actions/upload-artifact@v4
5652
with:
5753
name: nightly-x64.apk
5854
path: app/build/outputs/apk/oss/debug/roundsync_v*?(-beta)-oss-x86_64-debug.apk
5955
- name: Upload APK (universal)
60-
uses: actions/upload-artifact@v3
56+
uses: actions/upload-artifact@v4
6157
with:
6258
name: nightly-universal.apk
6359
path: app/build/outputs/apk/oss/debug/roundsync_v*?(-beta)-oss-universal-debug.apk

.github/workflows/dependencies.yml

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
name: "Verify dependency chain"
2+
on:
3+
workflow_dispatch:
4+
push:
5+
6+
jobs:
7+
dependency-change-verification:
8+
runs-on: ubuntu-latest
9+
outputs:
10+
changed: ${{ steps.changeDetection.outputs.should-run }}
11+
steps:
12+
- uses: actions/checkout@v4
13+
- name: Get changed files
14+
id: changed-files
15+
uses: tj-actions/changed-files@v44
16+
- name: Verify build.gradle changed
17+
id: changeDetection
18+
env:
19+
ALL_CHANGED_FILES: ${{ steps.changed-files.outputs.all_changed_files }}
20+
run: |
21+
GRADLE='build.gradle'
22+
for file in ${ALL_CHANGED_FILES}; do
23+
if [[ "$file" == *"$GRADLE" ]]; then
24+
echo "$file was changed"
25+
echo "should-run=true" >> $GITHUB_OUTPUT
26+
fi
27+
done
28+
29+
verify-dependencies:
30+
runs-on: ubuntu-latest
31+
needs: dependency-change-verification
32+
if: needs.dependency-change-verification.outputs.changed == 'true'
33+
steps:
34+
- uses: actions/checkout@v4
35+
- name: Read Go version from project
36+
run: echo "GO_VERSION=$(grep -E "^de\.felixnuesse\.extract\.goVersion=" gradle.properties | cut -d'=' -f2)"
37+
- name: Set up JDK 17
38+
uses: actions/setup-java@v3
39+
with:
40+
java-version: '17'
41+
distribution: 'temurin'
42+
cache: gradle
43+
- name: Set up Go from gradle.properties
44+
uses: actions/setup-go@v4
45+
with:
46+
go-version: '${{env.GO_VERSION}}'
47+
id: go
48+
- name: Setup Android SDK/NDK
49+
uses: android-actions/setup-android@v3
50+
- name: Install NDK from gradle.properties
51+
run: |
52+
NDK_VERSION="$(grep -E "^de\.felixnuesse\.extract\.ndkVersion=" gradle.properties | cut -d'=' -f2)"
53+
sdkmanager "ndk;${NDK_VERSION}"
54+
- name: Build app
55+
run: ./gradlew assembleOssDebug
56+
57+
- name: 'Check for non-FOSS libraries'
58+
run: |
59+
# prepare scanapk with apktool.
60+
wget https://github.com/iBotPeaches/Apktool/releases/download/v$apktoolVersion/apktool_$apktoolVersion.jar
61+
# Wrapper for apktool_*.jar
62+
wget https://github.com/iBotPeaches/Apktool/raw/master/scripts/linux/apktool
63+
# clone izzy's repo with the scan tools
64+
git clone https://gitlab.com/IzzyOnDroid/repo.git
65+
# create a directory for Apktool and move the apktool* files there
66+
mkdir -p repo/lib/radar/tool
67+
mv apktool* repo/lib/radar/tool
68+
chmod u+x repo/lib/radar/tool/apktool
69+
mv repo/lib/radar/tool/apktool_$apktoolVersion.jar repo/lib/radar/tool/apktool.jar
70+
repo/bin/scanapk.php app/build/outputs/apk/oss/debug/roundsync_v*-oss-universal-debug.apk
71+
env:
72+
apktoolVersion: "2.9.3"
73+
- name: 'Get Commit Hash'
74+
id: commit
75+
uses: pr-mpt/actions-commit-hash@v1

.github/workflows/lint.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ jobs:
1010
checkLint:
1111
runs-on: ubuntu-latest
1212
steps:
13-
- uses: actions/checkout@v3
13+
- uses: actions/checkout@v4
1414
- name: Set up JDK 17
1515
uses: actions/setup-java@v3
1616
with:
@@ -21,7 +21,7 @@ jobs:
2121
run: ./gradlew lint -x :rclone:buildAll
2222
- name: Upload Reports
2323
if: always()
24-
uses: actions/upload-artifact@v3
24+
uses: actions/upload-artifact@v4
2525
with:
2626
name: Lint Reports
2727
path: ~/**/build/reports/

.github/workflows/translations.yml

Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
name: Translations
2+
3+
on:
4+
workflow_dispatch:
5+
pull_request:
6+
7+
jobs:
8+
string-change-verification:
9+
runs-on: ubuntu-latest
10+
outputs:
11+
changed: ${{ steps.changeDetection.outputs.should-run }}
12+
files: ${{ steps.changeDetection.outputs.files }}
13+
steps:
14+
- uses: actions/checkout@v4
15+
- name: Get changed files
16+
id: changed-files
17+
uses: tj-actions/changed-files@v44
18+
- name: Verify build.gradle changed
19+
id: changeDetection
20+
env:
21+
ALL_CHANGED_FILES: ${{ steps.changed-files.outputs.all_changed_files }}
22+
run: |
23+
SEARCH='strings.xml'
24+
CHANGEDFILES=''
25+
for file in ${ALL_CHANGED_FILES}; do
26+
if [[ "$file" == *"$SEARCH" ]]; then
27+
echo "$file was changed"
28+
CHANGEDFILES="${CHANGEDFILES} $file"
29+
echo "should-run=true" >> $GITHUB_OUTPUT
30+
fi
31+
done
32+
echo "files=$CHANGEDFILES" >> $GITHUB_OUTPUT
33+
34+
checkTranslations:
35+
runs-on: ubuntu-latest
36+
needs: string-change-verification
37+
if: needs.string-change-verification.outputs.changed == 'true'
38+
steps:
39+
- uses: actions/checkout@v4
40+
with:
41+
fetch-depth: 0
42+
- name: Prepare Profanity Check
43+
id: prep
44+
run: |
45+
sudo apt-get install -y xmlstarlet
46+
pip3 install alt-profanity-check
47+
chmod +x ./scripts/checkProfanity.py
48+
chmod +x ./scripts/generateFilelist.sh
49+
FILE_LIST="${{needs.string-change-verification.outputs.files}}"
50+
SIZE=$(echo "$FILE_LIST" | awk '{print NF}')
51+
if [ "$SIZE" -ne 1 ]; then
52+
echo "Only pass the amount of commits and one translation file! You passed: $SIZE"
53+
exit 1
54+
fi
55+
TRANSLATIONS=$(./scripts/generateFilelist.sh ${{ github.event.pull_request.commits }} ${{needs.string-change-verification.outputs.files}})
56+
echo "TRANSLATIONS=$TRANSLATIONS" >> $GITHUB_OUTPUT
57+
shell: sh
58+
- uses: fabasoad/translation-action@main
59+
id: google-translate
60+
with:
61+
provider: google
62+
lang: auto-en
63+
source: ${{ steps.prep.outputs.TRANSLATIONS }}
64+
- name: Print the result
65+
run: |
66+
echo "Translations are: '${{ steps.google-translate.outputs.text }}'"
67+
echo "${{ steps.google-translate.outputs.text }}" | sed 's/ ; /\n/g' > translated_texts.txt
68+
./scripts/checkProfanity.py translated_texts.txt
69+
shell: sh
70+
- name: Upload Raw Translations
71+
uses: actions/upload-artifact@v4
72+
with:
73+
name: Translations
74+
path: |
75+
changed_texts.txt
76+
translated_texts.txt
77+
suspicious_texts.txt
78+
- name: Fail if there are suspected profanities
79+
run: |
80+
if [ -s "suspicious_texts.txt" ]; then
81+
echo "We found suspicious translations. Please check!"
82+
exit 1
83+
fi
84+
shell: sh
85+

app/build.gradle

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@ android {
1717
minSdkVersion 23
1818
compileSdk 34
1919
targetSdkVersion 34
20-
versionCode 370 // last digit is reserved for ABI, only ever end on 0!
21-
versionName '2.5.2'
20+
versionCode 380 // last digit is reserved for ABI, only ever end on 0!
21+
versionName '2.5.3'
2222
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
2323
buildConfigField "java.lang.String", "CLI", System.getenv('RCX_BUILD_CLI') ? System.getenv('RCX_BUILD_CLI') : "\"c03129b6-b09f-9cb4-8fcd-7f143b8f94ef\""
2424
buildConfigField "java.lang.String", "VCP_AUTHORITY", "\"" + applicationId + ".vcp\"";
@@ -168,7 +168,7 @@ dependencies {
168168

169169
implementation 'com.google.android.material:material:1.11.0'
170170
implementation 'androidx.preference:preference-ktx:1.2.1'
171-
implementation 'androidx.datastore:datastore-preferences:1.0.0'
171+
implementation 'androidx.datastore:datastore-preferences:1.1.0'
172172

173173
implementation("org.jetbrains.kotlinx:kotlinx-serialization-json:1.6.3")
174174

@@ -207,5 +207,4 @@ dependencies {
207207

208208
//Updates
209209
implementation 'com.github.Sharkaboi:AppUpdateChecker:v1.0.5'
210-
implementation("com.google.android.play:app-update-ktx:2.1.0")
211210
}

app/src/main/java/de/felixnuesse/extract/updates/workmanager/UpdateWorker.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ class UpdateWorker (private var mContext: Context, workerParams: WorkerParameter
2626

2727
private var checkForUpdates = preferenceManager.getBoolean(mContext.getString(R.string.pref_key_app_updates), false)
2828
private val ignoredVersion = preferenceManager.getString(mContext.getString(R.string.pref_key_app_update_dismiss_current_update), "")
29-
private val lastFoundVersion = preferenceManager.getString(mContext.getString(R.string.pref_key_app_updates_found_update_for_version), "")?:""
29+
private val lastFoundVersion = preferenceManager.getString(mContext.getString(R.string.pref_key_app_updates_found_update_for_version), BuildConfig.VERSION_NAME)?:BuildConfig.VERSION_NAME
3030

3131

3232
override fun doWork(): Result {

scripts/checkProfanity.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
#!/usr/bin/python
2+
3+
from profanity_check import predict, predict_prob
4+
import sys
5+
6+
7+
file = open("suspicious_texts.txt", "a")
8+
source = open(sys.argv[1], "r")
9+
lines = source.readlines()
10+
for line in lines:
11+
print("Checking: "+str(line.rstrip()))
12+
prediction = predict_prob([line.rstrip()])
13+
if prediction[0] > 0.5:
14+
file.write(str(prediction[0]) + " - " + str(line.rstrip())+"\n")
15+
print("Offending line: "+str(line.rstrip()))
16+
17+
file.close()

scripts/generateFilelist.sh

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
#!/bin/bash
2+
3+
if [ "$#" -ne 2 ]; then
4+
echo "Only pass the amount of commits and one translation file!"
5+
exit 1
6+
fi
7+
8+
DIFF=$(git diff -U0 HEAD~$1 ${@:2} | grep -E "^\+" | grep -v +++ | cut -c 2- | sed 's/^[ \t]*\(.*$\)/\1/')
9+
echo "<xml>$DIFF</xml>" | xmlstarlet sel -t -m '//string' -v . -n > changed_texts.txt
10+
TRANSLATIONS=$(cat changed_texts.txt)
11+
TRANSLATIONS="${TRANSLATIONS//'%'/' ; '}"
12+
TRANSLATIONS="${TRANSLATIONS//$'\n'/' ; '}"
13+
TRANSLATIONS="${TRANSLATIONS//$'\r'/' ; '}"
14+
echo $TRANSLATIONS

0 commit comments

Comments
 (0)