Skip to content

Commit

Permalink
Merge pull request #42 from nimblehq/release/0.1.0
Browse files Browse the repository at this point in the history
Release - 0.1.0
  • Loading branch information
phongvhd93 authored Aug 30, 2023
2 parents 3ae12ed + d290b65 commit f961e57
Show file tree
Hide file tree
Showing 278 changed files with 27,322 additions and 55 deletions.
3 changes: 3 additions & 0 deletions .github/CODEOWNERS
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Team
# @phongvhd93 is the Team Lead
* @suho @luongvo @phongvhd93 @markgravity @lydiasama @AVI5HEK @kaungkhantsoe
5 changes: 5 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
Note: for a release PR, append this parameter `?template=release_template.md` to the current URL to apply the release PR
template.

- Close #

## What happened 👀
Expand All @@ -11,3 +14,5 @@ Describe in detail why this solution is the most appropriate, which solution you
## Proof Of Work 📹

Show us the implementation: screenshots, GIFs, etc.

<img src="URL_GOES_HERE" width=200 />
14 changes: 6 additions & 8 deletions .github/PULL_REQUEST_TEMPLATE/release_template.md
Original file line number Diff line number Diff line change
@@ -1,17 +1,15 @@
Link to the milestone on Github e.g. https://github.com/nimblehq/git-templates/milestone/41?closed=1
or
Link to the project management tool for the release
https://github.com/nimblehq/kmm-templates/milestone/?

## Features

Provide the ID and title of the issue in the section for each type (feature, chore and bug). The link is optional.

- [sc-1234] As a user, I can log in
or
- [[sc-1234](https://app.shortcut.com/nimblehq/story/1234)] As a user, I can log in
- #

## Chores
- Same structure as in ## Feature

- #

## Bugs
- Same structure as in ## Feature

- #
179 changes: 179 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,179 @@
name: Code analysis, test and generate sample project
on:
pull_request:
types: [ opened, synchronize, reopened, ready_for_review ]

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
generate_sample:
name: Generate the sample project
runs-on: macos-latest
timeout-minutes: 30
steps:
- name: Check out
uses: actions/checkout@v3
with:
ref: ${{ github.head_ref }}
submodules: "recursive"

# To avoid code change in git when refreshing the "sample" project
- name: Preserve the ArkanaKeys
run: mv -f ./sample/ios/ArkanaKeys ../

- name: Remove the old sample project
run: rm -rf sample

- name: Generate the new sample project
run: ./make.sh --bundle-id co.nimblehq.kmm.template --bundle-id-staging co.nimblehq.kmm.template.staging --project-name sample --ios-version 14.0

- name: Restore the previous ArkanaKeys's keys
run: |
rm -rf ./sample/ios/ArkanaKeys
mv -f ../ArkanaKeys ./sample/ios
- id: changes
name: Check for changes in the sample project
run: |
count=$(git status sample --porcelain | wc -l)
echo "count=$count" >> $GITHUB_OUTPUT
- name: Commit & push the sample project changes
if: steps.changes.outputs.count > 0
run: |
git config user.name team-nimblehq
git config user.email [email protected]
git add sample
git commit -m "[Chore] Generate & update sample project"
git push
android_test:
needs: [generate_sample]
name: Run Android code analysis and tests
runs-on: ubuntu-latest
timeout-minutes: 30
defaults:
run:
working-directory: ./sample
steps:
- name: Check out
uses: actions/checkout@v3
with:
submodules: "recursive"

- name: Set up JDK
uses: actions/setup-java@v2
with:
distribution: 'temurin'
java-version: '17'

- name: Cache Gradle
uses: actions/cache@v3
with:
path: |
~/.gradle/caches/modules-*
~/.gradle/caches/jars-*
~/.gradle/caches/build-cache-*
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*') }}
restore-keys: |
${{ runner.os }}-gradle-
- name: Decode buildKonfig properties
run: echo ${{ secrets.BUILD_KONFIG_PROPERTIES }} | base64 --decode > buildKonfig.properties

- name: Run Detekt
run: ./gradlew detekt

- name: Run Lint
run: ./gradlew lint

- name: Run unit tests with Kover
run: ./gradlew koverXMLReport

- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: '2.7'
bundler-cache: true

- name: Run Danger to wrap up the review
env:
DANGER_GITHUB_API_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
bundle install
bundle exec danger --danger_id=danger_android
ios_test:
needs: [generate_sample]
name: Run iOS code analysis and tests
runs-on: macos-latest
defaults:
run:
working-directory: ./sample/ios
steps:
- name: Check out
uses: actions/checkout@v3
with:
submodules: "recursive"

- name: Set up cache
uses: actions/cache@v3
id: bunlderCache
with:
path: vendor/bundle
key: ${{ runner.os }}-gems-${{ hashFiles('**/Gemfile.lock') }}
restore-keys: |
${{ runner.os }}-gems-
- name: Set up JDK
uses: actions/setup-java@v2
with:
distribution: 'temurin'
java-version: '17'

- name: Bundle install
run: bundle install

- name: Cache Pods
uses: actions/cache@v3
id: cocoapodCache
with:
path: Pods
key: ${{ runner.os }}-pods-${{ hashFiles('**/Podfile.lock') }}
restore-keys: |
${{ runner.os }}-pods-
- name: Decode buildKonfig properties
working-directory: ./sample
run: echo ${{ secrets.BUILD_KONFIG_PROPERTIES }} | base64 --decode > buildKonfig.properties

- name: Generate KMM frameworks for Cocoapods
run: |
cd ..
./gradlew generateDummyFramework
- name: Install Pods Dependencies
run: bundle exec pod install

- name: Build and Test
run: bundle exec fastlane buildAndTest
env:
CI: true

- name: Clean up previous code coverage report
run: bundle exec fastlane cleanUpOutput

- name: __Workaround__ Running Danger SwiftFormat from non-root directory
run: |
# Find the path of danger_swiftformat
danger_swiftformat_path=$(echo "$(gem which danger_swiftformat)" | sed 's/\/danger_swiftformat.rb//')
echo $danger_swiftformat_path
# Insert a map operator in the "find_swift_files" method to remove "sample/ios/" prefix from all files.
sed -i '' "s/.uniq/.uniq.map { |file| file.partition('sample\/ios\/').last }/g" "$danger_swiftformat_path/swiftformat/plugin.rb"
- name: Run Danger to wrap up the review
env:
DANGER_GITHUB_API_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: bundle exec danger --danger_id=danger_ios
32 changes: 32 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
/test/version_tmp/
/tmp/

signing.properties

# Used by dotenv library to load environment variables.
# .env

Expand All @@ -34,3 +36,33 @@

# unless supporting rvm < 1.11.0 or doing something fancy, ignore this:
.rvmrc

# Shared
*.iml
.gradle
.DS_Store
build
captures
.externalNativeBuild
.cxx
local.properties
xcuserdata
buildKonfig.properties

# iOS
ios/Pods/
ios/fastlane/README.md
ios/fastlane/report.xml
ios/fastlane/Preview.html
ios/fastlane/screenshots/**/*.png
ios/fastlane/test_output
ios/fastlane/xcov_output
ios/vendor
ios/DerivedData
ios/Failed_Screenshots

# iOS - Sourcery
*.generated.swift

# iOS - Tuist
.tuist-generated
20 changes: 0 additions & 20 deletions .gitlab/merge_request_templates/Default.md

This file was deleted.

22 changes: 0 additions & 22 deletions .gitlab/merge_request_templates/Release.md

This file was deleted.

3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[submodule "ios"]
path = ios
url = https://github.com/nimblehq/ios-templates.git
29 changes: 29 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# Welcome to the KMM Templates contributing guide <!-- omit in toc -->

Thank you for investing your time in contributing to our project! :sparkles:

## Getting started

### Git Submodules

- To add a submodule with default source branch (develop/main)
```
$ git submodule add <repository> <path>
```
For example,
```
$ git submodule add [email protected]:nimblehq/android-templates.git android
```
- To add a submodule with a specific source branch
```
$ git submodule add -b <branch> <repository> <path>
```
For example,
```
$ git submodule add -b feature/kmm-support-upgrade-to-gradle-8 [email protected]:nimblehq/android-templates.git android
```
- To remove a submodule
```
$ git rm android
```
Also, remove the cached repository of the submodule at `.git/modules/` if nescessary.
37 changes: 37 additions & 0 deletions Dangerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# Make it more obvious that a PR is a work in progress and shouldn't be merged yet
warn("PR is classed as Work in Progress") if github.pr_title.include? "WIP"

# Warn when there is a big PR
warn("Big PR") if git.lines_of_code > 500

# Warn to encourage a PR description
warn("Please provide a summary in the PR description to make it easier to review") if github.pr_body.length == 0

# Warn to encourage that labels should have been used on the PR
warn("Please add labels to this PR") if github.pr_labels.empty?

# Check commits lint and warn on all checks (instead of failing)
commit_lint.check warn: :all, disable: [:subject_length]

# Detekt output check
detekt_dir = "build/reports/detekt/detekt.xml"
Dir[detekt_dir].each do |file_name|
kotlin_detekt.skip_gradle_task = true
kotlin_detekt.report_file = file_name
kotlin_detekt.detekt(inline_mode: true)
end

# Android Lint output check
lint_dir = "**/build/reports/lint/lint-result.xml"
Dir[lint_dir].each do |file_name|
android_lint.skip_gradle_task = true
android_lint.report_file = file_name
android_lint.lint(inline_mode: true)
end

# Show Danger test coverage report from Kover for templates
# Report coverage of modified files, warn if total project coverage is under 80%
# or if any modified file's coverage is under 95%
kover_file = "android/build/reports/kover/report.xml"
markdown "## Kover report:"
shroud.reportKover "Unit Tests", kover_file, 80, 95, false
11 changes: 11 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# frozen_string_literal: true

source "https://rubygems.org"

git_source(:github) {|repo_name| "https://github.com/#{repo_name}" }

gem 'danger'
gem 'danger-android_lint'
gem 'danger-commit_lint'
gem 'danger-kotlin_detekt'
gem 'danger-shroud'
Loading

0 comments on commit f961e57

Please sign in to comment.