diff --git a/.DS_Store b/.DS_Store deleted file mode 100644 index 17b26480..00000000 Binary files a/.DS_Store and /dev/null differ diff --git a/.bundle/config b/.bundle/config new file mode 100755 index 00000000..b7ba9262 --- /dev/null +++ b/.bundle/config @@ -0,0 +1,4 @@ +--- +BUNDLE_RETRY: "3" +BUNDLE_JOBS: "4" +BUNDLE_PATH: "vendor/bundle" diff --git a/.github/ISSUE_TEMPLATE/bug_report.yml b/.github/ISSUE_TEMPLATE/bug_report.yml new file mode 100644 index 00000000..edf45013 --- /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: true diff --git a/.github/ISSUE_TEMPLATE/feature_request.yml b/.github/ISSUE_TEMPLATE/feature_request.yml new file mode 100644 index 00000000..1b3eddf0 --- /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: true diff --git a/.github/PULL_REQUEST_TEMPLATE/pull_request_template.md b/.github/PULL_REQUEST_TEMPLATE/pull_request_template.md new file mode 100644 index 00000000..da9b1968 --- /dev/null +++ b/.github/PULL_REQUEST_TEMPLATE/pull_request_template.md @@ -0,0 +1,16 @@ +--- +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 (`./gradlew spotlessApply` to automatically apply formatting) +- [ ] Appropriate docs were updated (if necessary) + +Is this your first Pull Request? +- [ ] Run `./tools/setup.sh` +- [ ] Import the code formatting style as explained in [the setup script](/tools/setup.sh#L40). + +Fixes # 🦕 diff --git a/.github/scripts/dependency-update-report-mail-sender.js b/.github/scripts/dependency-update-report-mail-sender.js new file mode 100644 index 00000000..56df752f --- /dev/null +++ b/.github/scripts/dependency-update-report-mail-sender.js @@ -0,0 +1,44 @@ +module.exports = ({ }) => { + const execSync = require('child_process').execSync + execSync(`npm install nodemailer`) // Install nodemailer + const nodemailer = require('nodemailer') + const transporter = nodemailer.createTransport({ + host: "smtp.live.com", // Host for hotmail + port: 587, + secureConnection: false, + auth: { + user: `${process.env.MAIL_USERNAME}`, + pass: `${process.env.MAIL_PASSWORD}` + }, + tls: { + ciphers: 'SSLv3' + } + }); + path = require('path') + console.log("Current directory:", __dirname); + let reqPath = path.join(__dirname, '../../mercari/build/dependencyUpdates/report.html') + console.log("reqPath :", reqPath); + const report = require('fs').readFileSync(reqPath) + + const mailOptions = { + from: { + name: 'GitHubRepos', + address: process.env.MAIL_USERNAME + }, + to: 'khalid64927@gmail.com', // Use your main account to get the email + subject: 'Dependency update report of AndroidCore ¯\\_(ツ)_/¯', + text: `${report}`, + attachments : [ + { // utf-8 string as an attachment + filename: 'build.gradle.kts', + path: reqPath + } + ] + }; + + transporter.sendMail(mailOptions, (error, info) => { + if (error) { + console.log(error) + } + }); +} \ No newline at end of file diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index a7bbc8dc..4103bd83 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -1,32 +1,64 @@ name: Android CI Build -on: pull_request +on: + pull_request: + workflow_dispatch: +concurrency: + group: build-${{ github.ref }} + cancel-in-progress: true jobs: build: runs-on: ubuntu-latest + timeout-minutes: 60 + steps: - - uses: actions/checkout@v1 + - name: Checkout + uses: actions/checkout@v3 + + - name: Validate Gradle Wrapper + uses: gradle/wrapper-validation-action@v1 - name: Set up JDK uses: actions/setup-java@v1 with: - java-version: 11 + java-version: 17 + + - name: Setup Gradle + uses: gradle/gradle-build-action@v2 - name: Run Spotless - run: cd GitHubRepos && ./gradlew app:spotlessCheck + run: ./gradlew mercari:spotlessCheck --stacktrace - name: Run Lint - run: cd GitHubRepos && ./gradlew app:lintProdDebug --stacktrace + run: ./gradlew mercari:lintProdDebug --stacktrace + + - name: Run Jacoco + run: ./gradlew jacocoTestReport --stacktrace + + - name: Setup Ruby + uses: ruby/setup-ruby@v1 + with: + ruby-version: '3.2.0-preview1' + bundler-cache: true - - name: Run Tests - run: cd GitHubRepos && ./gradlew app:testProdDebugUnitTest + - name: Run Danger + if: github.event_name == 'pull_request' + run: | + # install danger and its dependencies using bundler + cd GitHubRepos && gem install bundler + # install all bundles from Gemfile + bundle install --jobs 4 --retry 3 + # execute danger for this PR + bundle exec danger --dangerfile=Dangerfile --danger_id=danger-pr + env: + # the token used by danger to report the results on the PR + DANGER_GITHUB_API_TOKEN: ${{ secrets.GITHUB_TOKEN }} - name: Build - run: cd GitHubRepos && ./gradlew app:assembleProdDebug + run: ./gradlew mercari:assembleProdDebug --stacktrace - # TODO: fix OSS errors - #- name: OSS Scan - # run: cd GitHubRepos && ./gradlew dependencyCheckAnalyze --info + - name: OSS Scan + run: ./gradlew mercari:dependencyCheckAnalyze --info diff --git a/.github/workflows/dependency-update.yml b/.github/workflows/dependency-update.yml new file mode 100644 index 00000000..ad42e64f --- /dev/null +++ b/.github/workflows/dependency-update.yml @@ -0,0 +1,27 @@ +name: Check Dependency Updates +on: + schedule: + - cron: "37 13 * * SAT" + workflow_dispatch: +jobs: + dependency-updates: + runs-on: ubuntu-latest + steps: + # Removed some steps for brevity + - name: Checkout code + uses: actions/checkout@v2 + + - name: Log dependency update report + run: cat mercari/build/dependencyUpdates/report.html + + - name: 💌 Send email report + if: ${{ github.event_name == 'schedule' || github.event_name == 'workflow_dispatch' }} + uses: actions/github-script@v3 + env: + MAIL_USERNAME: ${{ secrets.MAIL_USERNAME }} + MAIL_PASSWORD: ${{ secrets.MAIL_PASSWORD }} + with: + script: | + const scriptPath = '.github/scripts/dependency-update-report-mail-sender.js' + const script = require(`${process.env.GITHUB_WORKSPACE}${scriptPath}`) + script({ }) diff --git a/GitHubRepos/.gitignore b/.gitignore similarity index 92% rename from GitHubRepos/.gitignore rename to .gitignore index d5c3b1c4..4c2aebc1 100644 --- a/GitHubRepos/.gitignore +++ b/.gitignore @@ -13,5 +13,7 @@ .externalNativeBuild .cxx .DG_Store +/.DS_Store /buildSrc/build/ /.idea/shelf/ +.DS_Store diff --git a/.idea/AndroidCore.iml b/.idea/AndroidCore.iml deleted file mode 100644 index d6ebd480..00000000 --- a/.idea/AndroidCore.iml +++ /dev/null @@ -1,9 +0,0 @@ - - - - - - - - - \ No newline at end of file diff --git a/GitHubRepos/.idea/codeStyles/Project.xml b/.idea/codeStyles/Project.xml similarity index 100% rename from GitHubRepos/.idea/codeStyles/Project.xml rename to .idea/codeStyles/Project.xml diff --git a/GitHubRepos/.idea/codeStyles/codeStyleConfig.xml b/.idea/codeStyles/codeStyleConfig.xml similarity index 100% rename from GitHubRepos/.idea/codeStyles/codeStyleConfig.xml rename to .idea/codeStyles/codeStyleConfig.xml diff --git a/GitHubRepos/.idea/compiler.xml b/.idea/compiler.xml similarity index 76% rename from GitHubRepos/.idea/compiler.xml rename to .idea/compiler.xml index fb7f4a8a..b589d56e 100644 --- a/GitHubRepos/.idea/compiler.xml +++ b/.idea/compiler.xml @@ -1,6 +1,6 @@ - + \ No newline at end of file diff --git a/.idea/deploymentTargetDropDown.xml b/.idea/deploymentTargetDropDown.xml new file mode 100644 index 00000000..0c0c3383 --- /dev/null +++ b/.idea/deploymentTargetDropDown.xml @@ -0,0 +1,10 @@ + + + + + + + + + + \ No newline at end of file diff --git a/.idea/deploymentTargetSelector.xml b/.idea/deploymentTargetSelector.xml new file mode 100644 index 00000000..b1b3b63d --- /dev/null +++ b/.idea/deploymentTargetSelector.xml @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/GitHubRepos/.idea/encodings.xml b/.idea/encodings.xml similarity index 100% rename from GitHubRepos/.idea/encodings.xml rename to .idea/encodings.xml diff --git a/.idea/gradle.xml b/.idea/gradle.xml new file mode 100644 index 00000000..4c684a7c --- /dev/null +++ b/.idea/gradle.xml @@ -0,0 +1,35 @@ + + + + + + + \ No newline at end of file diff --git a/GitHubRepos/.idea/jarRepositories.xml b/.idea/jarRepositories.xml similarity index 86% rename from GitHubRepos/.idea/jarRepositories.xml rename to .idea/jarRepositories.xml index d564599f..54e8a244 100644 --- a/GitHubRepos/.idea/jarRepositories.xml +++ b/.idea/jarRepositories.xml @@ -36,5 +36,10 @@