Skip to content

Commit 900fc50

Browse files
committed
add CI runs back (that were accidentally removed with PR merge)
1 parent 3d6c3e9 commit 900fc50

16 files changed

Lines changed: 1337 additions & 0 deletions

.github/workflows/android.yml

Lines changed: 169 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,169 @@
1+
name: Android CI
2+
on:
3+
push:
4+
paths-ignore:
5+
- 'README.md'
6+
- '.github/workflows/tests.yml'
7+
pull_request:
8+
paths-ignore:
9+
- 'README.md'
10+
- '.github/workflows/tests.yml'
11+
workflow_dispatch:
12+
inputs:
13+
version:
14+
description: dummy
15+
default: dummy
16+
17+
jobs:
18+
update-nightly-tag:
19+
name: Update nightly release tag
20+
runs-on: ubuntu-latest
21+
if: github.event_name == 'push' && github.ref == 'refs/heads/zoff99/dev003'
22+
permissions:
23+
contents: write
24+
steps:
25+
- uses: actions/checkout@v4
26+
- name: Move nightly tag to head for nightly release
27+
run: git tag -f nightly && git push origin nightly -f
28+
29+
build:
30+
runs-on: ubuntu-latest
31+
permissions:
32+
contents: write
33+
steps:
34+
- uses: actions/checkout@v4
35+
- uses: actions/setup-java@v4
36+
with:
37+
distribution: 'temurin'
38+
java-version: '11'
39+
40+
- name: show github event data
41+
run: |
42+
echo ${{github.event}} || echo "NO ERR"
43+
echo ${{github.event_path}} || echo "NO ERR"
44+
echo ${{github.event_name}} || echo "NO ERR"
45+
echo ${{github.ref}} || echo "NO ERR"
46+
echo ${{github.workspace}} || echo "NO ERR"
47+
echo ${{github.workflow}} || echo "NO ERR"
48+
49+
- name: Install system packages
50+
run: |
51+
sudo apt-get update && \
52+
sudo DEBIAN_FRONTEND=noninteractive \
53+
apt-get install -y --no-install-recommends \
54+
zipalign \
55+
apksigner
56+
- name: Install NDK
57+
run: |
58+
echo "y" | sudo /usr/local/lib/android/sdk/cmdline-tools/latest/bin/sdkmanager --install "ndk;21.0.6113669" --sdk_root=${ANDROID_SDK_ROOT}
59+
echo "y" | sudo /usr/local/lib/android/sdk/cmdline-tools/latest/bin/sdkmanager --install "ndk;20.1.5948944" --sdk_root=${ANDROID_SDK_ROOT}
60+
61+
- name: Change to debug ID
62+
run: |
63+
datestr=$(date '+%Y%m%d%H%M%S')
64+
cat android-refimpl-app/app/build.gradle | grep applicationId
65+
sed -i -e 's#applicationId "com.zoffcc.applications.trifa"#applicationId "com.zoffcc.applications.trifa_debug_'"$datestr"'"#' android-refimpl-app/app/build.gradle
66+
cat android-refimpl-app/app/build.gradle | grep applicationId
67+
grep -rli std_fileprovider|grep -e '.java' -e '.xml'|xargs -L1 sed -i -e 's#com.zoffcc.applications.trifa.std_fileprovider#com.zoffcc.applications.trifa.std_fileprovider_debug_'"$datestr"'#'
68+
grep -rli "com.zoffcc.applications.trifa.ext2_provider"|grep -e '.java' -e '.xml'|xargs -L1 sed -i -e 's#com.zoffcc.applications.trifa.ext2_provider#com.zoffcc.applications.trifa.ext2_provider_debug_'"$datestr"'#'
69+
grep -rli "com.zoffcc.applications.trifa.ext1_fileprovider"|grep -e '.java' -e '.xml'| xargs -L1 sed -i -e 's#com.zoffcc.applications.trifa.ext1_fileprovider#com.zoffcc.applications.trifa.ext1_fileprovider_debug_'"$datestr"'#'
70+
sed -i -e 's#android:label="TRIfA"#android:label="DEBUG TRIfA '"$datestr"'"#' android-refimpl-app/app/src/main/AndroidManifest.xml
71+
cat android-refimpl-app/app/src/main/AndroidManifest.xml|grep 'android:label='
72+
73+
- name: turn on more debug logging
74+
run: |
75+
sed -i -e 's#final static boolean NDK_STDOUT_LOGGING =.*#final static boolean NDK_STDOUT_LOGGING = true;#' android-refimpl-app/app/src/main/java/com/zoffcc/applications/trifa/MainActivity.java
76+
sed -i -e 's#final static boolean CTOXCORE_NATIVE_LOGGING =.*#final static boolean CTOXCORE_NATIVE_LOGGING = true;#' android-refimpl-app/app/src/main/java/com/zoffcc/applications/trifa/MainActivity.java
77+
78+
- name: download the latest JNI debug lib
79+
run: |
80+
# HINT: ingore any errors and build with release artefact if debug version not here for some reason
81+
wget 'https://github.com/zoff99/ToxAndroidRefImpl/releases/download/nightly/libjni-c-toxcore.so___arm64_debug' -O __libjni-c-toxcore.so || echo "NO ERR"
82+
cp -v __libjni-c-toxcore.so ./android-refimpl-app/app/nativelibs/arm64-v8a/libjni-c-toxcore.so || echo "NO ERR"
83+
chmod a+r ./android-refimpl-app/app/nativelibs/arm64-v8a/libjni-c-toxcore.so || echo "NO ERR"
84+
85+
- name: show changes
86+
run: |
87+
git diff || echo "NO ERR"
88+
89+
- name: show witness checksums updates
90+
if: ${{ github.event_name == 'pull_request' || github.event_name == 'workflow_dispatch' }}
91+
run: cd android-refimpl-app ; ./gradlew -q calculateChecksums 2>/dev/null
92+
93+
- name: update witness checksums for pull requests
94+
if: ${{ github.event_name == 'pull_request' || github.event_name == 'workflow_dispatch' }}
95+
run: cd android-refimpl-app ; ./gradlew -q calculateChecksums 2>/dev/null| grep -v 'Checking the license for' > app/witness.gradle 2>/dev/null
96+
97+
- name: show witness checksums updates for pull requests
98+
if: ${{ github.event_name == 'pull_request' || github.event_name == 'workflow_dispatch' }}
99+
run: cd android-refimpl-app ; git diff app/witness.gradle
100+
101+
- name: Build with Gradle
102+
run: cd android-refimpl-app ; ./gradlew assemble ; find . -name '*.apk'
103+
104+
- name: generate debug key
105+
run: keytool -genkey -v -keystore debug.keystore -storepass android -alias androiddebugkey -keypass android -keyalg RSA -keysize 2048 -validity 10000 -dname CN=appauth
106+
107+
- name: align and sign apk
108+
run: |
109+
zipalign -p 4 /home/runner/work/ToxAndroidRefImpl/ToxAndroidRefImpl/android-refimpl-app/app/build/outputs/apk/debug/app-debug.apk /home/runner/work/ToxAndroidRefImpl/ToxAndroidRefImpl/android-refimpl-app/app/build/outputs/apk/debug/app-debug-aligned.apk
110+
apksigner sign --ks debug.keystore --ks-pass "pass:android" --ks-key-alias androiddebugkey --out /home/runner/work/ToxAndroidRefImpl/ToxAndroidRefImpl/android-refimpl-app/app/build/outputs/apk/debug/app-debug.apk --verbose /home/runner/work/ToxAndroidRefImpl/ToxAndroidRefImpl/android-refimpl-app/app/build/outputs/apk/debug/app-debug-aligned.apk
111+
112+
- name: upload apk
113+
uses: actions/upload-artifact@v4
114+
with:
115+
name: trifa
116+
path: /home/runner/work/ToxAndroidRefImpl/ToxAndroidRefImpl/android-refimpl-app/app/build/outputs/apk/debug/app-debug.apk
117+
118+
- name: Rename artifact for nightly upload
119+
if: github.event_name == 'push' && github.ref == 'refs/heads/zoff99/dev003'
120+
run: |
121+
pwd
122+
cp -av /home/runner/work/ToxAndroidRefImpl/ToxAndroidRefImpl/android-refimpl-app/app/build/outputs/apk/debug/app-debug.apk TRIfA-nightly.apk
123+
124+
- name: Upload to nightly release
125+
uses: ncipollo/release-action@v1
126+
if: github.event_name == 'push' && github.ref == 'refs/heads/zoff99/dev003'
127+
with:
128+
allowUpdates: true
129+
tag: nightly
130+
omitBodyDuringUpdate: true
131+
omitNameDuringUpdate: true
132+
prerelease: true
133+
replacesArtifacts: true
134+
token: ${{ secrets.GITHUB_TOKEN }}
135+
artifacts: "TRIfA-nightly.apk"
136+
137+
- name: update witness checksums for pull requests (part 2)
138+
if: ${{ github.event_name == 'pull_request' || github.event_name == 'workflow_dispatch' }}
139+
run: |
140+
git checkout .
141+
rm -f debug.keystore
142+
echo "========= git diff before witness update "========= "
143+
git diff
144+
echo "========= git diff before witness update "========= "
145+
cd android-refimpl-app/
146+
./gradlew -q calculateChecksums
147+
./gradlew -q calculateChecksums 2>/dev/null| grep -v 'Checking the license for' > app/witness.gradle 2>/dev/null
148+
echo "========= git diff AFTER witness update "========= "
149+
cd ../
150+
git status
151+
git diff
152+
echo "========= git diff AFTER witness update "========= "
153+
154+
- name: Create Pull Request
155+
if: ${{ github.event_name == 'workflow_dispatch' }}
156+
uses: peter-evans/create-pull-request@v7
157+
with:
158+
commit-message: update witness checksums
159+
branch: 'create-pull-request/witness_checksums'
160+
delete-branch: true
161+
title: update witness checksums
162+
163+
164+
gradle-wrapper-validation:
165+
runs-on: ubuntu-latest
166+
steps:
167+
- uses: actions/checkout@v4
168+
- uses: gradle/wrapper-validation-action@v3
169+
Lines changed: 195 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,195 @@
1+
name: Linux Bob Tests
2+
on:
3+
push:
4+
paths-ignore:
5+
- 'README.md'
6+
- '.github/workflows/android.yml'
7+
pull_request:
8+
paths-ignore:
9+
- 'README.md'
10+
- '.github/workflows/android.yml'
11+
workflow_dispatch:
12+
inputs:
13+
version:
14+
description: dummy
15+
default: dummy
16+
17+
jobs:
18+
android-linux-test_bob:
19+
runs-on: ubuntu-latest
20+
strategy:
21+
matrix:
22+
api-level: [29]
23+
permissions:
24+
contents: write
25+
if: ${{ true }}
26+
steps:
27+
- uses: actions/checkout@v4
28+
29+
- name: install deps
30+
run: |
31+
sudo apt-get update && \
32+
sudo DEBIAN_FRONTEND=noninteractive \
33+
apt-get install -y --no-install-recommends \
34+
fonts-freefont-otf \
35+
adb \
36+
ghostscript \
37+
imagemagick \
38+
ca-certificates
39+
- name: check imagemagick
40+
run: |
41+
convert -list font || echo "NO ERR"
42+
- name: Install Java
43+
uses: actions/setup-java@v4
44+
with:
45+
distribution: 'temurin'
46+
java-version: |
47+
17
48+
- name: Enable KVM group perms
49+
run: |
50+
echo 'KERNEL=="kvm", GROUP="kvm", MODE="0666", OPTIONS+="static_node=kvm"' | sudo tee /etc/udev/rules.d/99-kvm4all.rules
51+
sudo udevadm control --reload-rules
52+
sudo udevadm trigger --name-match=kvm
53+
- name: test java1
54+
run: |
55+
pwd
56+
type java
57+
echo "===========1========="
58+
java -version || exit 0
59+
echo "===========2========="
60+
- name: download tester
61+
shell: bash
62+
run: |
63+
curl -L https://github.com/zoff99/java_tox_tester/archive/refs/heads/master.zip -o master.zip
64+
unzip master.zip
65+
ls -al java_tox_tester-master/
66+
java -version
67+
javac -version
68+
- name: start tester
69+
shell: bash
70+
run: |
71+
cd java_tox_tester-master/ ; ls -al ; ./do_wait_for_app.sh &
72+
- name: check disk space
73+
shell: bash
74+
run: |
75+
df -h
76+
du -hs /home/runner/work
77+
cd /home/runner/work
78+
du -s *|sort -n
79+
- name: android test
80+
timeout-minutes: 30
81+
continue-on-error: true
82+
uses: reactivecircus/android-emulator-runner@v2
83+
with:
84+
api-level: ${{ matrix.api-level }}
85+
profile: Nexus 6
86+
arch: x86_64
87+
ndk: 21.0.6113669
88+
cmake: 3.10.2.4988404
89+
force-avd-creation: false
90+
emulator-options: -no-snapshot-save -skin 1080x2220 -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none
91+
disable-animations: true
92+
disable-spellchecker: true
93+
script: |
94+
df -h
95+
rm -f /home/runner/work/ToxAndroidRefImpl/ToxAndroidRefImpl/android-refimpl-app/app/witness.gradle
96+
sed -i -e 's#a.getWindow().addFlags#//a.getWindow().addFlagsXXYY#' /home/runner/work/ToxAndroidRefImpl/ToxAndroidRefImpl/android-refimpl-app/app/src/main/java/com/zoffcc/applications/trifa/CallingActivity.java
97+
printf 'dependencyVerification {\nverify = [\n]\n}\n' > /home/runner/work/ToxAndroidRefImpl/ToxAndroidRefImpl/android-refimpl-app/app/witness.gradle
98+
java -version
99+
cd android-refimpl-app ; ./gradlew assemble
100+
adb logcat -c || echo "NOERR"
101+
adb logcat > /home/runner/work/ToxAndroidRefImpl/ToxAndroidRefImpl/android-refimpl-app/logcat.txt &
102+
echo 'sleep 100' > /home/runner/a.sh
103+
echo 'sleep 40' >> /home/runner/a.sh
104+
echo 'sleep 10' >> /home/runner/a.sh
105+
echo 'sleep 10' >> /home/runner/a.sh
106+
echo 'sleep 10' >> /home/runner/a.sh
107+
cat /home/runner/a.sh
108+
ls -al /home/runner/a.sh
109+
chmod u+rx /home/runner/a.sh
110+
bash /home/runner/a.sh &
111+
cd android-refimpl-app ; ./gradlew app:connectedAndroidTest -Pandroid.testInstrumentationRunnerArguments.class=com.zoffcc.applications.trifa.JavaFriendTester || echo "NOERR"
112+
pwd
113+
adb pull /sdcard/googletest/test_outputfiles .
114+
ls -al /home/runner/work/ToxAndroidRefImpl/ToxAndroidRefImpl/test_outputfiles/
115+
echo "---------------"
116+
ls -al /home/runner/work/ToxAndroidRefImpl/ToxAndroidRefImpl/test_outputfiles/*.png
117+
- name: make promo screenshots 1
118+
run: |
119+
pwd
120+
git clone https://github.com/zoff99/android_promo_screens
121+
cd ./android_promo_screens/
122+
./test.sh "TRIfA" "Message your Friends and Family securely and with ease." /home/runner/work/ToxAndroidRefImpl/ToxAndroidRefImpl/test_outputfiles/test_004b.png
123+
cp -av output.png promo_02.png
124+
mv -v promo_02.png ../promo_${{ matrix.api-level }}_02.png
125+
./test.sh "TRIfA" "Send Messages and Files or just Call your Friends." /home/runner/work/ToxAndroidRefImpl/ToxAndroidRefImpl/test_outputfiles/test_099.png
126+
cp -av output.png promo_03.png
127+
mv -v promo_03.png ../promo_${{ matrix.api-level }}_03.png
128+
- name: make promo screenshots 2
129+
run: |
130+
cd ./android_promo_screens/
131+
./test2.sh "TRIfA" "Message your Friends and Family securely and with ease." /home/runner/work/ToxAndroidRefImpl/ToxAndroidRefImpl/images/101.png
132+
cp -av output.png promo_101.png
133+
mv -v promo_101.png ../promo_${{ matrix.api-level }}_101.png
134+
./test2.sh "TRIfA" "Send Messages and Files or just Call your Friends." /home/runner/work/ToxAndroidRefImpl/ToxAndroidRefImpl/images/102.png
135+
cp -av output.png promo_102.png
136+
mv -v promo_102.png ../promo_${{ matrix.api-level }}_102.png
137+
- name: Upload to nightly release
138+
uses: ncipollo/release-action@v1
139+
if: github.event_name == 'push' && github.ref == 'refs/heads/zoff99/dev003'
140+
with:
141+
allowUpdates: true
142+
tag: nightly
143+
omitBodyDuringUpdate: true
144+
omitNameDuringUpdate: true
145+
prerelease: true
146+
replacesArtifacts: true
147+
token: ${{ secrets.GITHUB_TOKEN }}
148+
artifacts: "promo_${{ matrix.api-level }}_02.png,promo_${{ matrix.api-level }}_03.png,promo_${{ matrix.api-level }}_101.png,promo_${{ matrix.api-level }}_102.png"
149+
150+
151+
- name: put datetime on screenshots
152+
run: |
153+
cd /home/runner/work/ToxAndroidRefImpl/ToxAndroidRefImpl/
154+
git rev-parse --short HEAD
155+
c="$(git rev-parse --short HEAD)"
156+
cd /home/runner/work/ToxAndroidRefImpl/ToxAndroidRefImpl/test_outputfiles/
157+
ls -al
158+
d="$(date '+%Y-%m-%d %H:%M:%S')"
159+
convert test_004b.png -gravity SouthEast -pointsize 62 -fill white -annotate +30+30 "$d ($c)" test_004b_time.png
160+
convert test_099.png -gravity SouthEast -pointsize 62 -fill white -annotate +30+30 "$d ($c)" test_099_time.png
161+
mv test_004b_time.png test_004b.png
162+
mv test_099_time.png test_099.png
163+
- name: upload screenshots
164+
uses: actions/upload-artifact@v4
165+
with:
166+
name: linuxscreen_${{ matrix.api-level }}
167+
path: |
168+
/home/runner/screen*.png
169+
/home/runner/work/ToxAndroidRefImpl/ToxAndroidRefImpl/test_outputfiles/*.png
170+
- name: upload logcat output
171+
continue-on-error: true
172+
uses: actions/upload-artifact@v4
173+
with:
174+
name: logcat_${{ matrix.api-level }}
175+
path: |
176+
/home/runner/work/ToxAndroidRefImpl/ToxAndroidRefImpl/android-refimpl-app/logcat.txt
177+
- name: Rename artifact for nightly upload
178+
if: github.event_name == 'push' && github.ref == 'refs/heads/zoff99/dev003'
179+
run: |
180+
pwd
181+
cp -av /home/runner/work/ToxAndroidRefImpl/ToxAndroidRefImpl/test_outputfiles/test_004b.png screen_shot_android_${{ matrix.api-level }}_02.png
182+
cp -av /home/runner/work/ToxAndroidRefImpl/ToxAndroidRefImpl/test_outputfiles/test_099.png screen_shot_android_${{ matrix.api-level }}_03.png
183+
- name: Upload to nightly release
184+
uses: ncipollo/release-action@v1
185+
if: github.event_name == 'push' && github.ref == 'refs/heads/zoff99/dev003'
186+
with:
187+
allowUpdates: true
188+
tag: nightly
189+
omitBodyDuringUpdate: true
190+
omitNameDuringUpdate: true
191+
prerelease: true
192+
replacesArtifacts: true
193+
token: ${{ secrets.GITHUB_TOKEN }}
194+
artifacts: "screen_shot_android_${{ matrix.api-level }}_02.png,screen_shot_android_${{ matrix.api-level }}_03.png"
195+

0 commit comments

Comments
 (0)