Skip to content

Commit

Permalink
Implement ServiceLocator framework
Browse files Browse the repository at this point in the history
  • Loading branch information
ns-vasilev committed Feb 13, 2024
1 parent 71d5aa7 commit 32057e7
Show file tree
Hide file tree
Showing 28 changed files with 1,155 additions and 1 deletion.
61 changes: 61 additions & 0 deletions .clang-format
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
# For options, see http://clang.llvm.org/docs/ClangFormatStyleOptions.html

# A style complying with Google’s C++ style guide
BasedOnStyle: Google

# If true, horizontally aligns arguments after an open bracket.
# This applies to round brackets (parentheses), angle brackets and square brackets.
AlignAfterOpenBracket: true

# If true, horizontally align operands of binary and ternary expressions.
AlignOperands: false

# Allow putting all parameters of a function declaration onto the next line even if BinPackParameters is false.
AllowAllParametersOfDeclarationOnNextLine: true

# If true, always break after the template<...> of a template declaration.
AlwaysBreakTemplateDeclarations: true

# If false, a function call’s arguments will either be all on the same line or will have one line each.
BinPackArguments: false

# If false, a function call’s or function definition’s parameters will either all be on the same line or will have one line each.
BinPackParameters: false

# If true, ternary operators will be placed after line breaks.
BreakBeforeTernaryOperators: true

# Column limit for Obj-C at Google is 100
ColumnLimit: 100

# Indent width for line continuations.
ContinuationIndentWidth: 4

# If true, analyze the formatted file for the most common alignment of & and *. PointerAlignment is then used only as fallback.
DerivePointerAlignment: false

# The number of characters to use for indentation of ObjC blocks.
ObjCBlockIndentWidth: 2

# Add a space after @property in Objective-C.
# i.e. use \@property (readonly) instead of \@property(readonly).
ObjCSpaceAfterProperty: false

# Add a space in front of an Objective-C protocol list
# i.e. use Foo <Protocol> instead of Foo<Protocol>.
ObjCSpaceBeforeProtocolList: true

# Pointer and reference alignment style.
# ie. Right means * and & align to the variable, not the type.
# (PointerBindsToType looks like it's been deprecated and replaced by PointerAlignment)
PointerBindsToType: false
PointerAlignment: Right

# If true, spaces are inserted inside container literals (e.g. ObjC array and dict literals).
SpacesInContainerLiterals: true

# The number of columns used for tab stops.
TabWidth: 2

# The way to use tab characters in the resulting file.
UseTab: Never
41 changes: 41 additions & 0 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
---
name: "🐛 Bug Report"
about: Report a reproducible bug or regression.
title: 'Bug: '
labels: 'bug'

---

<!--
Please provide a clear and concise description of what the bug is. Include
screenshots if needed. Please test using the latest version of the relevant
React packages to make sure your issue has not already been fixed.
-->

Application version:

## Steps To Reproduce

1.
2.

<!--
Your bug will get fixed much faster if we can run your code and it doesn't
have dependencies other than React. Issues without reproduction steps or
code examples may be immediately closed as not actionable.
-->

Link to code example:

<!--
Please provide a CodeSandbox (https://codesandbox.io/s/new), a link to a
repository on GitHub, or provide a minimal code example that reproduces the
problem. You may provide a screenshot of the application if you think it is
relevant to your bug report. Here are some tips for providing a minimal
example: https://stackoverflow.com/help/mcve.
-->

## The current behavior


## The expected behavior
11 changes: 11 additions & 0 deletions .github/ISSUE_TEMPLATE/feature_request.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
---
name: 🛠 Feature request
about: If you have a feature request for the service-locator, file it here.
labels: 'type: enhancement'
---

**Feature description**
Clearly and concisely describe the feature.

**Describe the solution you'd like**
A clear and concise description of what you want to happen.
9 changes: 9 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE/bug_template.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
## Bug description
Clearly and concisely describe the problem.

## Solution description
Describe your code changes in detail for reviewers. Explain the technical solution you have provided and how it fixes the issue case.

## Covered unit test cases
- [x] yes
- [x] no
12 changes: 12 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE/feature_template.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
## Feature description
Clearly and concisely describe the feature.

## Solution description
Describe your code changes in detail for reviewers.

## Areas affected and ensured
List out the areas affected by your code changes.

## Covered unit test cases
- [x] yes
- [x] no
201 changes: 201 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,201 @@
name: service-locator

on:
push:
branches:
- main
- dev
pull_request:
paths:
- ".github/workflows/**"
- "ServiceLocator/**"
- "ServiceLocatorTests/**"
jobs:
macOS:
name: ${{ matrix.name }}
runs-on: ${{ matrix.runsOn }}
env:
DEVELOPER_DIR: "/Applications/${{ matrix.xcode }}.app/Contents/Developer"
timeout-minutes: 20
strategy:
fail-fast: false
matrix:
include:
- xcode: "Xcode_15.0"
runsOn: macos-13
name: "macOS 13, Xcode 15.0"
- xcode: "Xcode_14.3.1"
runsOn: macos-13
name: "macOS 13, Xcode 14.3.1"
- xcode: "Xcode_14.2"
runsOn: macOS-12
name: "macOS 12, Xcode 14.2"
- xcode: "Xcode_14.1"
runsOn: macOS-12
name: "macOS 12, Xcode 14.1"
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Install Dependencies
run: brew bundle
- name: Generate project
run: xcodegen generate
- name: ${{ matrix.name }}
run: xcodebuild test -scheme "ServiceLocator" -destination "platform=macOS" clean -enableCodeCoverage YES -resultBundlePath "test_output/${{ matrix.name }}.xcresult" || exit 1
- name: Upload coverage reports to Codecov
uses: codecov/[email protected]
with:
token: ${{ secrets.CODECOV_TOKEN }}
xcode: true
xcode_archive_path: test_output/${{ matrix.name }}.xcresult
- uses: actions/upload-artifact@v4
with:
name: ${{ matrix.name }}
path: test_output

iOS:
name: ${{ matrix.name }}
runs-on: ${{ matrix.runsOn }}
env:
DEVELOPER_DIR: "/Applications/${{ matrix.xcode }}.app/Contents/Developer"
timeout-minutes: 20
strategy:
fail-fast: false
matrix:
include:
- destination: "OS=17.0.1,name=iPhone 14 Pro"
name: "iOS 17.0.1"
xcode: "Xcode_15.0"
runsOn: macos-13
- destination: "OS=16.4,name=iPhone 14 Pro"
name: "iOS 16.4"
xcode: "Xcode_14.3.1"
runsOn: macos-13
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Install Dependencies
run: brew bundle
- name: Generate project
run: xcodegen generate
- name: ${{ matrix.name }}
run: xcodebuild test -scheme "ServiceLocator" -destination "${{ matrix.destination }}" clean -enableCodeCoverage YES -resultBundlePath "test_output/${{ matrix.name }}.xcresult" || exit 1
- name: Upload coverage reports to Codecov
uses: codecov/[email protected]
with:
token: ${{ secrets.CODECOV_TOKEN }}
xcode: true
xcode_archive_path: test_output/${{ matrix.name }}.xcresult
- uses: actions/upload-artifact@v4
with:
name: ${{ matrix.name }}
path: test_output

tvOS:
name: ${{ matrix.name }}
runs-on: ${{ matrix.runsOn }}
env:
DEVELOPER_DIR: "/Applications/${{ matrix.xcode }}.app/Contents/Developer"
timeout-minutes: 20
strategy:
fail-fast: false
matrix:
include:
- destination: "OS=17.0,name=Apple TV"
name: "tvOS 17.0"
xcode: "Xcode_15.0"
runsOn: macos-13
- destination: "OS=16.4,name=Apple TV"
name: "tvOS 16.4"
xcode: "Xcode_14.3.1"
runsOn: macos-13
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Install Dependencies
run: brew bundle
- name: Generate project
run: xcodegen generate
- name: ${{ matrix.name }}
run: xcodebuild test -scheme "ServiceLocator" -destination "${{ matrix.destination }}" clean -enableCodeCoverage YES -resultBundlePath "test_output/${{ matrix.name }}.xcresult" || exit 1
- name: Upload coverage reports to Codecov
uses: codecov/[email protected]
with:
token: ${{ secrets.CODECOV_TOKEN }}
xcode: true
xcode_archive_path: test_output/${{ matrix.name }}.xcresult
- uses: actions/upload-artifact@v4
with:
name: ${{ matrix.name }}
path: test_output

watchOS:
name: ${{ matrix.name }}
runs-on: ${{ matrix.runsOn }}
env:
DEVELOPER_DIR: "/Applications/${{ matrix.xcode }}.app/Contents/Developer"
timeout-minutes: 20
strategy:
fail-fast: false
matrix:
include:
- destination: "OS=10.0,name=Apple Watch Series 9 (45mm)"
name: "watchOS 10.0"
xcode: "Xcode_15.0"
runsOn: macos-13
- destination: "OS=9.4,name=Apple Watch Series 8 (45mm)"
name: "watchOS 9.4"
xcode: "Xcode_14.3.1"
runsOn: macos-13
- destination: "OS=8.5,name=Apple Watch Series 7 (45mm)"
name: "watchOS 8.5"
xcode: "Xcode_14.3.1"
runsOn: macos-13
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Install Dependencies
run: brew bundle
- name: Generate project
run: xcodegen generate
- name: ${{ matrix.name }}
run: xcodebuild test -scheme "ServiceLocator" -destination "${{ matrix.destination }}" clean -enableCodeCoverage YES -resultBundlePath "test_output/${{ matrix.name }}.xcresult" || exit 1
- name: Upload coverage reports to Codecov
uses: codecov/[email protected]
with:
token: ${{ secrets.CODECOV_TOKEN }}
xcode: true
xcode_archive_path: test_output/${{ matrix.name }}.xcresult
- uses: actions/upload-artifact@v4
with:
name: ${{ matrix.name }}
path: test_output

merge-test-reports:
needs: [iOS, macOS, watchOS, tvOS]
runs-on: macos-13
steps:
- name: Download artifacts
uses: actions/download-artifact@v4
with:
path: test_output
- run: xcrun xcresulttool merge test_output/**/*.xcresult --output-path test_output/final/final.xcresult
- name: Upload Merged Artifact
uses: actions/upload-artifact@v4
with:
name: MergedResult
path: test_output/final

discover-typos:
name: Discover Typos
runs-on: macOS-12
env:
DEVELOPER_DIR: /Applications/Xcode_14.1.app/Contents/Developer
steps:
- uses: actions/checkout@v2
- name: Discover typos
run: |
export PATH="$PATH:/Library/Frameworks/Python.framework/Versions/3.11/bin"
python3 -m pip install --upgrade pip
python3 -m pip install codespell
codespell --ignore-words-list="hart,inout,msdos,sur" --skip="./.build/*,./.git/*"
29 changes: 29 additions & 0 deletions .github/workflows/danger.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: Danger

on:
pull_request:
types: [synchronize, opened, reopened, labeled, unlabeled, edited]

env:
LC_CTYPE: en_US.UTF-8
LANG: en_US.UTF-8

jobs:
run-danger:
runs-on: ubuntu-latest
steps:
- name: ruby setup
uses: ruby/setup-ruby@v1
with:
ruby-version: 3.1.4
bundler-cache: true
- name: Checkout code
uses: actions/checkout@v2
- name: Setup gems
run: |
gem install bundler
bundle install --clean --path vendor/bundle
- name: danger
env:
DANGER_GITHUB_API_TOKEN: ${{ secrets.DANGER_GITHUB_API_TOKEN }}
run: bundle exec danger --verbose
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -66,3 +66,8 @@ fastlane/test_output
# https://github.com/johnno1962/injectionforxcode

iOSInjectionProject/

# Other

*.xcodeproj
*.workspace
2 changes: 2 additions & 0 deletions Brewfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
brew "clang-format"
brew "xcodegen"
Loading

0 comments on commit 32057e7

Please sign in to comment.