-
Notifications
You must be signed in to change notification settings - Fork 47
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
Feat: Add task to build experimental engine in android #650
Changes from 16 commits
f032ad6
25822af
492af69
6c43d27
1faff56
03478e2
d8e8bd6
444b869
43f514d
b6a22f6
a4c7020
738e1de
47bcfc3
04ac4ca
c2278a3
c544f21
29d0e56
956ae09
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
name: Build Experimental Engine | ||
|
||
on: | ||
push: | ||
branches: | ||
- master | ||
pull_request: | ||
schedule: | ||
- cron: "0 2 * * */2" | ||
|
||
jobs: | ||
build_experimental_engine: | ||
runs-on: ubuntu-22.04 | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- name: Set up JDK 17 | ||
uses: actions/setup-java@v3 | ||
with: | ||
java-version: '17' | ||
distribution: 'temurin' | ||
|
||
- name: Setup Android SDK | ||
uses: android-actions/setup-android@v3 | ||
|
||
- name: Get GOVERSION content | ||
id: goversion | ||
run: echo "version=$(curl https://raw.githubusercontent.com/ooni/probe-cli/master/GOVERSION && cat GOVERSION)" >> "$GITHUB_OUTPUT" | ||
shell: bash | ||
|
||
- uses: magnetikonline/action-golang-cache@v4 | ||
with: | ||
go-version: "${{ steps.goversion.outputs.version }}" | ||
cache-key-suffix: "-coverage-${{ steps.goversion.outputs.version }}" | ||
aanorbel marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
- name: Build Experimental Archive from `ooni/probe-cli` | ||
run: ./gradlew buildExperimentalArchive | ||
|
||
- name: Build Experimental App | ||
run: ./gradlew assembleExperimentalFullDebug | ||
|
||
- name: Archive Experimental APK | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: app-experimental-full-debug | ||
path: app/build/outputs/apk/experimentalFull/debug/app-experimental-full-debug.apk |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
/oonimkall.aar | ||
/oonimkall-sources.jar |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,12 @@ | ||
configurations.maybeCreate("default") | ||
artifacts.add("default", file('oonimkall.aar')) | ||
|
||
task clean(type: Delete) { | ||
delete 'oonimkall.aar' | ||
delete 'oonimkall-sources.jar' | ||
} | ||
|
||
task buildExperimentalArchive(type: Exec) { | ||
commandLine 'sh', 'mkdir' , '-p' , rootProject.buildDir | ||
commandLine 'sh', "../scripts/build_experimental_archive.sh" , project.property('ooni.experimental.target') , rootProject.buildDir | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If we're using bash specific constructs, and I think we do, I really recommend using |
||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
ooni.experimental.target=master |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
ooni.experimental.target=master |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
#!/bin/sh | ||
aanorbel marked this conversation as resolved.
Show resolved
Hide resolved
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This should be |
||
set -eux | ||
aanorbel marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
# Define build and output directories | ||
gitTarget=${1:-"master"} | ||
buildDir=${2:-"./build"} | ||
|
||
if [ -d "$buildDir" ]; then rm -Rf $buildDir; fi | ||
|
||
# Create build directory and navigate into it | ||
mkdir -p "${buildDir}" | ||
|
||
cd "${buildDir}" | ||
|
||
# Clone the repository | ||
git clone -v https://github.com/ooni/probe-cli.git | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You can possibly make this more efficient by using |
||
|
||
# Navigate into the repository | ||
cd probe-cli | ||
|
||
# Checkout the target branch | ||
git checkout "${gitTarget}" | ||
|
||
# Build the probe-cli | ||
make android | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This command has huge requirements in terms of building, but I reckon many of them are probably already satisfied if one is using Android Studio every day. Trying to spell them out, I think they are:
I think most of these preconditions are checked by
This action does not need to run at every pull request, rather I suppose it's fine to run it only for commits that have already been merged into the |
||
|
||
cp -v ./MOBILE/android/oonimkall.aar ../../engine-experimental/ | ||
cp -v ./MOBILE/android/oonimkall-sources.jar ../../engine-experimental/ | ||
|
||
|
||
echo "Done building engine archive." |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This code would break if we would like to build a commit different from
master
. I see you are using properties to define which probe-cli branch you want to build and the default ismaster
.Because the properties allow to customize the branch to build, we might be tempted to choose specific branches in a pull request for testing purposes (e.g., a different oonimkall API).
That is, we have a chicken and egg problem here. I also understand how it's tricky for you to run the build without having a way in probe-cli to download the correct Go version, a problem that we discussed previously and where I probably overlooked your needs in terms of integrating with the engine.
I think we can do various amounts of ju-jitsu here to make sure we have the correct version, but I am also starting to wonder whether it would just be more efficient to have this functionality into probe-cli, such that jumping into this kind of hoops is not the concern of every integrator.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We don't need this anymore as soon as ooni/probe#2664 is closed. As long as Go >= 1.19 is installed,
make android
would install and use the right version of Go for building.