Skip to content

Commit

Permalink
Merge pull request #3 from HannaAndreevna/master
Browse files Browse the repository at this point in the history
Create service by template
  • Loading branch information
starkmsu authored May 18, 2020
2 parents 3ef97f5 + c227182 commit d2cc85f
Show file tree
Hide file tree
Showing 41 changed files with 1,290 additions and 0 deletions.
84 changes: 84 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
# EditorConfig is awesome:http://EditorConfig.org

# top-most EditorConfig file
root = true

# Don't use tabs for indentation.
[*]
indent_style = space
end_of_line = lf
# (Please don't specify an indent_size here; that has too many unintended consequences.)

# Code files
[*.{cs,csx}]
indent_size = 4
insert_final_newline = true
charset = utf-8-bom

[*.{sln,csproj}]
end_of_line = crlf

# Xml project files
[*.{csproj,vbproj,vcxproj,vcxproj.filters,proj,projitems,shproj}]
indent_size = 2

# Xml config files
[*.{props,targets,ruleset,config,nuspec,resx,vsixmanifest,vsct}]
indent_size = 2

# JSON files
[*.json]
indent_size = 2

# Dotnet code style settings:
[*.{cs}]
# Sort using and Import directives with System.* appearing first
dotnet_sort_system_directives_first = true
# Avoid "this." and "Me." if not necessary
dotnet_style_qualification_for_field = false:suggestion
dotnet_style_qualification_for_property = false:suggestion
dotnet_style_qualification_for_method = false:suggestion
dotnet_style_qualification_for_event = false:suggestion

# Use language keywords instead of framework type names for type references
dotnet_style_predefined_type_for_locals_parameters_members = true:suggestion
dotnet_style_predefined_type_for_member_access = true:suggestion

# Suggest more modern language features when available
dotnet_style_object_initializer = true:suggestion
dotnet_style_collection_initializer = true:suggestion
dotnet_style_coalesce_expression = true:suggestion
dotnet_style_null_propagation = true:suggestion
dotnet_style_explicit_tuple_names = true:suggestion

# CSharp code style settings:
[*.cs]
# Prefer "var" everywhere
csharp_style_var_for_built_in_types = true:suggestion
csharp_style_var_when_type_is_apparent = true:suggestion
csharp_style_var_elsewhere = true:suggestion

# Prefer method-like constructs to have a block body
csharp_style_expression_bodied_methods = false:none
csharp_style_expression_bodied_constructors = false:none
csharp_style_expression_bodied_operators = false:none

# Prefer property-like constructs to have an expression-body
csharp_style_expression_bodied_properties = true:none
csharp_style_expression_bodied_indexers = true:none
csharp_style_expression_bodied_accessors = true:none

# Suggest more modern language features when available
csharp_style_pattern_matching_over_is_with_cast_check = true:suggestion
csharp_style_pattern_matching_over_as_with_null_check = true:suggestion
csharp_style_inlined_variable_declaration = true:suggestion
csharp_style_throw_expression = true:suggestion
csharp_style_conditional_delegate_call = true:suggestion

# Newline settings
csharp_new_line_before_open_brace = all
csharp_new_line_before_else = true
csharp_new_line_before_catch = true
csharp_new_line_before_finally = true
csharp_new_line_before_members_in_object_initializers = true
csharp_new_line_before_members_in_anonymous_types = true
21 changes: 21 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Auto normalize line-endings

* text eol=lf encoding=UTF-8

# Always LF line-endings

*.sh text eol=lf

# Always CRLF line-endings

*.sln text eol=crlf
*.csproj text eol=crlf

# Diff settings

*.cs diff=csharp text
*.vb text
*.ttf -text diff
*.eot -text diff
*.woff -text diff
*.woff2 -text diff
104 changes: 104 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
name: release

on:
release:
types:
- published

env:
RELEASE_CLIENT: true
RELEASE_CONTRACT: true
RELEASE_JOB: false
RELEASE_SERVICE: true

CLIENT_PROJECT: ./client/MAVN.Service.Kyc.Client/MAVN.Service.Kyc.Client.csproj
CONTRACT_PROJECT: ./contract/MAVN.Service.Kyc.Contract/MAVN.Service.Kyc.Contract.csproj
JOB_DOCKER_IMAGE: Kyc-job
JOB_PROJECT: ./src/MAVN.Job.Kyc/MAVN.Job.Kyc.csproj
SERVICE_DOCKER_IMAGE: Kyc-service # this template value must be fixed in most cases
SERVICE_PROJECT: ./src/MAVN.Service.Kyc/MAVN.Service.Kyc.csproj



jobs:
publish-release:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2

# Set release version
- name: Get release version from tag
id: version
uses: LykkeBusiness/[email protected]
with:
tag: ${{ github.ref }}
- name: Set version for release
uses: allenevans/[email protected]
with:
VERSION: ${{ steps.version.outputs.non-prefixed }}

# Login to Docker Hub
- name: Login to docker hub
if: env.RELEASE_JOB == 'true' || env.RELEASE_SERVICE == 'true'
env:
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }}
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}
run: docker login --username $DOCKER_USERNAME --password $DOCKER_PASSWORD

# Build solution
- name: Setup .NET Core
uses: actions/setup-dotnet@v1
with:
dotnet-version: 3.1.201
- name: Install dependencies
run: dotnet restore
- name: Build solution
run: dotnet build --configuration Release --no-restore /p:Version=$VERSION

# Build Docker images
- name: Build docker image for a job
if: env.RELEASE_JOB == 'true'
run: |
dotnet publish $JOB_PROJECT --configuration Release --output ./docker/job --no-build /p:Version=$VERSION
docker build --tag openmavn/$JOB_DOCKER_IMAGE:$VERSION ./docker/job
- name: Build docker image for a service
if: env.RELEASE_SERVICE == 'true'
run: |
dotnet publish $SERVICE_PROJECT --configuration Release --output ./docker/service --no-build /p:Version=$VERSION
docker build --tag openmavn/$SERVICE_DOCKER_IMAGE:$VERSION ./docker/service
# Pack NuGet packages
- name: Pack client NuGet package
if: env.RELEASE_CLIENT == 'true'
run: dotnet pack $CLIENT_PROJECT --configuration Release --output ./packages --no-build --include-symbols --include-source /p:SymbolPackageFormat=snupkg /p:Version=$VERSION
- name: Pack contract NuGet package
if: env.RELEASE_CONTRACT == 'true'
run: dotnet pack $CONTRACT_PROJECT --configuration Release --output ./packages --no-build --include-symbols --include-source /p:SymbolPackageFormat=snupkg /p:Version=$VERSION

# Push Docker Images
- name: Push job docker image
if: env.RELEASE_JOB == 'true'
run: docker push openmavn/$JOB_DOCKER_IMAGE:$VERSION
- name: Push service docker image
if: env.RELEASE_SERVICE == 'true'
run: docker push openmavn/$SERVICE_DOCKER_IMAGE:$VERSION

# Push NuGet packages
- name: Push NuGet packages
if: env.RELEASE_CLIENT == 'true' || env.RELEASE_CONTRACT == 'true'
env:
API_KEY: ${{ secrets.NUGET_ORG_API_KEY }}
run: dotnet nuget push ./packages/**/*.nupkg --source https://api.nuget.org/v3/index.json --api-key $API_KEY

# Create next release draft
- name: Create next release draft
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: next
release_name: next
body:
draft: true
31 changes: 31 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: test

on:
pull_request:
branches: [ master ]
push:
branches: [ master ]

jobs:
build:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- name: Setup .NET Core
uses: actions/setup-dotnet@v1
with:
dotnet-version: 3.1.201
- name: Install dependencies
run: dotnet restore
- name: Build
run: dotnet build --configuration Release --no-restore
- name: Test
run: dotnet test --no-restore --verbosity normal /p:CollectCoverage=true /p:CoverletOutput=TestResults/ /p:CoverletOutputFormat=lcov
- name: Publish coverage report
if: github.event_name == 'push'
uses: coverallsapp/github-action@master
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
path-to-lcov: ./tests/MAVN.Service.Kyc.Tests/TestResults/coverage.info
63 changes: 63 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
# Global wildcards
*.aps
*.bak
*.dll
*.log
*.ncb
*.obj
*.old
*.opensdf
*.orig
*.pdb
*.Publish.xml
*.sdf
*.sln.cache
*.suo
*.tmp
*.user
*.lock.json

# Well-known infrastructure folders
/packages/
/target/
**/aspnet_client/

# IDEs
*[Rr]e[Ss]harper*
**/.idea/
**/.metadata/
**/.settings/
/[Tt]est[Rr]esults/
[Bb]in/
[Oo]bj/
[Dd]ebug/
[Rr]elease/
ipch/

# Visual Studio project upgrade
[Bb]ackup/
UpgradeLog*
_UpgradeReport_Files/

# Operating Systems generated
.DS_Store
[Dd]esktop.ini
[Tt]humbs.db

#ncrunch
*.*crunch*
_NCrunch_*

#publish profiles
*publish.ps1
*.pubxml
*.psm1

#some test
.vs
node_modules
**/launchSettings.json
**/appsettings.json
**/appsettings.*.json
**/*sonar*
/client/**/*.xml
67 changes: 67 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
# How to contribute

First of all, thank you for wanting to contribute! We really appreciate all the awesome support we get from our community. We want to keep it as easy as possible to contribute changes that get things working in your environment. There are a few guidelines we need contributors to follow to keep the project flowing smoothly.

These guidelines are for code changes but we are always very grateful to receive other forms of contribution.

## Preparation

Before starting work on a *functional* change, i.e. a new feature, a change to an existing feature or a fixing a bug, please ensure an [issue has been raised](https://github.com/OpenMAVN/MAVN.Service.Kyc/issues/). Indicate your intention to do the work by writing a comment on the issue. This will prevent duplication of effort. If the change is non-trivial, it's usually best to propose a design in the issue comments before making a significant effort on the implementation.

It is **not** necessary to raise an issue for non-functional changes, e.g. refactoring, adding tests, reformatting code, documentation, updating packages, etc.

## Tests

All new features must be covered by feature tests.

## Branches

There is a single mainline branches `master` which is used for trunk-based development work. All new features, changes, etc. must be applied to `master`.

## Making changes

1. [Fork](http://help.github.com/forking/) on GitHub
1. Clone your fork locally
1. Configure the `upstream` repo (`git remote add upstream git://github.com/OpenMAVN/MAVN.Service.Kyc.git`)
1. Checkout `master` (`git checkout master`)
1. Create a local branch (`git checkout -b my-branch`). The branch name should be descriptive, or it can just be the GitHub issue number which the work relates to, e.g. `123`.
1. Work on your change
1. Rebase if required (see 'Handling updates from `upstream`' below)
1. Test the build locally
1. Push the branch up to GitHub (`git push origin my-branch`)
1. Send a pull request on GitHub (see 'Sending a Pull Request' below)

You should **never** work on a clone of `master`, and you should **never** send a pull request from `master`. Always use a feature/patch branch. The reasons for this are detailed below.

## Handling updates from `upstream`

While you're working away in your branch it's quite possible that your `upstream` `master` may be updated. If this happens you should:

1. [Stash](https://git-scm.com/book/en/v2/Git-Tools-Stashing-and-Cleaning) any un-committed changes you need to
1. `git checkout master`
1. `git pull upstream master --ff-only`
1. `git checkout my-branch`
1. `git rebase master my-branch`
1. `git push origin master` (optional) this keeps `master` in your fork up to date

These steps ensure your history is "clean" i.e. you have one branch from `master` followed by your changes in a straight line. Failing to do this ends up with several "messy" merges in your history, which we don't want. This is the reason why you should always work in a branch and you should never be working in or sending pull requests from `master`.

If you're working on a long running feature you may want to do this quite often to reduce the risk of tricky merges later on.

## Sending a pull request

While working on your feature you may well create several branches, which is fine, but before you send a pull request you should ensure that you have rebased back to a single "feature/patch branch". We care about your commits, and we care about your feature/patch branch, but we don't care about how many or which branches you created while you were working on it. :smile:

When you're ready to go you should confirm that you are up to date and rebased with `upstream` `master` (see "Handling updates from `upstream`" above) and then:

1. `git push origin my-branch`
1. Send a descriptive [pull request](https://help.github.com/en/github/collaborating-with-issues-and-pull-requests/about-pull-requests) on GitHub.
- Make sure the pull request is **from** the branch on your fork **to** the `OpenMAVN/MAVN.Service.Kyc` `master`.
- If your changes relate to a GitHub issue, add the issue number to the pull request description in the format `#123`.
1. If GitHub determines that the pull request can be merged automatically, a test build will commence shortly after you raise the pull request. The build status will be reported on the pull request.
- If the build fails, there may be a problem with your changes which you will have to fix before the pull request can be merged. Follow the link to the build server and inspect the build logs to see what caused the failure.
- Occasionally, build failures may be due to problems on the build server rather than problems in your changes. If you determine this to be the case, please add a comment on the pull request and one of the maintainers will address the problem.

## What happens next?

The maintainers will review your pull request and provide any feedback required.
Loading

0 comments on commit d2cc85f

Please sign in to comment.