forked from github/wulkanowy-mirror
Update dependencies and improve build process (#15)
This commit is contained in:
parent
0ea13cdadd
commit
344ba537fd
94
.circleci/config.yml
Normal file
94
.circleci/config.yml
Normal file
@ -0,0 +1,94 @@
|
||||
version: 2
|
||||
|
||||
references:
|
||||
|
||||
workspace_root: &workspace_root
|
||||
~/wulkanowy
|
||||
|
||||
container_config: &container_config
|
||||
docker:
|
||||
- image: circleci/android:api-25-alpha
|
||||
working_directory: *workspace_root
|
||||
environment:
|
||||
environment:
|
||||
JVM_OPTS: -Xmx3200m
|
||||
|
||||
attach_workspace: &attach_workspace
|
||||
attach_workspace:
|
||||
at: *workspace_root
|
||||
|
||||
general_cache_key: &general_cache_key
|
||||
key: jars-{{ checksum "build.gradle" }}-{{ checksum "app/build.gradle" }}
|
||||
|
||||
jobs:
|
||||
|
||||
build:
|
||||
<<: *container_config
|
||||
steps:
|
||||
- checkout
|
||||
- restore_cache:
|
||||
<<: *general_cache_key
|
||||
- run:
|
||||
name: Setup environment
|
||||
command: ./gradlew --no-daemon --stacktrace dependencies || true
|
||||
- run:
|
||||
name: Initial build
|
||||
command: ./gradlew --no-daemon --stacktrace assembleDebug
|
||||
- store_artifacts:
|
||||
path: ./app/build/outputs/apk/
|
||||
destination: apks/
|
||||
- persist_to_workspace:
|
||||
root: *workspace_root
|
||||
paths:
|
||||
- .
|
||||
- save_cache:
|
||||
<<: *general_cache_key
|
||||
paths:
|
||||
- "~/.gradle"
|
||||
|
||||
lint:
|
||||
<<: *container_config
|
||||
steps:
|
||||
- *attach_workspace
|
||||
- restore_cache:
|
||||
<<: *general_cache_key
|
||||
- run:
|
||||
name: Run lint
|
||||
command: ./gradlew --no-daemon --stacktrace lint
|
||||
- store_artifacts:
|
||||
path: ./app/build/reports/
|
||||
destination: lint_reports/app/
|
||||
|
||||
test:
|
||||
<<: *container_config
|
||||
steps:
|
||||
- *attach_workspace
|
||||
- restore_cache:
|
||||
<<: *general_cache_key
|
||||
- run:
|
||||
name: Run Tests
|
||||
command: ./gradlew --no-daemon --stacktrace test
|
||||
- run:
|
||||
name: Upload code coverage
|
||||
command: ./gradlew --no-daemon --stacktrace codacyUpload
|
||||
- store_artifacts:
|
||||
path: ./app/build/reports/tests/
|
||||
destination: tests_reports/
|
||||
- store_artifacts:
|
||||
path: ./app/build/reports/jacoco/jacocoTestDebugUnitTestReport/
|
||||
destination: coverage_reports/
|
||||
- store_test_results:
|
||||
path: ./app/build/test-results
|
||||
|
||||
workflows:
|
||||
version: 2
|
||||
|
||||
build_check_tests:
|
||||
jobs:
|
||||
- build
|
||||
- lint:
|
||||
requires:
|
||||
- build
|
||||
- test:
|
||||
requires:
|
||||
- build
|
@ -1,35 +1,45 @@
|
||||
image: registry.gitlab.com/showcheap/android-ci:T25-B25.0.2
|
||||
image: circleci/android:api-25-alpha
|
||||
|
||||
before_script:
|
||||
- export GRADLE_USER_HOME=`pwd`/.gradle
|
||||
|
||||
cache:
|
||||
paths:
|
||||
- .gradle/wrapper
|
||||
- .gradle/caches
|
||||
|
||||
build:
|
||||
stage: build
|
||||
cache:
|
||||
key: "v1-$CI_COMMIT_REF_NAME"
|
||||
paths:
|
||||
- .gradle
|
||||
script:
|
||||
- ./gradlew assembleDebug
|
||||
- ./gradlew --no-daemon --stacktrace dependencies || true
|
||||
- ./gradlew --no-daemon --stacktrace assembleDebug
|
||||
- mv app/build/outputs/apk/app-debug.apk .
|
||||
artifacts:
|
||||
name: "${CI_PROJECT_NAME}_${CI_BUILD_REF_NAME}-${CI_BUILD_ID}"
|
||||
paths:
|
||||
- app-debug.apk
|
||||
|
||||
unitTests:
|
||||
tests:
|
||||
stage: test
|
||||
cache:
|
||||
key: "v1-$CI_COMMIT_REF_NAME"
|
||||
paths:
|
||||
- .gradle
|
||||
policy: pull
|
||||
script:
|
||||
- ./gradlew test
|
||||
- ./gradlew --no-daemon --stacktrace test
|
||||
artifacts:
|
||||
paths:
|
||||
- app/build/reports
|
||||
- app/build/reports/tests
|
||||
|
||||
functionalTests:
|
||||
lint:
|
||||
stage: test
|
||||
cache:
|
||||
key: "v1-$CI_COMMIT_REF_NAME"
|
||||
paths:
|
||||
- .gradle
|
||||
policy: pull
|
||||
script:
|
||||
- ./gradlew check
|
||||
- ./gradlew --no-daemon --stacktrace lint
|
||||
artifacts:
|
||||
paths:
|
||||
- app/build/reports
|
||||
|
@ -5,8 +5,6 @@
|
||||
[![Build Status](https://www.bitrise.io/app/daeff1893f3c8128.svg?token=Hjm1ACamk86JDeVVJHOeqQ&branch=master)](https://www.bitrise.io/app/daeff1893f3c8128)
|
||||
[![CircleCI](https://circleci.com/gh/wulkanowy/wulkanowy.svg?style=svg)](https://circleci.com/gh/wulkanowy/wulkanowy)
|
||||
|
||||
[Pobierz wersję rozwojową](https://www.bitrise.io/artifact/1497042/p/52485481a5bc4fe4b4243a87d62a2858)
|
||||
|
||||
[Pobierz zawsze najświeższą kompilację](https://circleci-tkn.rhcloud.com/api/v1/project/wulkanowy/wulkanowy/tree/master/latest/artifacts/app-debug.apk)
|
||||
[Pobierz wersję rozwojową](https://www.bitrise.io/artifact/2280287/p/d79bc4af6825cb9f807b060d67a1c321)
|
||||
|
||||
Wulkanowy to projekt aplikacji na androida ułatwiającej używanie dziennika VULCANa.
|
||||
|
@ -42,6 +42,5 @@ dependencies {
|
||||
compile 'org.apache.commons:commons-collections4:4.1'
|
||||
|
||||
testCompile 'junit:junit:4.12'
|
||||
testCompile 'org.powermock:powermock-api-mockito:1.6.1'
|
||||
testCompile group: 'org.unitils', name: 'unitils-core', version: '3.3'
|
||||
testCompile 'org.mockito:mockito-core:2.8.47'
|
||||
}
|
||||
|
@ -47,6 +47,10 @@ public class StudentAndParent extends Vulcan {
|
||||
.replace("{ID}", getID());
|
||||
}
|
||||
|
||||
public String getGradesPageUrl() {
|
||||
return gradesPageUrl;
|
||||
}
|
||||
|
||||
public String getLocationID() {
|
||||
return locationID;
|
||||
}
|
||||
@ -66,9 +70,7 @@ public class StudentAndParent extends Vulcan {
|
||||
}
|
||||
|
||||
public String getRowDataChildValue(Element e, int index) {
|
||||
Elements es = e.select(".daneWiersz .wartosc");
|
||||
|
||||
return es.get(index - 1).text();
|
||||
return e.select(".daneWiersz .wartosc").get(index - 1).text();
|
||||
}
|
||||
|
||||
public Document getSnPPageDocument(String url) throws IOException {
|
||||
@ -76,7 +78,7 @@ public class StudentAndParent extends Vulcan {
|
||||
}
|
||||
|
||||
public List<Semester> getSemesters() throws IOException {
|
||||
return getSemesters(getSnPPageDocument(gradesPageUrl));
|
||||
return getSemesters(getSnPPageDocument(getGradesPageUrl()));
|
||||
}
|
||||
|
||||
public List<Semester> getSemesters(Document gradesPage) {
|
||||
|
@ -6,7 +6,6 @@ import org.junit.Assert;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.mockito.Mockito;
|
||||
import org.powermock.api.mockito.PowerMockito;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
@ -25,17 +24,15 @@ public class StudentAndParentTest {
|
||||
Document gradesPageDocument = Jsoup.parse(input);
|
||||
|
||||
snp = Mockito.mock(StudentAndParent.class);
|
||||
PowerMockito.whenNew(StudentAndParent.class)
|
||||
.withArguments(Mockito.any(Cookies.class), Mockito.anyString()).thenReturn(snp);
|
||||
|
||||
Mockito.when(snp.getSnPPageDocument(Mockito.anyString())).thenReturn(gradesPageDocument);
|
||||
Mockito.when(snp.getCalculatedID(Mockito.anyString())).thenCallRealMethod();
|
||||
Mockito.when(snp.getLocationID()).thenReturn("symbol");
|
||||
Mockito.when(snp.getID()).thenReturn("123456");
|
||||
Mockito.when(snp.getSemesters()).thenCallRealMethod();
|
||||
Mockito.when(snp.getGradesPageUrl()).thenReturn("http://wulkanowy.null");
|
||||
Mockito.when(snp.getSemesters(Mockito.any(Document.class))).thenCallRealMethod();
|
||||
Mockito.when(snp.getCurrentSemester(Mockito.anyListOf(Semester.class)))
|
||||
.thenCallRealMethod();
|
||||
Mockito.when(snp.getCurrentSemester(Mockito.<Semester>anyList())).thenCallRealMethod();
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -20,7 +20,7 @@ public class GradesTest {
|
||||
Mockito.when(snp.getSnPPageDocument(Mockito.anyString()))
|
||||
.thenReturn(gradesPageDocument);
|
||||
Mockito.when(snp.getSemesters(Mockito.any(Document.class))).thenCallRealMethod();
|
||||
Mockito.when(snp.getCurrentSemester(Mockito.anyListOf(Semester.class)))
|
||||
Mockito.when(snp.getCurrentSemester(Mockito.<Semester>anyList()))
|
||||
.thenCallRealMethod();
|
||||
}
|
||||
}
|
||||
|
35
circle.yml
35
circle.yml
@ -1,35 +0,0 @@
|
||||
machine:
|
||||
environment:
|
||||
ANDROID_HOME: /usr/local/android-sdk-linux
|
||||
ANDROID_NDK: $HOME/android-ndk-r11c
|
||||
ANDROID_NDK_HOME: $ANDROID_NDK
|
||||
PATH: $PATH:$ANDROID_NDK
|
||||
|
||||
dependencies:
|
||||
pre:
|
||||
- wget "https://downloads.gradle.org/distributions/gradle-3.3-bin.zip"; unzip gradle-3.3-bin.zip
|
||||
override:
|
||||
- echo y | android update sdk --no-ui --all --filter tools,platform-tools,build-tools-25.0.3,android-25,extra-google-m2repository,extra-google-google_play_services,extra-android-m2repository
|
||||
# Constraint Layout / [Solver for ConstraintLayout 1.0.0-alpha8, ConstraintLayout for Android 1.0.0-alpha8]
|
||||
- mkdir -p $ANDROID_HOME/licenses/
|
||||
- echo "8933bad161af4178b1185d1a37fbf41ea5269c55" > $ANDROID_HOME/licenses/android-sdk-license
|
||||
- echo "84831b9409646a918e30573bab4c9c91346d8abd" > $ANDROID_HOME/licenses/android-sdk-preview-licens
|
||||
- ANDROID_HOME=/usr/local/android-sdk-linux ./gradlew dependencies
|
||||
|
||||
compile:
|
||||
pre:
|
||||
- ./gradlew --version
|
||||
override:
|
||||
- ./gradlew assembleDebug
|
||||
post:
|
||||
- mv app/build/outputs/apk/app-debug.apk $CIRCLE_ARTIFACTS
|
||||
|
||||
test:
|
||||
override:
|
||||
- ./gradlew test
|
||||
- ./gradlew check
|
||||
- ./gradlew codacyUpload
|
||||
post:
|
||||
- mv app/build/reports/tests/ $CIRCLE_ARTIFACTS/tests
|
||||
- mv app/build/reports/lint-results.html $CIRCLE_ARTIFACTS
|
||||
- mv app/build/reports/jacoco/jacocoTestDebugUnitTestReport/ $CIRCLE_ARTIFACTS/coverage
|
Loading…
Reference in New Issue
Block a user