This repository has been archived by the owner on Jun 14, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit dc2a612
Showing
108 changed files
with
4,117 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,217 @@ | ||
version: 2 | ||
|
||
references: | ||
|
||
## Cache | ||
|
||
cache_key: &cache_key | ||
key: cache-{{ checksum "settings.gradle" }}-{{ checksum "./gradle/wrapper/gradle-wrapper.properties" }}-{{ checksum "build.gradle" }}-{{ checksum "./app/build.gradle" }} | ||
restore_cache: &restore_cache | ||
restore_cache: | ||
<<: *cache_key | ||
save_cache: &save_cache | ||
save_cache: | ||
<<: *cache_key | ||
paths: | ||
- ./.gradle | ||
- ~/.gradle | ||
- ~/.m2 | ||
|
||
## Workspace | ||
workspace: &workspace | ||
~/workspace | ||
|
||
attach_workspace: &attach_workspace | ||
attach_workspace: | ||
at: *workspace | ||
persist_workspace: &persist_workspace | ||
persist_to_workspace: | ||
root: *workspace | ||
paths: | ||
- app/build/intermediates | ||
- app/build/jacoco | ||
- app/build/outputs/androidTest-results | ||
- app/build/outputs/apk | ||
- app/build/outputs/code-coverage | ||
- app/build/test-results | ||
- firebase | ||
|
||
## Docker image configuration | ||
|
||
config: &config | ||
working_directory: *workspace | ||
docker: | ||
- image: circleci/android:api-29 | ||
environment: | ||
TERM: dumb | ||
_JAVA_OPTIONS: "-Dfile.encoding=UTF8 -Xverify:none -Xmx1536m -XX:+UnlockExperimentalVMOptions -XX:+UseCGroupMemoryLimitForHeap" | ||
|
||
## Keys | ||
|
||
# Android key store | ||
|
||
decode_android_key: &decode_android_key | ||
run: | ||
name: Decode Android key store | ||
command: echo $ANDROID_KEY_STORE | base64 -di > app/key-store.jks | ||
|
||
# Google Services key | ||
|
||
decode_google_services_key: &decode_google_services_key | ||
run: | ||
name: Decode Google Services key | ||
command: echo $GOOGLE_SERVICES_KEY | base64 -di > app/google-services.json | ||
|
||
# GCP service account key | ||
|
||
decode_gcloud_key: &decode_gcloud_key | ||
run: | ||
name: Decode GCP service account key | ||
command: echo $GCP_SERVICE_ACCOUNT_KEY | base64 -di > client-secret.json | ||
|
||
jobs: | ||
|
||
assemble: | ||
<<: *config | ||
steps: | ||
- checkout | ||
- *restore_cache | ||
- *decode_google_services_key | ||
- run: | ||
name: Download dependencies | ||
command: ./gradlew androidDependencies | ||
- run: | ||
name: Compile | ||
command: ./gradlew assembleDebug assembleDebugAndroidTest | ||
- *save_cache | ||
- *persist_workspace | ||
- store_artifacts: | ||
path: app/build/outputs/apk/debug | ||
destination: /apk/ | ||
- store_artifacts: | ||
path: app/build/outputs/apk/androidTest/debug | ||
destination: /apk/ | ||
|
||
check: | ||
<<: *config | ||
steps: | ||
- checkout | ||
- *restore_cache | ||
- *decode_google_services_key | ||
- run: | ||
name: Check code quality | ||
command: ./gradlew lint | ||
- store_artifacts: | ||
path: app/build/reports/lint-results.html | ||
destination: /check/lint-results.html | ||
- run: | ||
name: Check code quality | ||
command: ./gradlew check checkstyle | ||
- store_artifacts: | ||
path: app/build/reports/checkstyle | ||
destination: /check/ | ||
|
||
test_unit: | ||
<<: *config | ||
steps: | ||
- checkout | ||
- *restore_cache | ||
- *decode_google_services_key | ||
- run: | ||
name: Execute unit tests | ||
command: ./gradlew testDebugUnitTest | ||
- store_test_results: | ||
path: app/build/test-results | ||
- store_artifacts: | ||
path: app/build/reports/tests/testDebugUnitTest | ||
destination: /test/ | ||
|
||
test_instrumented: | ||
<<: *config | ||
steps: | ||
- *attach_workspace | ||
- *decode_google_services_key | ||
- *decode_gcloud_key | ||
- run: | ||
name: Set GCP target project | ||
command: gcloud --quiet config set project $GCP_PROJECT_ID | ||
- run: | ||
name: Authenticate with GCP | ||
command: gcloud auth activate-service-account $GCP_SERVICE_ACCOUNT@$GCP_PROJECT_ID.iam.gserviceaccount.com --key-file client-secret.json | ||
- run: | ||
name: Run instrumented tests on Firebase Test Lab | ||
command: gcloud firebase test android run --type instrumentation --app app/build/outputs/apk/debug/app-debug.apk --test app/build/outputs/apk/androidTest/debug/app-debug-androidTest.apk --device model=$TEST_DEVICE,version=$TEST_API_VERSION,locale=$TEST_LOCALE,orientation=$TEST_ORIENTATION --environment-variables coverage=true,coverageFile=/sdcard/tmp/code-coverage/connected/coverage.ec --directories-to-pull=/sdcard/tmp --timeout 15m | ||
- run: | ||
name: Create directory to store test results | ||
command: mkdir -p app/build/outputs/code-coverage/debugAndroidTest/connected/$TEST_DEVICE-$TEST_API_VERSION-$TEST_LOCALE-$TEST_ORIENTATION | ||
- run: | ||
name: Download instrumented test results from Firebase Test Lab | ||
command: gsutil -m cp -r -U `gsutil ls gs://$GCP_BUCKET_NAME | tail -1`$TEST_DEVICE-$TEST_API_VERSION-$TEST_LOCALE-$TEST_ORIENTATION/artifacts/coverage.ec app/build/outputs/code-coverage/debugAndroidTest/connected/$TEST_DEVICE-$TEST_API_VERSION-$TEST_LOCALE-$TEST_ORIENTATION/coverage.ec | ||
- *persist_workspace | ||
|
||
report_coverage: | ||
<<: *config | ||
steps: | ||
- checkout | ||
- *restore_cache | ||
- *attach_workspace | ||
- *decode_google_services_key | ||
- *decode_gcloud_key | ||
- run: | ||
name: Generate coverage report | ||
command: ./gradlew jacocoTestReport | ||
- store_artifacts: | ||
path: app/build/reports/jacoco/jacocoTestReport | ||
destination: /coverage/ | ||
- run: | ||
name: Upload coverage report to CodeCov | ||
command: bash <(curl -s https://codecov.io/bash) | ||
- run: | ||
name: Upload coverage report to SonarCloud | ||
command: CI=false ./gradlew sonarqube -Dsonar.projectKey=ayltai_price-calculator -Dsonar.organization=ayltai -Dsonar.host.url=https://sonarcloud.io -Dsonar.login=$SONAR_TOKEN | ||
|
||
build: | ||
<<: *config | ||
steps: | ||
- checkout | ||
- *restore_cache | ||
- *decode_android_key | ||
- *decode_google_services_key | ||
- run: | ||
name: Generate artifact | ||
command: ./gradlew assembleRelease | ||
- *save_cache | ||
- store_artifacts: | ||
path: app/build/outputs/apk/release | ||
destination: /apk/ | ||
- store_artifacts: | ||
path: app/build/outputs/mapping/release | ||
destination: /mapping/ | ||
|
||
workflows: | ||
version: 2 | ||
workflow: | ||
jobs: | ||
- assemble | ||
- check: | ||
requires: | ||
- assemble | ||
- test_unit: | ||
requires: | ||
- assemble | ||
- test_instrumented: | ||
requires: | ||
- assemble | ||
- report_coverage: | ||
requires: | ||
- test_unit | ||
- test_instrumented | ||
- build: | ||
requires: | ||
- test_unit | ||
- test_instrumented | ||
- check | ||
filters: | ||
branches: | ||
only: | ||
- master |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
--- | ||
name: Bug report | ||
about: Create a report to help us improve | ||
title: '' | ||
labels: bug | ||
assignees: ayltai | ||
|
||
--- | ||
|
||
**Describe the bug** | ||
A clear and concise description of what the bug is. | ||
|
||
**To Reproduce** | ||
Steps to reproduce the behavior: | ||
1. Go to '...' | ||
2. Click on '...' | ||
3. Scroll down to '...' | ||
4. See error | ||
|
||
**Expected behavior** | ||
A clear and concise description of what you expected to happen. | ||
|
||
**Screenshots** | ||
If applicable, add screenshots to help explain your problem. | ||
|
||
**Smartphone (please complete the following information):** | ||
- Device: [e.g. Samsung Galaxy S10] | ||
- OS: [e.g. Android Q] | ||
- Version [e.g. 10.0] | ||
|
||
**Additional context** | ||
Add any other context about the problem here. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
--- | ||
name: Feature request | ||
about: Suggest an idea for this project | ||
title: '' | ||
labels: bug | ||
assignees: ayltai | ||
|
||
--- | ||
|
||
**Is your feature request related to a problem? Please describe.** | ||
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] | ||
|
||
**Describe the solution you'd like** | ||
A clear and concise description of what you want to happen. | ||
|
||
**Describe alternatives you've considered** | ||
A clear and concise description of any alternative solutions or features you've considered. | ||
|
||
**Additional context** | ||
Add any other context or screenshots about the feature request here. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
### Java | ||
*.jar | ||
hs_err_pid* | ||
replay_pid*.log | ||
|
||
### Gradle | ||
.gradle/ | ||
build/ | ||
local.properties | ||
|
||
# Ignore Gradle GUI config | ||
gradle-app.setting | ||
|
||
# Avoid ignoring Gradle wrapper jar file (.jar files are usually ignored) | ||
!gradle-wrapper.jar | ||
|
||
### macOS | ||
# General | ||
.DS_Store | ||
|
||
### IntelliJ | ||
.idea/ | ||
*.iml | ||
|
||
### Secrets | ||
key-store.jks | ||
google-services.json |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
MIT License | ||
|
||
Copyright (c) 2020 Alan Tai | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
Unit Pricing Tool | ||
================= | ||
|
||
| Category | Measurement | | ||
|---------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | ||
| Pipeline | [![Build](https://img.shields.io/circleci/project/github/ayltai/price-calculator/master.svg?style=flat)](https://circleci.com/gh/ayltai/price-calculator) | | ||
| Quality | [![Code Quality](https://img.shields.io/codacy/grade/d874f2185ee342a1a4be0677167219c2.svg?style=flat)](https://app.codacy.com/app/AlanTai/price-calculator/dashboard) [![Sonar Quality Gate](https://img.shields.io/sonar/quality_gate/ayltai_price-calculator?server=https%3A%2F%2Fsonarcloud.io)](https://sonarcloud.io/dashboard?id=ayltai_price-calculator) [![Sonar Violations (short format)](https://img.shields.io/sonar/violations/ayltai_price-calculator?format=short&server=https%3A%2F%2Fsonarcloud.io)](https://sonarcloud.io/dashboard?id=ayltai_price-calculator) | | ||
| Coverage | [![Sonar Test Success Rate](https://img.shields.io/sonar/test_success_density/ayltai_price-calculator?server=https%3A%2F%2Fsonarcloud.io)](https://sonarcloud.io/dashboard?id=ayltai_price-calculator) [![Code Coverage](https://img.shields.io/codecov/c/github/ayltai/price-calculator.svg?style=flat)](https://codecov.io/gh/ayltai/price-calculator) [![Sonar Coverage](https://img.shields.io/sonar/coverage/ayltai_price-calculator?server=https%3A%2F%2Fsonarcloud.io)](https://sonarcloud.io/dashboard?id=ayltai_price-calculator) | | ||
| Ratings | [![Maintainability Rating](https://sonarcloud.io/api/project_badges/measure?project=ayltai_price-calculator&metric=sqale_rating)](https://sonarcloud.io/dashboard?id=ayltai_price-calculator) [![Reliability Rating](https://sonarcloud.io/api/project_badges/measure?project=ayltai_price-calculator&metric=reliability_rating)](https://sonarcloud.io/dashboard?id=ayltai_price-calculator) [![Sonar Tech Debt](https://img.shields.io/sonar/tech_debt/ayltai_price-calculator?server=https%3A%2F%2Fsonarcloud.io)](https://sonarcloud.io/dashboard?id=ayltai_price-calculator) | | ||
| Security | [![Security Rating](https://sonarcloud.io/api/project_badges/measure?project=ayltai_price-calculator&metric=security_rating)](https://sonarcloud.io/dashboard?id=ayltai_price-calculator) [![Vulnerabilities](https://sonarcloud.io/api/project_badges/measure?project=ayltai_price-calculator&metric=vulnerabilities)](https://sonarcloud.io/dashboard?id=ayltai_price-calculator) | | ||
| Miscellaneous | ![Maintenance](https://img.shields.io/maintenance/yes/2020) [![Android API](https://img.shields.io/badge/API-19%2B-blue.svg?style=flat&label=API&maxAge=300)](https://www.android.com/history/) [![Release](https://img.shields.io/github/release/ayltai/price-calculator.svg?style=flat)](https://1544-77390316-gh.circle-artifacts.com/0/apk/app-release.apk) [![License](https://img.shields.io/github/license/ayltai/price-calculator.svg?style=flat)](https://github.com/ayltai/price-calculator/blob/master/LICENSE) | | ||
|
||
The forgotten shopping tool - using unit pricing is the [best](http://eprints.qut.edu.au/96291/) way for shoppers to save money on grocery shopping! | ||
|
||
[![Buy me a coffee](https://img.shields.io/static/v1?label=Buy%20me%20a&message=coffee&color=important&style=for-the-badge&logo=buy-me-a-coffee&logoColor=white)](https://buymeacoff.ee/ayltai) | ||
|
||
![Light mode](design/screenshot-1.png "Light mode") ![Dark mode](design/screenshot-2.png "Dark mode") | ||
|
||
![Unit picker](design/screenshot-3.png "Unit picker") ![Unit type picker](design/screenshot-4.png "Unit type picker") | ||
|
||
## Features | ||
* Identify the cheapest item | ||
* Show percentage difference for all items | ||
* Supported unit types: volume, weight, length, area, time | ||
* Automatic unit conversion | ||
* Support dark mode | ||
|
||
## Supported units | ||
| Type | Unit | | ||
|--------|------------------------------------------------------------------| | ||
| Weight | milligram, gram, kilogram, pound, ounce, tonne | | ||
| Volume | millilitre, litre, ounce, gallon | | ||
| Length | millimetre, centimetre, metre, kilometre, inch, foot, yard, mile | | ||
| Time | minute, hour, day, week, month, year | | ||
| Area | sq. metre, sq. kilometre, sq. inch, sq. foot, sq. yard, sq. mile | | ||
|
||
## Requirements | ||
This app supports Android 4.4 Jelly Bean (API 19) or later. | ||
|
||
## Acknowledgements | ||
This app is made with the support of open source projects: | ||
|
||
* [RxJava](https://github.com/ReactiveX/RxJava) | ||
* [RxAndroid](https://github.com/ReactiveX/RxAndroid) | ||
* [Dagger 2](https://google.github.io/dagger) | ||
* [Espresso](https://google.github.io/android-testing-support-library) | ||
* [JUnit 4](https://github.com/junit-team/junit4) | ||
* [Robolectric](http://robolectric.org) | ||
* [LeakCanary](https://github.com/square/leakcanary) | ||
* [Dexcount Gradle Plugin](https://github.com/KeepSafe/dexcount-gradle-plugin) | ||
|
||
… and closed source services: | ||
|
||
* [CircleCI](https://circleci.com) | ||
* [SonarCloud](https://sonarcloud.io) | ||
* [Firebase Crashlytics](https://firebase.google.com/docs/crashlytics) |
Oops, something went wrong.