Skip to content

Commit

Permalink
issue132, issue135, and issue136 - Move to TestLab and CircleCI, add …
Browse files Browse the repository at this point in the history
…tests for sample, and various refactors
  • Loading branch information
isuPatches authored Jun 23, 2019
1 parent a0c589d commit cf7f0f5
Show file tree
Hide file tree
Showing 311 changed files with 17,086 additions and 2,192 deletions.
84 changes: 84 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
version: 2.1

orbs:
codecov: codecov/[email protected]

jobs:
ci_checks:
working_directory: ~/code
docker:
- image: circleci/android:api-28-alpha
environment:
JVM_OPTS: -Xmx3200m
steps:
- checkout
- restore_cache:
key: jars-{{ checksum "build.gradle" }}-{{ checksum "wisefy/build.gradle" }}-{{ checksum "wisefysample/build.gradle" }}
- run:
name: Chmod permissions
command: sudo chmod +x ./gradlew
- run:
name: Download dependencies
command: ./gradlew androidDependencies
- run:
name: Clean build
command: ./gradlew clean assembleDebug wisefy:assembleDebugAndroidTest wisefysample:assembleDebugAndroidTest --stacktrace
- run:
name: Static code analysis
command: ./gradlew staticAnalysisSanityCheck
- run:
name: Unit tests
command: ./gradlew :wisefy:jacocoDebugUnitTest :wisefysample:jacocoDebugUnitTest --stacktrace
- run:
name: Store Service Account
command: echo $GCLOUD_SERVICE_KEY > ${HOME}/gcloud-service-key.json
- run:
name: Firebase Testing
command: |
sudo pip install -U crcmod
sudo gcloud auth activate-service-account --key-file=${HOME}/gcloud-service-key.json
sudo gcloud --quiet config set project ${GOOGLE_PROJECT_ID}
sudo gcloud firebase test android run \
--type instrumentation \
--app wisefysample/build/outputs/apk/debug/wisefysample-debug.apk \
--test wisefy/build/outputs/apk/androidTest/debug/wisefy-debug-androidTest.apk \
--device model=Pixel2,version=28,locale=en,orientation=portrait \
--device model=Nexus6,version=23,locale=en,orientation=portrait \
--device model=Nexus5,version=19,locale=en,orientation=portrait \
--environment-variables coverage=true,coverageFile="/sdcard/coverage.ec" \
--directories-to-pull=/sdcard \
--results-dir=${CIRCLE_BRANCH}_${CIRCLE_BUILD_NUM}
sudo gsutil -m cp -r -U gs://${GCLOUD_BUCKET_LOCATION}/${CIRCLE_BRANCH}_${CIRCLE_BUILD_NUM}/Nexus5-19-en-portrait/artifacts/coverage.ec wisefy/build/outputs/code-coverage/connected/wisefy-Nexus5-sdk19-coverage.ec
sudo gsutil -m cp -r -U gs://${GCLOUD_BUCKET_LOCATION}/${CIRCLE_BRANCH}_${CIRCLE_BUILD_NUM}/Nexus6-23-en-portrait/artifacts/coverage.ec wisefy/build/outputs/code-coverage/connected/wisefy-Nexus6-sdk23-coverage.ec
sudo gsutil -m cp -r -U gs://${GCLOUD_BUCKET_LOCATION}/${CIRCLE_BRANCH}_${CIRCLE_BUILD_NUM}/Pixel2-28-en-portrait/artifacts/coverage.ec wisefy/build/outputs/code-coverage/connected/wisefy-Pixel2-sdk28-coverage.ec
sudo gcloud firebase test android run \
--type instrumentation \
--app wisefysample/build/outputs/apk/debug/wisefysample-debug.apk \
--test wisefysample/build/outputs/apk/androidTest/debug/wisefysample-debug-androidTest.apk \
--device model=Pixel2,version=28,locale=en,orientation=portrait \
--environment-variables coverage=true,coverageFile="/sdcard/coverage.ec" \
--directories-to-pull=/sdcard \
--results-dir=${CIRCLE_BRANCH}_${CIRCLE_BUILD_NUM}
sudo gsutil -m cp -r -U gs://${GCLOUD_BUCKET_LOCATION}/${CIRCLE_BRANCH}_${CIRCLE_BUILD_NUM}/Pixel2-28-en-portrait/artifacts/coverage.ec wisefysample/build/outputs/code-coverage/connected/wisefysample-coverage.ec
sudo gsutil rm -r gs://${GCLOUD_BUCKET_LOCATION}/${CIRCLE_BRANCH}_${CIRCLE_BUILD_NUM}
- run:
name: Generate coverage report
command: ./gradlew :wisefy:jacocoDebugCombinedTestReport :wisefysample:jacocoDebugCombinedTestReport --stacktrace
- codecov/upload:
file: /reports/jacoco/*.xml
- store_artifacts:
path: wisefy/build/reports
destination: reports/wisefy
- store_artifacts:
path: wisefysample/build/reports
destination: reports/wisefysample
- save_cache:
key: jars-{{ checksum "build.gradle" }}-{{ checksum "wisefy/build.gradle" }}-{{ checksum "wisefysample/build.gradle" }}
paths:
- ~/.gradle

workflows:
version: 2
workflow:
jobs:
- ci_checks
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/bug-report.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ about: Create a report to help us improve

Thank you for creating an issue to improve this library! Please check Please check [the current issues](https://github.com/isuPatches/WiseFy/issues) to make sure that the improvement isn't already being worked on.

It will be _EXTREMELY_ helpful if you also take a look at the [sample app](/wisefysample) to see how it behalves and if you can reproduce there.
It will be _EXTREMELY_ helpful if you also take a look at the [sample app](/wisefysample) to see how it behaves and if you can reproduce there.

**Description**
A clear and concise description of the bug.
Expand Down
3 changes: 3 additions & 0 deletions .idea/dictionaries/patches.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

27 changes: 0 additions & 27 deletions .travis.yml

This file was deleted.

20 changes: 13 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,14 @@ Wifi configuration and util library built for Android.
- Update to gradle 5.x
- Static analysis tools updated
- WEP is now deprecated due to security and other issues with this network type and will be phased out
- Introduction of [RoboElectric](https://github.com/robolectric/robolectric) for better unit testing
- This may be controversial, but please check this [issue](https://github.com/isuPatches/WiseFy/issues/133) for rationale
- Better naming for some saved network functions
- GetSavedNetworkCallbacks renamed SearchForSavedNetworkCallbacks
- Added SearchForSavedNetworksCallbacks
- getSavedNetwork(regex: String?): List<WifiConfiguration>? refactored to searchForSavedNetwork(regexForSSID: String?): WifiConfiguration?
- getSavedNetwork(regexForSSID: String?, callbacks: GetSavedNetworkCallbacks?) refactored to searchForSavedNetwork(regexForSSID: String?, callbacks: SearchForSavedNetworkCallbacks?)
- getSavedNetworks(regexForSSID: String?, callbacks: GetSavedNetworksCallbacks?) refactored to searchForSavedNetworks(regexForSSID: String?, callbacks: SearchForSavedNetworksCallbacks?)
- Moved from TravisCI to CircleCI
- Instrumentation tests are now run on Google's Firebase TestLab
- Removal of Checkstyle and FindBugs since project is no longer Java
- Removal of GCM support due to GCM being sunset
- New [sample app](/wisefysample) included as part of the repo
Expand Down Expand Up @@ -146,12 +152,12 @@ wisefy.dump();
For the sake of transparency and because you're probably curious as to what permissions this library adds to your app, here are the additional expected permissions:

```xml
<uses-permission android:name="android.permission.CHANGE_WIFI_STATE"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE"/>
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE"/>
<uses-permission android:name="android.permission.CHANGE_WIFI_STATE"/>

<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>

<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
```

<strong> * NOTE * </strong>
Expand Down
9 changes: 4 additions & 5 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
buildscript {
project.ext {
agp_version = '3.4.0'
agp_version = '3.4.1'
bintray_version = '1.8.4'
cpd_version = '2.0-SNAPSHOT'
cpd_version = '2.0'
dokka_version = '0.9.18'
dexcount_version = '0.8.5'
jacoco_version = '0.8.3'
Expand All @@ -14,7 +14,6 @@ buildscript {
jcenter()
google()
maven { url "https://plugins.gradle.org/m2/" }
maven { url "https://oss.sonatype.org/content/repositories/snapshots/" }
}

dependencies {
Expand All @@ -25,7 +24,6 @@ buildscript {
classpath "com.getkeepsafe.dexcount:dexcount-gradle-plugin:$dexcount_version"
classpath "de.aaschmid:gradle-cpd-plugin:$cpd_version"


// Code Coverage
classpath "org.jacoco:org.jacoco.core:$jacoco_version"
classpath "org.jacoco:org.jacoco.agent:$jacoco_version"
Expand Down Expand Up @@ -141,7 +139,8 @@ task makeGoodChoices {

outputs.upToDateWhen { false }

dependsOn 'staticAnalysisSanityCheck', ':wisefy:jacocoDebugUnitTest'
dependsOn 'staticAnalysisSanityCheck',
':wisefy:jacocoDebugUnitTest', ':wisefysample:jacocoDebugUnitTest'
doLast {
println "\n#############################################" +
"\n# All checks passed! You are doing so good! #" +
Expand Down
32 changes: 32 additions & 0 deletions changes/3.x.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,35 @@
## v3.0.1 - 09/15/2018

#### Update README.md to use implementation
commit de9f9c4690f7efa468a5211282f9a19cd6e109cc<br/>
Author: Chintan Rathod <[email protected]><br/>
Date: Sun Apr 21 19:45:20 2019 +0530

#### Delete -verbose, -dontobfuscate
commit 95e3b8d1d2609822d0eb12aa3fa5f4c408977a4a<br/>
Author: Jungwook Park (Victor) <[email protected]><br/>
Date: Sun Nov 4 12:20:21 2018 +0900

#### issue-113 & issue-114 Update dependencies and adjust manifest
commit 07a93f06f9ad6efa05245cfa426d1551c024586b<br/>
Author: Patches <[email protected]><br/>
Date: Sat Sep 15 12:07:14 2018 -0500

#### Update README.md
commit 491a53d8014a1211e74d222c6d165d8fd450de3b<br/>
Author: Patches <[email protected]><br/>
Date: Sat Sep 8 14:37:47 2018 -0500

#### Add new logo/icon
commit 2dda2fe8409f63ad1400093ebde56ca842c8608d<br/>
Author: mansyaprime <[email protected]><br/>
Date: Sun Sep 9 02:35:50 2018 +0700

#### Update 3.x changes for release
commit 1331e9f9e929405f5050b9419dc0986427adb201<br/>
Author: isuPatches <[email protected]><br/>
Date: Sun Aug 19 18:57:25 2018 -0500

## v3.0.0 - 08/19/2018

#### Enable XML for CodeCov
Expand Down
3 changes: 2 additions & 1 deletion changes/4.x.md
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
## v4.0.0 - 05/x/2019
## v4.0.0 - 06/22/2019

2 changes: 1 addition & 1 deletion codecov.yml
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
codecov:
branch: 3.x
branch: 4.x
30 changes: 0 additions & 30 deletions config/checkstyle/import-control.xml

This file was deleted.

3 changes: 1 addition & 2 deletions config/detekt-config.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
autoCorrect: true
failFast: false

test-pattern: # Configure exclusions for test sources
active: true
Expand Down Expand Up @@ -338,7 +337,7 @@ style:
UnusedImports:
active: true
ExpressionBodySyntax:
active: true
active: false
NestedClassesVisibility:
active: true
RedundantVisibilityModifierRule:
Expand Down
2 changes: 1 addition & 1 deletion documentation/adding_and_removing_networks.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ To remove a configured network:
_With Kotlin_

```kotlin
val removedSuccessfully = wisefy.removeNetwork("SSID to remove");
val removedSuccessfully = wisefy.removeNetwork("SSID to remove")
```

_With Java_
Expand Down
12 changes: 6 additions & 6 deletions documentation/checking_device_connectivity.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ To check and see if the device is connected to a mobile network:
_With Kotlin_

```Kotlin
val isConnected = wisefy.isDeviceConnectedToMobileNetwork();
val isConnected = wisefy.isDeviceConnectedToMobileNetwork()
```

_With Java_
Expand All @@ -19,7 +19,7 @@ To check and see if the device is connected to a mobile or wifi network:
_With Kotlin_

```kotlin
val isConnected = wisefy.isDeviceConnectedToMobileOrWifiNetwork();
val isConnected = wisefy.isDeviceConnectedToMobileOrWifiNetwork()
```

_With Java_
Expand All @@ -33,7 +33,7 @@ To check and see if the device is connected to a given SSID:
_With Kotlin_

```kotlin
val isConnected = wisefy.isDeviceConnectedToSSID("SSID");
val isConnected = wisefy.isDeviceConnectedToSSID("SSID")
```

_With Java_
Expand All @@ -47,7 +47,7 @@ To check and see if the device is connected to a wifi network:
_With Kotlin_

```kotlin
val isConnected = wisefy.isDeviceConnectedToWifiNetwork();
val isConnected = wisefy.isDeviceConnectedToWifiNetwork()
```

_With Java_
Expand All @@ -61,7 +61,7 @@ To check and see if the device is roaming:
_With Kotlin_

```kotlin
val isDeviceRoaming = wisefy.isDeviceRoaming();
val isDeviceRoaming = wisefy.isDeviceRoaming()
```

_With Java_
Expand All @@ -75,7 +75,7 @@ To check and see if Wifi is enabled on a device:
_With Kotlin_

```kotlin
boolean wifiEnabled = wisefy.isWifiEnabled();
boolean wifiEnabled = wisefy.isWifiEnabled()
```

_With Java_
Expand Down
4 changes: 2 additions & 2 deletions documentation/connecting_and_disconnecting_from_networks.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ To connect to a network given an SSID:
_With Kotlin_

```kotlin
val connectedSuccessfully = wisefy.connectToNetwork("SSID to connect to", 3000);
val connectedSuccessfully = wisefy.connectToNetwork("SSID to connect to", 3000)
```

_With Java_
Expand All @@ -19,7 +19,7 @@ To disconnect from current network:
_With Kotlin_

```kotlin
val disconnectedSuccessfully = wisefy.disconnectFromCurrentNetwork();
val disconnectedSuccessfully = wisefy.disconnectFromCurrentNetwork()
```

_With Java_
Expand Down
2 changes: 1 addition & 1 deletion documentation/nearby_access_points.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ To search for an access point given a regex (will return first match):<br/><br/>
_With Kotlin_

```kotlin
val wisefy.searchForAccessPoint("regex for SSID", 3000, true);
val wisefy.searchForAccessPoint("regex for SSID", 3000, true)
```

_With Java_
Expand Down
Loading

0 comments on commit cf7f0f5

Please sign in to comment.