A fully functional Android app built entirely with Kotlin and Jetpack Compose
Add github-specific setup (#1)
Jolanda Verhoefae0cc710efc4
diff --git a/.github/ISSUE_TEMPLATE/bug_report.yml b/.github/ISSUE_TEMPLATE/bug_report.ymlnew file mode 100644index 000000000..edf450131--- /dev/null+++ b/.github/ISSUE_TEMPLATE/bug_report.yml@@ -0,0 +1,46 @@+name: Bug Report+description: File a bug report+title: "[Bug]: "+labels: ["bug", "triage me"]+body:+ - type: markdown+ attributes:+ value: |+ Thanks for taking the time to fill out this bug report!+ - type: checkboxes+ attributes:+ label: Is there an existing issue for this?+ description: Please search to see if an issue already exists for the bug you encountered.+ options:+ - label: I have searched the existing issues+ required: true+ - type: checkboxes+ attributes:+ label: Is there a StackOverflow question about this issue?+ description: Please search [StackOverflow](https://stackoverflow.com/questions/tagged/android-jetpack) if an issue with an answer already exists for the bug you encountered.+ options:+ - label: I have searched StackOverflow+ required: true+ - type: textarea+ id: what-happened+ attributes:+ label: What happened?+ description: Also tell us, what did you expect to happen?+ placeholder: Tell us what you see!+ value: "A bug happened!"+ validations:+ required: true+ - type: textarea+ id: logs+ attributes:+ label: Relevant logcat output+ description: Please copy and paste any relevant logcat output. This will be automatically formatted into code, so no need for backticks.+ render: shell+ - type: checkboxes+ id: terms+ attributes:+ label: Code of Conduct+ description: By submitting this issue, you agree to follow our [Code of Conduct](CODE_OF_CONDUCT.md)+ options:+ - label: I agree to follow this project's Code of Conduct+ required: truediff --git a/.github/ISSUE_TEMPLATE/feature_request.yml b/.github/ISSUE_TEMPLATE/feature_request.ymlnew file mode 100644index 000000000..1b3eddf03--- /dev/null+++ b/.github/ISSUE_TEMPLATE/feature_request.yml@@ -0,0 +1,46 @@+name: Feature request+description: File a feature request+title: "[FR]: "+labels: ["enhancement", "triage me"]+body:+ - type: markdown+ attributes:+ value: |+ Thanks for taking the time to fill out this bug report!+ - type: checkboxes+ attributes:+ label: Is there an existing issue for this?+ description: Please search to see if an issue already exists for this feature request.+ options:+ - label: I have searched the existing issues+ required: true+ - type: textarea+ id: describe-problem+ attributes:+ label: Describe the problem+ description: Is your feature request related to a problem? Please describe.+ placeholder: I'm always frustrated when...+ validations:+ required: true+ - type: textarea+ id: solution+ attributes:+ label: Describe the solution+ description: Please describe the solution you'd like. A clear and concise description of what you want to happen.+ validations:+ required: true+ - type: textarea+ id: context+ attributes:+ label: Additional context+ description: Add any other context or screenshots about the feature request here.+ validations:+ required: false+ - type: checkboxes+ id: terms+ attributes:+ label: Code of Conduct+ description: By submitting this issue, you agree to follow our [Code of Conduct](CODE_OF_CONDUCT.md)+ options:+ - label: I agree to follow this project's Code of Conduct+ required: truediff --git a/.github/PULL_REQUEST_TEMPLATE/pull_request_template.md b/.github/PULL_REQUEST_TEMPLATE/pull_request_template.mdnew file mode 100644index 000000000..ab8c4d0af--- /dev/null+++ b/.github/PULL_REQUEST_TEMPLATE/pull_request_template.md@@ -0,0 +1,11 @@+---+name: Pull request+about: Create a pull request+label: 'triage me'+---+Thank you for opening a Pull Request! Before submitting your PR, there are a few things you can do to make sure it goes smoothly:+- [ ] Make sure to open a GitHub issue as a bug/feature request before writing your code! That way we can discuss the change, evaluate designs, and agree on the general idea+- [ ] Ensure the tests and linter pass+- [ ] Appropriate docs were updated (if necessary)++Fixes #<issue_number_goes_here> 🦕diff --git a/.github/ci-gradle.properties b/.github/ci-gradle.propertiesnew file mode 100644index 000000000..9ba9603f3--- /dev/null+++ b/.github/ci-gradle.properties@@ -0,0 +1,26 @@+#+# Copyright 2020 The Android Open Source Project+#+# Licensed under the Apache License, Version 2.0 (the "License");+# you may not use this file except in compliance with the License.+# You may obtain a copy of the License at+#+# http://www.apache.org/licenses/LICENSE-2.0+#+# Unless required by applicable law or agreed to in writing, software+# distributed under the License is distributed on an "AS IS" BASIS,+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.+# See the License for the specific language governing permissions and+# limitations under the License.+#++org.gradle.daemon=false+org.gradle.parallel=true+org.gradle.jvmargs=-Xmx5120m+org.gradle.workers.max=2++kotlin.incremental=false+kotlin.compiler.execution.strategy=in-process++# Controls KotlinOptions.allWarningsAsErrors. This is used in CI and can be set in local properties.+warningsAsErrors=truediff --git a/.github/workflows/Build.yaml b/.github/workflows/Build.yamlnew file mode 100644index 000000000..f398269bf--- /dev/null+++ b/.github/workflows/Build.yaml@@ -0,0 +1,114 @@+name: Build++on:+ push:+ branches:+ - main+ pull_request:+concurrency:+ group: build-${{ github.ref }}+ cancel-in-progress: true++jobs:+ build:+ runs-on: ubuntu-latest+ timeout-minutes: 60++ steps:+ - name: Checkout+ uses: actions/checkout@v2++ - name: Copy CI gradle.properties+ run: mkdir -p ~/.gradle ; cp .github/ci-gradle.properties ~/.gradle/gradle.properties++ - name: Set up JDK 11+ uses: actions/setup-java@v1+ with:+ java-version: 11++ - name: Generate cache key+ run: ./scripts/checksum.sh checksum.txt++ - uses: actions/cache@v2+ with:+ path: |+ ~/.gradle/caches/modules-*+ ~/.gradle/caches/jars-*+ ~/.gradle/caches/build-cache-*+ key: gradle-${{ hashFiles('checksum.txt') }}++ - name: Check spotless+ run: ./gradlew spotlessCheck --stacktrace++ - name: Check lint+ run: ./gradlew lintDebug --stacktrace++ - name: Build debug+ run: ./gradlew assembleDebug --stacktrace++ - name: Build release+ run: ./gradlew assembleRelease --stacktrace++ - name: Run local tests+ run: ./gradlew testDebug --stacktrace++ - name: Upload build outputs (APKs)+ uses: actions/upload-artifact@v2+ with:+ name: build-outputs+ path: app/build/outputs++ - name: Upload build reports+ if: always()+ uses: actions/upload-artifact@v2+ with:+ name: build-reports+ path: app/build/reports++ androidTest:+ needs: build+ runs-on: macOS-latest # enables hardware acceleration in the virtual machine+ timeout-minutes: 30+ strategy:+ matrix:+ api-level: [23, 26, 30]++ steps:+ - name: Checkout+ uses: actions/checkout@v2++ - name: Copy CI gradle.properties+ run: mkdir -p ~/.gradle ; cp .github/ci-gradle.properties ~/.gradle/gradle.properties++ - name: Set up JDK 11+ uses: actions/setup-java@v1+ with:+ java-version: 11++ - name: Generate cache key+ run: ./scripts/checksum.sh $SAMPLE_PATH checksum.txt++ - uses: actions/cache@v2+ with:+ path: |+ ~/.gradle/caches/modules-*+ ~/.gradle/caches/jars-*+ ~/.gradle/caches/build-cache-*+ key: gradle-${{ hashFiles('checksum.txt') }}++ - name: Run instrumentation tests+ uses: reactivecircus/android-emulator-runner@v2+ with:+ api-level: ${{ matrix.api-level }}+ arch: x86_64+ disable-animations: true+ disk-size: 1500M+ heap-size: 512M+ script: ./gradlew connectedAndroidTest -x :benchmark:connectedBenchmarkAndroidTest++ - name: Upload test reports+ if: always()+ uses: actions/upload-artifact@v2+ with:+ name: test-reports+ path: app/build/reports/androidTestsdiff --git a/.github/workflows/Release.yml b/.github/workflows/Release.ymlnew file mode 100644index 000000000..fd5336526--- /dev/null+++ b/.github/workflows/Release.yml@@ -0,0 +1,107 @@+name: GitHub Release with APKs++on:+ push:+ tags:+ - 'v*'++jobs:+ build:+ runs-on: ubuntu-latest+ timeout-minutes: 45++ steps:+ - name: Checkout+ uses: actions/checkout@v2++ - name: Copy CI gradle.properties+ run: mkdir -p ~/.gradle ; cp .github/ci-gradle.properties ~/.gradle/gradle.properties++ - name: Set up JDK 11+ uses: actions/setup-java@v1+ with:+ java-version: 11++ - name: Build all projects+ run: ./scripts/gradlew_recursive.sh assembleDebug++ - name: Create Release+ id: create_release+ uses: actions/create-release@v1+ env:+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}+ with:+ tag_name: ${{ github.ref }}+ release_name: ${{ github.ref }}+ draft: true+ prerelease: false++ - name: Upload Crane+ uses: actions/upload-release-asset@v1+ env:+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}+ with:+ upload_url: ${{ steps.create_release.outputs.upload_url }}+ asset_path: Crane/app/build/outputs/apk/debug/app-debug.apk+ asset_name: crane-debug.apk+ asset_content_type: application/vnd.android.package-archive++ - name: Upload Owl+ uses: actions/upload-release-asset@v1+ env:+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}+ with:+ upload_url: ${{ steps.create_release.outputs.upload_url }}+ asset_path: Owl/app/build/outputs/apk/debug/app-debug.apk+ asset_name: owl-debug.apk+ asset_content_type: application/vnd.android.package-archive++ - name: Upload Jetcaster+ uses: actions/upload-release-asset@v1+ env:+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}+ with:+ upload_url: ${{ steps.create_release.outputs.upload_url }}+ asset_path: Jetcaster/app/build/outputs/apk/debug/app-debug.apk+ asset_name: jetcaster-debug.apk+ asset_content_type: application/vnd.android.package-archive++ - name: Upload Jetchat+ uses: actions/upload-release-asset@v1+ env:+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}+ with:+ upload_url: ${{ steps.create_release.outputs.upload_url }}+ asset_path: Jetchat/app/build/outputs/apk/debug/app-debug.apk+ asset_name: jetchat-debug.apk+ asset_content_type: application/vnd.android.package-archive++ - name: Upload Jetnews+ uses: actions/upload-release-asset@v1+ env:+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}+ with:+ upload_url: ${{ steps.create_release.outputs.upload_url }}+ asset_path: JetNews/app/build/outputs/apk/debug/app-debug.apk+ asset_name: jetnews-debug.apk+ asset_content_type: application/vnd.android.package-archive++ - name: Upload Jetsnack+ uses: actions/upload-release-asset@v1+ env:+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}+ with:+ upload_url: ${{ steps.create_release.outputs.upload_url }}+ asset_path: Jetsnack/app/build/outputs/apk/debug/app-debug.apk+ asset_name: jetsnack-debug.apk+ asset_content_type: application/vnd.android.package-archive++ - name: Upload Jetsurvey+ uses: actions/upload-release-asset@v1+ env:+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}+ with:+ upload_url: ${{ steps.create_release.outputs.upload_url }}+ asset_path: Jetsurvey/app/build/outputs/apk/debug/app-debug.apk+ asset_name: jetsurvey-debug.apk+ asset_content_type: application/vnd.android.package-archivediff --git a/CODE_OF_CONDUCT.md b/CODE_OF_CONDUCT.mdnew file mode 100644index 000000000..f8b12cb55--- /dev/null+++ b/CODE_OF_CONDUCT.md@@ -0,0 +1,63 @@+# Google Open Source Community Guidelines++At Google, we recognize and celebrate the creativity and collaboration of open+source contributors and the diversity of skills, experiences, cultures, and+opinions they bring to the projects and communities they participate in.++Every one of Google's open source projects and communities are inclusive+environments, based on treating all individuals respectfully, regardless of+gender identity and expression, sexual orientation, disabilities,+neurodiversity, physical appearance, body size, ethnicity, nationality, race,+age, religion, or similar personal characteristic.++We value diverse opinions, but we value respectful behavior more.++Respectful behavior includes:++* Being considerate, kind, constructive, and helpful.+* Not engaging in demeaning, discriminatory, harassing, hateful, sexualized, or+ physically threatening behavior, speech, and imagery.+* Not engaging in unwanted physical contact.++Some Google open source projects [may adopt][] an explicit project code of+conduct, which may have additional detailed expectations for participants. Most+of those projects will use our [modified Contributor Covenant][].++[may adopt]: https://opensource.google/docs/releasing/preparing/#conduct+[modified Contributor Covenant]: https://opensource.google/docs/releasing/template/CODE_OF_CONDUCT/++## Resolve peacefully++We do not believe that all conflict is necessarily bad; healthy debate and+disagreement often yields positive results. However, it is never okay to be+disrespectful.++If you see someone behaving disrespectfully, you are encouraged to address the+behavior directly with those involved. Many issues can be resolved quickly and+easily, and this gives people more control over the outcome of their dispute.+If you are unable to resolve the matter for any reason, or if the behavior is+threatening or harassing, report it. We are dedicated to providing an+environment where participants feel welcome and safe.++## Reporting problems++Some Google open source projects may adopt a project-specific code of conduct.+In those cases, a Google employee will be identified as the Project Steward,+who will receive and handle reports of code of conduct violations. In the event+that a project hasn’t identified a Project Steward, you can report problems by+emailing [email protected].++We will investigate every complaint, but you may not receive a direct response.+We will use our discretion in determining when and how to follow up on reported+incidents, which may range from not taking action to permanent expulsion from+the project and project-sponsored spaces. We will notify the accused of the+report and provide them an opportunity to discuss it before any action is+taken. The identity of the reporter will be omitted from the details of the+report supplied to the accused. In potentially harmful situations, such as+ongoing harassment or threats to anyone's safety, we may take action without+notice.++*This document was adapted from the [IndieWeb Code of Conduct][] and can also+be found at <https://opensource.google/conduct/>.*++[IndieWeb Code of Conduct]: https://indieweb.org/code-of-conductdiff --git a/scripts/checksum.sh b/scripts/checksum.shnew file mode 100755index 000000000..438f9e90e--- /dev/null+++ b/scripts/checksum.sh@@ -0,0 +1,39 @@+#+# Copyright 2022 Google, Inc.+#+# Licensed under the Apache License, Version 2.0 (the "License");+# you may not use this file except in compliance with the License.+# You may obtain a copy of the License at+#+# http://www.apache.org/licenses/LICENSE-2.0+#+# Unless required by applicable law or agreed to in writing, software+# distributed under the License is distributed on an "AS IS" BASIS,+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.+# See the License for the specific language governing permissions and+# limitations under the License.+#++#!/bin/bash+RESULT_FILE=$1++if [ -f $RESULT_FILE ]; then+ rm $RESULT_FILE+fi+touch $RESULT_FILE++checksum_file() {+ echo $(openssl md5 $1 | awk '{print $2}')+}++FILES=()+while read -r -d ''; do+ FILES+=("$REPLY")+done < <(find . -type f \( -name "build.gradle*" -o -name "gradle-wrapper.properties" -o -name "robolectric.properties" \) -print0)++# Loop through files and append MD5 to result file+for FILE in ${FILES[@]}; do+ echo $(checksum_file $FILE) >> $RESULT_FILE+done+# Now sort the file so that it is idempotent+sort $RESULT_FILE -o $RESULT_FILE