diff --git a/.github/ISSUE_TEMPLATE/bug-report.yml b/.github/ISSUE_TEMPLATE/bug-report.yml new file mode 100644 index 000000000..f92f51a43 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/bug-report.yml @@ -0,0 +1,85 @@ +name: "\U0001F41E Bug report" +description: Create a report to help us improve. +title: "[Bug]: " +labels: ["bug"] +body: + - type: markdown + attributes: + value: | + - Before creating an issue, please search the existing issues to see if a similar one has already been created. + - You can search issues by specific labels (e.g. `label:nearby`) or just by typing keywords into the search filter. + - type: textarea + attributes: + label: Summary + description: Summarize your issue (what goes wrong, what did you expect to happen) + validations: + required: true + - type: textarea + attributes: + label: Steps to reproduce + description: How can we reproduce the issue? + placeholder: | + 1. Have the app open.. + 2. Go to.. + 3. Click on.. + 4. Observe.. + validations: + required: true + - type: textarea + attributes: + label: Expected behaviour + placeholder: A menu should open.. + validations: + required: true + - type: textarea + attributes: + label: Actual behaviour + placeholder: The app closes unexpectedly.. + validations: + required: true + - type: markdown + attributes: + value: | + # Device information + - type: input + attributes: + label: Device name + description: What make and model device did you encounter this on? + placeholder: Samsung J7 + validations: + required: false + - type: input + attributes: + label: Android version + description: What Android version (e.g., Android 6.0 Marshmallow or Android 11) are you running? Is it the stock version from the manufacturer or a custom ROM ? + placeholder: Android 10 + validations: + required: true + - type: input + attributes: + label: Commons app version + description: You can find this information by clicking the right-most menu in the bottom navigation bar in the app and tapping 'About'. If you are building from our codebase instead of downloading the app, please also mention the branch and build variant (e.g. `master` and `prodDebug`). + placeholder: 3.1.1 + validations: + required: true + - type: textarea + attributes: + label: Device logs + description: Add logcat files here (if possible). Need help? See "[Getting app logs from Android Studio](https://commons-app.github.io/docs.html#getting-app-logs-from-android-studio)". + validations: + required: false + - type: textarea + attributes: + label: Screen-shots + description: Add screenshots related to the issue (if available). Can be created by pressing the Volume Down and Power Button at the same time on Android 4.0 and higher. + validations: + required: false + - type: dropdown + attributes: + label: Would you like to work on the issue? + description: Please let us know whether you want to fix the issue by yourself. If not, anyone can get the issue assigned to them. + options: + - "Yes" + - Prefer not + validations: + required: false diff --git a/.github/ISSUE_TEMPLATE/feature-request.yml b/.github/ISSUE_TEMPLATE/feature-request.yml new file mode 100644 index 000000000..5ac210240 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/feature-request.yml @@ -0,0 +1,30 @@ +name: "⭐️ Feature request" +description: Suggest an idea for this project +labels: ["enhancement"] +body: + - type: markdown + attributes: + value: | + - Please do your best to search for duplicate issues before filing a new issue so we can keep our issue board clean. + - Every issue should have exactly one feature request described in it. Please do not file feedback list tickets as it is difficult to parse them and address their individual points. + - Feature Requests are better when they’re open-ended instead of demanding a specific solution e.g: “I want an easier way to do X” instead of “add Y”. + - type: textarea + attributes: + label: What is the user problem or growth opportunity you want to see solved? + validations: + required: false + - type: textarea + attributes: + label: How do you know that this problem exists today? Why is this important? + validations: + required: false + - type: textarea + attributes: + label: Who will benefit from it? + validations: + required: false + - type: textarea + attributes: + label: Anything else you would like to add? + validations: + required: false diff --git a/.github/ISSUE_TEMPLATE/feedback.yml b/.github/ISSUE_TEMPLATE/feedback.yml new file mode 100644 index 000000000..febde65f6 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/feedback.yml @@ -0,0 +1,46 @@ +name: "\U0001F4AC Feedback" +description: Share your feedback about the app +labels: ["feedback"] +body: + - type: markdown + attributes: + value: | + - Before creating an issue, please search the existing issues to see if a similar one has already been created. + - You can search issues by specific labels (e.g. `label:nearby`) or just by typing keywords into the search filter. + - type: textarea + attributes: + label: Feedback + description: Share your feedback about the app. + validations: + required: true + - type: input + attributes: + label: Wiki username + placeholder: Jimbo Wales + validations: + required: false + - type: markdown + attributes: + value: | + # Device information + - type: input + attributes: + label: Device name + description: What make and model device did you encounter this on? + placeholder: Samsung J7 + validations: + required: false + - type: input + attributes: + label: Android version + description: What Android version (e.g., Android 6.0 Marshmallow or Android 11) are you running? Is it the stock version from the manufacturer or a custom ROM ? + placeholder: Android 10 + validations: + required: false + - type: input + attributes: + label: Commons app version + description: You can find this information by clicking the right-most menu in the bottom navigation bar in the app and tapping 'About'. If you are building from our codebase instead of downloading the app, please also mention the branch and build variant (e.g. `master` and `prodDebug`). + placeholder: 3.1.1 + validations: + required: true diff --git a/.github/ISSUE_TEMPLATE/need-help.yml b/.github/ISSUE_TEMPLATE/need-help.yml new file mode 100644 index 000000000..64ddabda6 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/need-help.yml @@ -0,0 +1,13 @@ +name: "✋🏻 Need help" +description: Describe the situation which you need help with. +labels: ["help needed"] +body: + - type: markdown + attributes: + value: | + - Describe the situation which you need help with with as much information as possible. + - type: textarea + attributes: + label: Description + validations: + required: true diff --git a/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md similarity index 100% rename from PULL_REQUEST_TEMPLATE.md rename to .github/PULL_REQUEST_TEMPLATE.md diff --git a/.github/workflows/android.yml b/.github/workflows/android.yml index d36ed6566..7a1e7c030 100644 --- a/.github/workflows/android.yml +++ b/.github/workflows/android.yml @@ -1,6 +1,6 @@ name: Android CI -on: [push, pull_request] +on: [push, pull_request, workflow_dispatch] concurrency: group: build-${{ github.event.pull_request.number || github.ref }} @@ -8,21 +8,21 @@ concurrency: jobs: build: - name: Build APK and Run Unit Tests + name: Run tests and generate APK runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2.4.0 + - name: Checkout code + uses: actions/checkout@v3 - name: Set up JDK - uses: actions/setup-java@v2.5.0 + uses: actions/setup-java@v3 with: - distribution: "temurin" - java-version: 8 + distribution: 'temurin' + java-version: '17' - name: Cache packages id: cache-packages - uses: actions/cache@v2.1.7 + uses: actions/cache@v3 with: path: | ~/.gradle/caches @@ -30,20 +30,66 @@ jobs: key: gradle-packages-${{ runner.os }}-${{ hashFiles('**/*.gradle', '**/*.gradle.kts', 'gradle.properties') }} restore-keys: gradle-packages-${{ runner.os }} - - name: Build with Gradle and run Unit Tests + - name: Access test login credentials + run: | + echo "TEST_USER_NAME=${{ secrets.TEST_USER_NAME }}" >> local.properties + echo "TEST_USER_PASSWORD=${{ secrets.TEST_USER_PASSWORD }}" >> local.properties + + - name: AVD cache + if: github.event_name != 'pull_request' + uses: actions/cache@v3 + id: avd-cache + with: + path: | + ~/.android/avd/* + ~/.android/adb* + key: avd-tablet-api-24 + + - name: Create AVD and generate snapshot for caching + if: steps.avd-cache.outputs.cache-hit != 'true' && github.event_name != 'pull_request' + uses: reactivecircus/android-emulator-runner@v2 + with: + api-level: 24 + force-avd-creation: false + emulator-options: -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none + disable-animations: true + script: echo "Generated AVD snapshot for caching." + + - name: Run Instrumentation tests + if: github.event_name != 'pull_request' + uses: reactivecircus/android-emulator-runner@v2 + with: + api-level: 24 + force-avd-creation: false + emulator-options: -no-snapshot-save -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none + disable-animations: true + profile: Nexus 10 + script: | + adb shell content insert --uri content://settings/system --bind name:s:accelerometer_rotation --bind value:i:0 + adb shell content insert --uri content://settings/system --bind name:s:user_rotation --bind value:i:0 + adb emu geo fix 37.422131 -122.084801 + ./gradlew connectedBetaDebugAndroidTest --stacktrace + + - name: Run Unit tests with unified coverage + if: github.event_name != 'pull_request' + run: ./gradlew -Pcoverage testBetaDebugUnitTestUnifiedCoverage --stacktrace + + - name: Run Unit tests without unified coverage + if: github.event_name == 'pull_request' run: ./gradlew -Pcoverage testBetaDebugUnitTestCoverage --stacktrace - name: Upload Test Report to Codecov + if: github.event_name != 'pull_request' run: | curl -Os https://uploader.codecov.io/latest/linux/codecov chmod +x codecov - ./codecov -f "app/build/reports/jacoco/testBetaDebugUnitTestCoverage/testBetaDebugUnitTestCoverage.xml" -Z + ./codecov -f "app/build/reports/jacoco/testBetaDebugUnitTestUnifiedCoverage/testBetaDebugUnitTestUnifiedCoverage.xml" -Z - name: Generate betaDebug APK run: bash ./gradlew assembleBetaDebug --stacktrace - name: Upload betaDebug APK - uses: actions/upload-artifact@v2.3.1 + uses: actions/upload-artifact@v3 with: name: betaDebugAPK path: app/build/outputs/apk/beta/debug/app-*.apk @@ -52,7 +98,7 @@ jobs: run: bash ./gradlew assembleProdDebug --stacktrace - name: Upload prodDebug APK - uses: actions/upload-artifact@v2.3.1 + uses: actions/upload-artifact@v3 with: name: prodDebugAPK path: app/build/outputs/apk/prod/debug/app-*.apk diff --git a/.gitignore b/.gitignore index 418e4c380..e54ea2551 100644 --- a/.gitignore +++ b/.gitignore @@ -43,3 +43,7 @@ app/src/main/jniLibs #https://docs.opencv.org/3.3.0/ /libraries/opencv/javadoc/ captures/* + +# Test and other output +app/jacoco.exec +app/CommonsContributions \ No newline at end of file diff --git a/.idea/codeStyles/Project.xml b/.idea/codeStyles/Project.xml index f277755ba..5c297a65e 100644 --- a/.idea/codeStyles/Project.xml +++ b/.idea/codeStyles/Project.xml @@ -39,21 +39,18 @@