Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[build] Add Android build action to GitHub CI #2149

Merged
merged 16 commits into from
Oct 13, 2021

Conversation

maxsharabayko
Copy link
Collaborator

@maxsharabayko maxsharabayko commented Oct 6, 2021

Add Android build CI action with NDK R23.

TODO

  • How to properly set script dir?

@maxsharabayko maxsharabayko added this to the v1.4.5 milestone Oct 6, 2021
@maxsharabayko maxsharabayko added [build] Area: Changes in build files Type: Enhancement Indicates new feature requests labels Oct 6, 2021
@maxsharabayko
Copy link
Collaborator Author

When running from Github CI Action, the initial SCRIPT_DIR value is correct, while after auto-detection it becomes kinda invalid.
@sergeiignatov could you advise what would be the best way to resolve this? Maybe allow passing SCRIPT_DIR as an argument of the script?

SCRIPT_DIR: /home/runner/work/srt/srt/scripts/build-android
uname: Linux
readlink -f $0: /home/runner/work/_temp/01987a7f-8cc7-4d32-818f-f57770e2a163.sh
New SCRIPT_DIR: /home/runner/work/_temp

@sergeiignatov
Copy link
Contributor

@maxsharabayko I suggest to create new script, like build-android-ci, that will call mkssl/mkmbedtls and mksrt.
Not only path detection should be changed, but

  • build-android:96 will clone srt repository each time but travis build will use own working copy;
  • build-android:86 same clone logic for mbedtls repo;
  • mkssl:20 will download openssl on each build and this should go to build-android:82 to be more consistent.

@sergeiignatov
Copy link
Contributor

@maxsharabayko it s not not required to re-build openssl on each push. This will be waste of time. Do the following: comment out srt part from build-android and run it on local machine with -e openssl and then with -e mbedtls.

You will get "sysroots" for 4 architectures in working directory. Copy it somewhere to travis machine, then just pass $INSTALL_DIR to mksrt.

mksrt -n NDK_ROOT -a 21 -t arm64-v8a -e openssl -s /path/to/srt/repo/root -i /travis/prebuilt_android_enc_libs/arm64-v8a

@maxsharabayko
Copy link
Collaborator Author

You will get "sysroots" for 4 architectures in working directory. Copy it somewhere to travis machine, then just pass $INSTALL_DIR to mksrt.

I am not sure if we could store them on the CI machine provided by GitHub, but we could create a dedicated repository to store those binaries there, and just download them instead of building each time. 🤔

I still wonder though why do you suggest creating a separate script? The existing one works well except for the SCRIPT_PATH variable. At the moment I have it commented and CI build succeeds.

@sergeiignatov
Copy link
Contributor

I missed last status update, I thought status is still "stuck on openssl build". It's ok to use $(pwd) instead of auto-detection, don't add extra command-line argument.

Also build-android script clones own copy of srt repo (build-android:97). Will it get updated code from pull request's branch?

@maxsharabayko
Copy link
Collaborator Author

Also build-android script clones own copy of srt repo (build-android:97). Will it get updated code from pull request's branch?

Indeed! We already have a working copy of srt source code from the PR locally during the CI action (see the checkout action). Modification to the script is needed to handle this properly.

Currently:

if [ ! -d $BASE_DIR/srt ]; then
 git clone https://github.com/Haivision/srt srt
 if [ ! -z "$SRT_VERSION" ]; then
  git -C $BASE_DIR/srt checkout $SRT_VERSION
 fi
fi

@sergeiignatov
Copy link
Contributor

Done. Script will build working copy: sergeiignatov@423f024

maxsharabayko and others added 2 commits October 13, 2021 10:14
Co-authored-by: Sergei Ignatov <sergeiignatov@users.noreply.github.com>
@maxsharabayko
Copy link
Collaborator Author

Thank you, @sergeiignatov !

I assume line 108 can also be removed now, right?

git -C $BASE_DIR/srt clean -fd

Currently it causes the following error:

2021-10-13T08:47:31.9152247Z Before git -C BASE_DIR/srt clean -fd
2021-10-13T08:47:31.9169783Z fatal: cannot change to '/home/runner/work/srt/srt/scripts/build-android/srt': No such file or directory

@sergeiignatov
Copy link
Contributor

No, git clean is still required to move between architectures. And it should ignore work already done inside scripts/build-android.
sergeiignatov@ae918e0 should be final version of script.

@maxsharabayko
Copy link
Collaborator Author

Great, thank you @sergeiignatov !
Android build action is working now!

@maxsharabayko maxsharabayko marked this pull request as ready for review October 13, 2021 13:46
@maxsharabayko maxsharabayko merged commit 2da63dc into Haivision:master Oct 13, 2021
@maxsharabayko maxsharabayko deleted the build/action-android branch October 13, 2021 14:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[build] Area: Changes in build files Type: Enhancement Indicates new feature requests
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants