Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
855b5e6
DPC-285 - Use Android Version 7, 10 and 11 to CI functional testing
jcsmor Apr 15, 2021
e1f4fda
Merge branch 'DPC-285-Use-Android-7,10,11-CI-funcional-testing' into …
spacifici Apr 15, 2021
a8382dd
Merge branch 'master' into 'develop'
Apr 19, 2021
70338d1
Noissue - Restoring ci configuration to before master was merged on
spacifici Apr 19, 2021
1f6453d
Merge branch 'noissue-restore-ci-conf' into 'develop'
spacifici Apr 20, 2021
480890f
DPC-20 - Publish libadblockplus-android builds to a Gitlab.com maven …
Apr 23, 2021
50dc2f9
Merge branch 'issue-dpc-20' into 'develop'
Apr 23, 2021
af2dd44
Noissue - Fixed README.md wording and naming
Apr 26, 2021
8049ddf
Merge branch 'noissue-fix-wording' into 'develop'
Apr 27, 2021
e518e74
DPC-255 - Document allowlisting counter
Apr 27, 2021
024a946
Merge branch 'issue-dpc-255' into 'develop'
Apr 27, 2021
9ddc88a
DPC-302 - CI file with logic to run different tasks per branch
jcsmor Apr 27, 2021
38f6367
Merge branch 'DPC-302-CI_file_to_run_different_tasks_per_branch' into…
jcsmor Apr 27, 2021
6814723
Noissue: Adding Android 9 and 11 to the master branch jobs
spacifici May 7, 2021
085f395
Merge branch 'noissue-master-extra-platforms' into 'develop'
spacifici May 7, 2021
3901af9
Correct path to libadblockplus submodule
eyeojeff May 19, 2021
2140ddc
Merge branch 'fixup-submodules' into 'develop'
eyeojeff May 19, 2021
c30c0f0
noissue - Update PLT benchmark
May 24, 2021
b9a234e
Noissue - Subscriptions update
May 26, 2021
1879368
Merge branch 'noissue-subscription-updates' into 'develop'
May 26, 2021
f45eef8
Merge branch 'noissue-update-PLT-benchmark' into 'develop'
May 28, 2021
ec822af
DPC-349 - Configure appium tests to run on local device farm using PL…
jcsmor May 28, 2021
4ba9c98
Merge branch 'dpc-349-device-farm-plt-task' into 'develop'
jcsmor May 28, 2021
8c1d532
DPC-332 - Memory benchmarking `adblock_enabled` state reports wrong v…
tymicki Jun 1, 2021
b16fd24
Merge branch 'issue-dpc-332' into 'develop'
Jun 2, 2021
a4880eb
Noissue - Fixed RequestInterceptor#checkModifications
Jun 7, 2021
0e04536
Merge branch 'noissue-fixed-checkModifications' into 'develop'
Jun 7, 2021
e6e02ac
DPC-10 - Tabs are not restored on Android 6 and 10
Jun 8, 2021
d0c8f8a
Merge branch 'issue-dpc-10' into 'develop'
Jun 8, 2021
0f89237
noissue-fix-ci-for-plt_tests
jcsmor Jun 14, 2021
1a18216
Merge branch 'noissue-fix-ci-for-plt_tests' into 'develop'
jcsmor Jun 14, 2021
ba526b3
DPC-12 - Download file feature is not working
Jun 17, 2021
9bbaf04
Merge branch 'dpc-12_download_file_feature_is_not_working' into 'deve…
Jun 17, 2021
ef17217
DPC-475-Update-automation-to-use-new-Saucelabs
jcsmor Sep 23, 2021
103d51c
Merge branch 'DPC-475-Update-automation-to-use-new-Saucelabs' into 'd…
jcsmor Sep 23, 2021
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
149 changes: 73 additions & 76 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,10 +54,10 @@ checkstyle:
- sed -i -e "s|$(pwd)/./||g" checkstyle-report.xml
# Convert the checkstyle output to code-climate format so gitlab can parse it
- |
violations-command-line \
-detail-level COMPACT \
-code-climate code-climate-report.json \
--violations "CHECKSTYLE" "$(pwd)" ".*checkstyle-report.xml" "Checkstyle"
violations-command-line \
-detail-level COMPACT \
-code-climate code-climate-report.json \
--violations "CHECKSTYLE" "$(pwd)" ".*checkstyle-report.xml" "Checkstyle"
artifacts:
reports:
codequality:
Expand Down Expand Up @@ -240,23 +240,25 @@ testobject_tests:
reports:
junit: test-results/*/philll-adblockwebview-app-*.xml

# automated regression tests using Appium
automated_tests:
# automated regression tests template using Appium
.template_automation:
stage: device_tests
interruptible: true
retry: 1
variables:
GIT_STRATEGY: "none"
# overridable automation repo; url uses CI_JOB_TOKEN for temporary authorization
GIT_AUTOMATION_REPO: "https://gitlab-ci-token:${CI_JOB_TOKEN}@gitlab.com/eyeo/sandbox/abp-webview-test-automation"
# demo app debug apk
GIT_AUTOMATION_BRANCH: "master"
PLATFORM_VERSIONS: "10"
# demo app debug apk
TEST_APK: "adblock-android-webviewapp/build/outputs/apk/debug/adblock-android-webviewapp-debug.apk"
script:
# TESTOBJ_PROJECT_KEY should exist, testing it
- test -z ${TESTOBJ_PROJECT_KEY} && echo "echo TESTOBJ_PROJECT_KEY not set. Unable to run tests." && exit 1
before_script:
- find . -iname "*.apk"
- test -z ${SAUCE_USERNAME} && echo "echo SAUCE_USERNAME not set. Unable to run tests." && exit 1
- test -z ${SAUCE_ACCESS_KEY} && echo "echo SAUCE_ACCESS_KEY not set. Unable to run tests." && exit 1
- curl -v -u "${SAUCE_USERNAME}:${SAUCE_ACCESS_KEY}" --location --request POST 'https://api.eu-central-1.saucelabs.com/v1/storage/upload' --form 'payload=@"adblock-android-webviewapp/build/outputs/apk/debug/adblock-android-webviewapp-debug.apk"' --form 'name="adblock-android-webviewapp-debug.apk"'
# we are not using submodules, because automation is not a part of repository functionality
script:
# its rather a standalone set of scripts
- git clone $GIT_AUTOMATION_REPO automation
- cd automation
Expand All @@ -267,8 +269,8 @@ automated_tests:
- |
for PLATFORM_VERSION in $PLATFORM_VERSIONS
do export PLATFORM_VERSION
echo "Starting job for version ${PLATFORM_VERSION}"
(./gradlew automatedTesting &> platform_version-${PLATFORM_VERSION}.log ; echo $? > result_${PLATFORM_VERSION}) &
echo Starting job for version ${PLATFORM_VERSION}
(./gradlew ${GRADLE_TASK} &> platform_version-${PLATFORM_VERSION}.log ; echo $? > result_${PLATFORM_VERSION}) &
pids="$pids $!"
done
- wait $pids
Expand Down Expand Up @@ -304,78 +306,77 @@ automated_tests:
reports:
junit: "automation/target/cucumber-reports/*.xml"
paths:
- "automation/tag-*.log"
- "automation/platform_version-*.log"
- "automation/result_*"

# automated functional tests using Appium
functional_tests:
only:
- schedules
- web
master_autojob:
extends: .template_automation
variables:
PLATFORM_VERSIONS: "7 10 11"
GRADLE_TASK: "automatedTesting"
rules:
- if: '$FORCE_MASTER == "true"'
- if: '$CI_MERGE_REQUEST_TARGET_BRANCH_NAME == "master"'

dev_regression_autojob:
extends: .template_automation
variables:
PLATFORM_VERSIONS: "10"
GRADLE_TASK: "regression"
# Commenting Rules, webview CI having issues running develop branch with them
# rules:
# - if: '$FORCE_REGRESSION == "true"'
# - if: '$CI_MERGE_REQUEST_TARGET_BRANCH_NAME == "develop"'

dev_functional_autojob:
extends: .template_automation
variables:
PLATFORM_VERSIONS: "7 10 11"
GRADLE_TASK: "functional"
rules:
- if: '$FORCE_FUNCTIONAL == "true"'
- if: '$CI_COMMIT_BRANCH == "develop" && $CI_PIPELINE_SOURCE == "schedule"'

plt_tests:
stage: device_tests
interruptible: true
tags:
- "ce11171b5399805a0c"
retry: 1
image: "registry.gitlab.com/eyeo/docker/appium:1.16.0"
variables:
GIT_STRATEGY: "none"
# overridable automation repo; url uses CI_JOB_TOKEN for temporary authorization
PLATFORM_VERSIONS: "10"
GIT_AUTOMATION_REPO: "https://gitlab-ci-token:${CI_JOB_TOKEN}@gitlab.com/eyeo/sandbox/abp-webview-test-automation"
# demo app debug apk
GIT_AUTOMATION_BRANCH: "master"
PLATFORM_VERSIONS: "9 10 11"
# demo app debug apk
TEST_APK: "adblock-android-webviewapp/build/outputs/apk/debug/adblock-android-webviewapp-debug.apk"
TEST_APK: "../adblock-android-webviewapp/build/outputs/apk/debug/adblock-android-webviewapp-debug.apk"
before_script:
- apt-get -y update
- apt-get -y install openjdk-8-jdk git
- if [ "${ANDROID_KEY_FILE}" ] ; then cp -f ${ANDROID_KEY_FILE} ~/.android/adbkey; fi
- if [ "${ANDROID_KEY_PUB_FILE}" ] ; then cp -f ${ANDROID_KEY_PUB_FILE} ~/.android/adbkey.pub; fi
- curl -u "${SAUCE_USERNAME}:${SAUCE_ACCESS_KEY}" --location --request POST 'https://api.eu-central-1.saucelabs.com/v1/storage/upload'
--form 'payload=@adblock-android-webviewapp/build/outputs/apk/debug/adblock-android-webviewapp-debug.apk'
--form 'name="${TEST_APK}"'
script:
# TESTOBJ_PROJECT_KEY should exist, testing it
- test -z ${TESTOBJ_PROJECT_KEY} && echo "echo TESTOBJ_PROJECT_KEY not set. Unable to run tests." && exit 1
# we are not using submodules, because automation is not a part of repository functionality
# its rather a standalone set of scripts
- CHROMEDRIVER_AUTODOWNLOAD=true /root/entry_point.sh &> appium.log &
- echo $! > appium_pid
- git clone $GIT_AUTOMATION_REPO automation
- cd automation
- git checkout ${GIT_AUTOMATION_BRANCH:-master}
# Launch an instance of gradle for each bunch of tags we want to test
- set +e
- pids=""
- |
for PLATFORM_VERSION in $PLATFORM_VERSIONS
do export PLATFORM_VERSION
echo Starting job for version ${PLATFORM_VERSION}
(./gradlew functional &> platform_version-${PLATFORM_VERSION}.log ; echo $? > result_${PLATFORM_VERSION}) &
pids="$pids $!"
done
- wait $pids
# Check for any failures and re-run them
- |
for PLATFORM_VERSION in $PLATFORM_VERSIONS
do if [ -s target/rerun${PLATFORM_VERSION}.txt ] ; then
echo "Rerunning failed test cases for platform version ${PLATFORM_VERSION}"
mv target/rerun${PLATFORM_VERSION}.txt target/rerun.txt
./gradlew rerunFailed
echo $? > result_${PLATFORM_VERSION}
rm -f target/rerun.txt
fi
done
# check the exit codes of all processes were 0
- |
for PLATFORM_VERSION in $PLATFORM_VERSIONS
do test $(cat result_${PLATFORM_VERSION}) = 0
done
after_script:
- cd automation
- |
for PLATFORM_VERSION in $PLATFORM_VERSIONS
do
echo "**********************************"
echo "Logs for tests with platform_version ${PLATFORM_VERSION}"
echo "**********************************"
cat platform_version-${PLATFORM_VERSION}.log
done
- APPIUM_HOST="localhost:4723" ./gradlew pltWebview
rules:
- if: '$FORCE_PLT == "true"'
#- if: '$CI_COMMIT_BRANCH == "develop" && $CI_PIPELINE_SOURCE == "schedule"'
#- if: '$CI_COMMIT_BRANCH == "develop" && $CI_PIPELINE_SOURCE == "manual"'
artifacts:
when: always
expire_in: 6 months
reports:
junit: "automation/target/cucumber-reports/*.xml"
paths:
- "automation/platform_version-*.log"
- "automation/result_*"
- "automation/plt/webviewPLT.json"
- "appium.log"

# FilterEngine performance benchmarking and memory
benchmark:
Expand Down Expand Up @@ -409,18 +410,14 @@ benchmark:
stage: publish
<<: *cache_readonly
script:
- |
if [ -z "${BINTRAY_USERNAME}" ] || [ -z "${BINTRAY_KEY}" ] ; then
echo "BINTRAY_USERNAME and BINTRAY_KEY need to be set for publishing to work"
echo "Make sure this is running on a protected branch/tag to get those variables set"
fi
- |
if [[ ${DRY_RUN:-true} == "true" ]] ; then
echo 'Note: $DRY_RUN is currently "true", run pipeline manually and set to "false" to actually publish to bintray'
echo 'Note: $DRY_RUN is currently "true", run pipeline manually and set to "false" to actually publish to gitlab'
else
./gradlew publish
fi
- ./gradlew bintrayUpload -PbintrayUser=${BINTRAY_USERNAME:-unset} -PbintrayKey=${BINTRAY_KEY:-unset} -PdryRun=${DRY_RUN:-true}

publish_rc_to_bintray:
publish_rc_to_gitlab:
<<: *publish_template
only:
variables:
Expand All @@ -430,7 +427,7 @@ publish_rc_to_bintray:
# Append '-rcX' to the version to publish
- sed -i -e "/moduleVersion/s/'$/-rc${RC}'/g" build.gradle

publish_to_bintray:
publish_to_gitlab:
<<: *publish_template
stage: publish
only:
Expand Down
2 changes: 1 addition & 1 deletion .gitmodules
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
[submodule "libadblockplus"]
path = libadblockplus
url = ../libadblockplus.git
url = ../../adblockplus/libadblockplus.git
48 changes: 36 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
[ ![adblock-android](https://img.shields.io/bintray/v/adblockplus/maven/adblock-android?label=adblock-android) ](https://bintray.com/adblockplus/maven/adblock-android/_latestVersion)
[ ![adblock-android-webview](https://img.shields.io/bintray/v/adblockplus/maven/adblock-android-webview?label=adblock-android-webview) ](https://bintray.com/adblockplus/maven/adblock-android-webview/_latestVersion)
[ ![adblock-android-settings](https://img.shields.io/bintray/v/adblockplus/maven/adblock-android-settings?label=adblock-android-settings) ](https://bintray.com/adblockplus/maven/adblock-android-settings/_latestVersion)

Adblock Android SDK
================================

Expand All @@ -22,7 +18,15 @@ You can find it in the 'adblock-android' directory.

### Using as a Gradle dependency

Make sure you have `jcenter()` in the list of repositories and then add the following dependency:
Make sure you have:

```groovy
maven {
url 'https://gitlab.com/api/v4/projects/8817162/packages/maven'
}
```

in the list of repositories and then add the following dependencies:

```groovy
dependencies {
Expand Down Expand Up @@ -202,11 +206,19 @@ You can select the test class/method and click 'Run ..Test'.
An Android library that provides a configuration interface for Adblock Plus.
You can find it in the 'adblock-android-settings' directory:
* GeneralSettingsFragment - main fragment
* WhitelistedDomainsSettingsFragment - whitelisted domains fragment
* AllowlistedDomainsSettingsFragment - allowlisted domains fragment

### Using as a Gradle dependency

Make sure you have `jcenter()` in the list of repositories and then add the following dependency:
Make sure you have:

```groovy
maven {
url 'https://gitlab.com/api/v4/projects/8817162/packages/maven'
}
```

in the list of repositories and then add the following dependency:

```groovy
dependencies {
Expand Down Expand Up @@ -262,7 +274,7 @@ Implement the following interfaces in your settings activity:

* `BaseSettingsFragment.Provider`
* `GeneralSettingsFragment.Listener`
* `WhitelistedDomainsSettingsFragment.Listener`
* `AllowlistedDomainsSettingsFragment.Listener`

and return created instance or AdblockHelper instances:

Expand Down Expand Up @@ -403,7 +415,15 @@ You can find it in the 'adblock-android-webview' directory.

### Using as a Gradle dependency

Make sure you have `jcenter()` in the list of repositories and then add the following dependency:
Make sure you have:

```groovy
maven {
url 'https://gitlab.com/api/v4/projects/8817162/packages/maven'
}
```

in the list of repositories and then add the following dependency:

```groovy
dependencies {
Expand Down Expand Up @@ -467,7 +487,7 @@ The simplest solution is to use `AdblockHelper` from `-settings` as an external

If the adblock engine provider is not set, it's created by the AdblockWebView instance automatically.

Use `setSiteKeysConfiguration(..)` to support sitekeys whitelisting.
Use `setSiteKeysConfiguration(..)` to support sitekeys allowlisting.
This is optional but highly suggested. See `TabFragment.java` on usage example.

Please note that the AdblockWebView does intercept some of the HTTP(S) requests done by the subclassed WebView and does them internally by means of `java.net.HttpURLConnection`.
Expand All @@ -480,10 +500,14 @@ This is an optional feature that rewrites the HTML content under the hood in ord
This feature also requires `setSiteKeysConfiguration(..)` to be called beforehand, otherwise, an IllegalStateException is thrown.
See `TabFragment.java` on usage example.

Use `setEventsListener()` to subscribe and unsubscribe to ad blocking and whitelisting events, eg.
"resource loading blocked" or "resource loading whitelisted" event that can be used for stats.
Use `setEventsListener()` to subscribe and unsubscribe to ad blocking and allowlisting events, eg.
"resource loading blocked" or "resource loading allowlisted" event that can be used for stats.
For the latter, there is a convenience class `WebViewCounters` which can be bound to `EventsListener`
and notify your View about new values. See an example of usage in WebView Application.
Blocking and allowlisting events are fired only for blocking and allowing network request events
and not for element hiding. Allowing network request event is triggered when there is a corresponding
allowlisting filter for an url, no matter if it is an Acceptable Ads filter or any other filter,
including a custom domain allowlisting filter.

Use `dispose(Runnable disposeFinished)` to release resources (**required**).
Note it can be invoked from the background thread.
Expand Down
Loading