Skip to content
Merged

CI #2

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
65 changes: 65 additions & 0 deletions .github/workflows/Android-CI-Espresso.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
name: CI

on:
push:
branches:
- master
pull_request:

jobs:
build:
name: Build JDK ${{ matrix.java_version }}
runs-on: macOS-latest
strategy:
matrix:
java_version: [ 11 ]
steps:
- name: Checkout
uses: actions/[email protected]
- name: Install JDK ${{ matrix.java_version }}
uses: actions/setup-java@v2
with:
distribution: 'adopt'
java-version: ${{ matrix.java_version }}
- name: Install Android SDK
uses: malinskiy/action-android/install-sdk@release/0.1.2
- name: Build project
run: ./gradlew assemble
- name: Run tests
run: ./gradlew test
- name: Checks
run: ./gradlew check
- name: Archive Lint report
uses: actions/[email protected]
with:
name: Lint-report
path: app/build/reports/lint-results.html
# Espresso:
# name: Espresso ${{ matrix.java_version }}
# runs-on: macOS-latest
# strategy:
# matrix:
# java_version: [ 11 ]
# steps:
# - name: Checkout
# uses: actions/[email protected]
# - name: Install JDK ${{ matrix.java_version }}
# uses: actions/setup-java@v2
# with:
# distribution: 'adopt'
# java-version: ${{ matrix.java_version }}
# - name: Install Android SDK
# uses: malinskiy/action-android/install-sdk@release/0.1.2
# - name: Run instrumentation tests
# uses: malinskiy/action-android/emulator-run-cmd@release/0.1.2
# with:
# cmd: ./gradlew cAT --continue
# api: 28
# tag: default
# abi: x86
# - name: Archive Espresso results
# uses: actions/[email protected]
# with:
# name: Espresso-report
# path: app/build/reports/androidTests/connected

56 changes: 56 additions & 0 deletions .github/workflows/Android-CI-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
name: Release

on:
push:
tags:
- '*'

jobs:
build:
name: Publish aar
runs-on: macOS-latest
strategy:
matrix:
java_version: [ 11 ]
steps:
- name: Checkout
uses: actions/[email protected]
with:
fetch-depth: 0
- name: Show tags
run: git tag -n
- name: Install JDK ${{ matrix.java_version }}
uses: actions/setup-java@v2
with:
distribution: 'adopt'
java-version: ${{ matrix.java_version }}
- name: Install Android SDK
uses: malinskiy/action-android/install-sdk@release/0.1.2
- name: Build project
run: ./gradlew clean assembleRelease
env:
TAG_VERSION: ${{ github.ref }}
- name: Search for aar file
run: echo "AAR_RELASE_FILE=$(find . -name *release.aar | head -n 1)" >> $GITHUB_ENV
- name: Search for AAR release name
run: echo "AAR_RELASE_NAME=$(find . -name *release.aar | head -n 1 | xargs basename)" >> $GITHUB_ENV
- name: Create Release
id: create_release
uses: actions/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: Release ${{ github.ref }}
draft: false
prerelease: false
- name: Upload Release Asset
id: upload-release-asset
uses: actions/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUBTOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }} # This pulls from the CREATE RELEASE step above, referencing it's ID to get its outputs object, which include a `upload_url`. See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps
asset_path: ${{ env.AAR_RELASE_FILE }}
asset_name: ${{ env.AAR_RELASE_NAME }}
asset_content_type: application/zip
10 changes: 10 additions & 0 deletions .github/workflows/gradle-wrapper-validation.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
name: "Validate Gradle Wrapper"
on: [push]

jobs:
validation:
name: "Validation"
runs-on: ubuntu-latest
steps:
- uses: actions/[email protected]
- uses: gradle/[email protected]
19 changes: 0 additions & 19 deletions .travis.yml

This file was deleted.

100 changes: 2 additions & 98 deletions FFmpegAndroid/build.gradle
Original file line number Diff line number Diff line change
@@ -1,13 +1,7 @@
apply plugin: 'com.android.library'
apply plugin: 'com.github.dcendents.android-maven'
apply plugin: "com.jfrog.bintray"

// This is the library version used when deploying the artifact
version = VERSION_NAME

android {
compileSdkVersion rootProject.ext.compileSdkVersion as Integer
buildToolsVersion rootProject.ext.buildToolsVersion as String

defaultConfig {
minSdkVersion rootProject.ext.minSdkVersion as Integer
Expand All @@ -31,97 +25,7 @@ android {
}

dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])

androidTestCompile 'com.squareup.assertj:assertj-android:1.0.0'
}

group = GROUP

install {
repositories.mavenInstaller {
// This generates POM.xml with proper parameters
pom {
project {
packaging POM_PACKAGING

// Add your description here
name 'FFmpeg Android'
description = POM_DESCRIPTION
url POM_URL

// Set your license
licenses {
license {
name POM_LICENCE_NAME
url POM_LICENCE_URL
}
}
developers {
developer {
id POM_DEVELOPER_ID
name POM_DEVELOPER_NAME
email '[email protected]'
}
}
scm {
connection POM_SCM_URL
developerConnection POM_SCM_URL
url POM_URL

}
}
}
}
}
implementation fileTree(dir: 'libs', include: ['*.jar'])

task sourcesJar(type: Jar) {
from android.sourceSets.main.java.srcDirs
classifier = 'sources'
}

task javadoc(type: Javadoc) {
source = android.sourceSets.main.java.srcDirs
classpath += project.files(android.getBootClasspath().join(File.pathSeparator))
}

task javadocJar(type: Jar, dependsOn: javadoc) {
classifier = 'javadoc'
from javadoc.destinationDir
}
artifacts {
archives javadocJar
archives sourcesJar
}

Properties properties = new Properties()
properties.load(project.rootProject.file('local.properties').newDataInputStream())

// https://github.com/bintray/gradle-bintray-plugin
bintray {
user = properties.getProperty("bintray.user")
key = properties.getProperty("bintray.apikey")

configurations = ['archives']
pkg {
repo = "maven"
// it is the name that appears in bintray when logged
name = "ffmpeg-android"
websiteUrl = POM_URL
vcsUrl = POM_SCM_URL
licenses = ["GPL-3.0"]
publish = true
version {
gpg {
sign = true
passphrase = properties.getProperty("bintray.gpg.password")
}
mavenCentralSync {
sync = true
user = properties.getProperty("bintray.oss.user") //OSS user token
password = properties.getProperty("bintray.oss.password") //OSS user password
close = '1'
}
}
}
androidTestImplementation 'com.squareup.assertj:assertj-android:1.0.0'
}
15 changes: 7 additions & 8 deletions app/build.gradle
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
apply plugin: 'com.android.application'
plugins {
id 'com.android.application'
}

android {
compileSdkVersion rootProject.ext.compileSdkVersion as Integer
buildToolsVersion rootProject.ext.buildToolsVersion as String

defaultConfig {
applicationId "com.github.hiteshsondhi88.sampleffmpeg"
Expand Down Expand Up @@ -31,10 +32,8 @@ android {
}

dependencies {
compile 'com.squareup.dagger:dagger-compiler:1.2.2'
compile 'com.squareup.dagger:dagger:1.2.2'
compile 'com.jakewharton:butterknife:5.1.2'
compile fileTree(dir: 'libs', include: ['*.jar'])
androidTestCompile 'com.squareup.assertj:assertj-android:1.0.0'
compile project(':FFmpegAndroid')
implementation 'com.jakewharton:butterknife:5.1.2'
implementation fileTree(dir: 'libs', include: ['*.jar'])
androidTestImplementation 'com.squareup.assertj:assertj-android:1.0.0'
implementation project(':FFmpegAndroid')
}
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
package com.github.hiteshsondhi88.sampleffmpeg;

import android.app.Instrumentation;
import android.os.Environment;
import android.test.ActivityInstrumentationTestCase2;
import android.util.Log;

import java.io.File;

import javax.inject.Inject;

import com.github.hiteshsondhi88.libffmpeg.FFmpeg;
import com.github.hiteshsondhi88.libffmpeg.FFmpegExecuteResponseHandler;
import com.github.hiteshsondhi88.libffmpeg.FFmpegLoadBinaryResponseHandler;
Expand All @@ -19,7 +18,6 @@ public class FFmpegInstrumentationTest extends ActivityInstrumentationTestCase2<

private static final String TAG = FFmpegInstrumentationTest.class.getSimpleName();

@Inject
FFmpeg ffmpeg;

public FFmpegInstrumentationTest() {
Expand All @@ -30,6 +28,7 @@ public FFmpegInstrumentationTest() {
protected void setUp() throws Exception {
super.setUp();
assertNotNull(getActivity());
ffmpeg = FFmpeg.getInstance(new Instrumentation().getContext());
ffmpeg = getActivity().ffmpeg;
assertNotNull(ffmpeg);
ffmpeg.loadBinary(new FFmpegLoadBinaryResponseHandler() {
Expand Down Expand Up @@ -123,21 +122,23 @@ public void testFFmpegAVItoMP4Usingx264() {

public void testLibass() {
File outass = new File(getFFmpegFilesDir(), "output.ass");
checkFFmpegCommon("-y -i "+getSrtSampleFile()+" "+outass.getAbsolutePath(), outass);
checkFFmpegCommon("-y -i " + getSrtSampleFile() + " " + outass.getAbsolutePath(), outass);
}

private void checkFFmpegConvertUsingx264(File inputFile, File outputFile) {
checkFFmpegCommon("-y -i "+inputFile.getAbsolutePath()+" -c:v libx264 -preset ultrafast "+outputFile.getAbsolutePath(), outputFile);
checkFFmpegCommon("-y -i " + inputFile.getAbsolutePath() + " -c:v libx264 -preset ultrafast " + outputFile.getAbsolutePath(), outputFile);
}

private void checkFFmpegConvertCommon(File inputFile, File outputFile) {
checkFFmpegCommon("-y -i "+inputFile.getAbsolutePath()+" "+outputFile.getAbsolutePath(), outputFile);
checkFFmpegCommon("-y -i " + inputFile.getAbsolutePath() + " " + outputFile.getAbsolutePath(), outputFile);
}

private void checkFFmpegCommon(final String cmd, final File outputFile) {
Log.d(TAG, "start : "+outputFile.getAbsolutePath());
Log.d(TAG, "start : " + outputFile.getAbsolutePath());
try {
ffmpeg.execute(cmd, new FFmpegExecuteResponseHandler() {
String[] array = new String[1];
array[0] = cmd;
ffmpeg.execute(array, new FFmpegExecuteResponseHandler() {

@Override
public void onStart() {
Expand All @@ -146,7 +147,7 @@ public void onStart() {

@Override
public void onProgress(String message) {
Log.d(TAG, "progress : "+message);
Log.d(TAG, "progress : " + message);
}

@Override
Expand All @@ -161,7 +162,7 @@ public void onSuccess(String message) {

@Override
public void onFinish() {
Log.d(TAG, "done : "+outputFile.getAbsolutePath());
Log.d(TAG, "done : " + outputFile.getAbsolutePath());
synchronized (FFmpegInstrumentationTest.this) {
FFmpegInstrumentationTest.this.notify();
}
Expand Down
Loading