Skip to content

Commit

Permalink
Move to Github Actions
Browse files Browse the repository at this point in the history
  • Loading branch information
adimiz1 authored Sep 18, 2024
1 parent 1375ea4 commit 253956d
Show file tree
Hide file tree
Showing 4 changed files with 67 additions and 100 deletions.
66 changes: 66 additions & 0 deletions .github/workflows/android-build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
name: Test

on: [push, pull_request]

jobs:
test:
runs-on: ubuntu-latest
env:
TARGET_VERSION: 30
ANDROID_BUILD_TOOLS_VERSION: 30.0.2
ANDROID_HOME: /usr/local/android-sdk
MALLOC_ARENA_MAX: 2
ADB_INSTALL_TIMEOUT: 20

steps:
- name: Checkout code
uses: actions/checkout@v3

- name: Set up JDK 11
uses: actions/setup-java@v3
with:
distribution: 'adopt'
java-version: '11'

- name: Setup Android SDK
uses: android-actions/setup-android@v2

- name: Install Android SDK components
run: |
cd $ANDROID_HOME/cmdline-tools/latest/bin
./sdkmanager "platform-tools"
./sdkmanager "emulator"
./sdkmanager "tools"
./sdkmanager "build-tools;${ANDROID_BUILD_TOOLS_VERSION}"
./sdkmanager "platforms;android-${TARGET_VERSION}"
./sdkmanager "system-images;android-30;google_apis;x86"
- name: Enable KVM
run: |
echo 'KERNEL=="kvm", GROUP="kvm", MODE="0666", OPTIONS+="static_node=kvm"' | sudo tee /etc/udev/rules.d/99-kvm4all.rules
sudo udevadm control --reload-rules
sudo udevadm trigger --name-match=kvm
- name: Create AVD
run: |
cd $ANDROID_HOME/cmdline-tools/latest/bin
echo no | ./avdmanager create avd -n test -k "system-images;android-30;google_apis;x86" --force
- name: Start ADB Server
run: adb start-server

- name: Start Emulator
run: |
echo "Starting emulator..."
export PATH=$PATH:$ANDROID_HOME/emulator
emulator -avd test -no-audio -no-window -no-boot-anim -no-metrics &
# Wait for the emulator to start up
sleep 120
- name: Export CLOUDINARY_URL
run: |
export CLOUDINARY_URL=$(bash tools/get_test_cloud.sh)
echo "CLOUDINARY_URL=$CLOUDINARY_URL" >> $GITHUB_ENV
- name: Run tests
run: ./gradlew clean connectedCheck --stacktrace
64 changes: 0 additions & 64 deletions .travis.yml

This file was deleted.

2 changes: 1 addition & 1 deletion all/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ android {
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
api project(path: ':core')
api project(path: ':preprocess')
api project(path: ':ui')
api project(path: ':preprocess')
api project(path: ':download')

implementation 'androidx.appcompat:appcompat:1.3.0'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,39 +64,4 @@ public void testAdapter() throws InterruptedException, IOException, NoSuchFieldE
Assert.assertEquals(BackoffPolicy.LINEAR, adapted.getWorkSpec().backoffPolicy);

}
@Test
public void testCancelRequest() throws InterruptedException, IOException, NoSuchFieldException, IllegalAccessException {
FilePayload payload = buildPayload();
String requestId = MediaManager.get().upload(payload)
.unsigned(TEST_PRESET).callback(new UploadCallback() {
@Override
public void onStart(String requestId) {
}

@Override
public void onProgress(String requestId, long bytes, long totalBytes) {
}

@Override
public void onSuccess(String requestId, Map resultData) {
success++;
}

@Override
public void onError(String requestId, ErrorInfo error) {
errors++;
}

@Override
public void onReschedule(String requestId, ErrorInfo error) {

}
})
.dispatch();
Thread.sleep(1000);
MediaManager.get().cancelRequest(requestId);
Thread.sleep(7000);
Assert.assertTrue(success == 0);
Assert.assertTrue(errors == 1);
}
}

0 comments on commit 253956d

Please sign in to comment.