Skip to content

Commit

Permalink
release 0.1
Browse files Browse the repository at this point in the history
  • Loading branch information
Renat Shajmardanov committed Jul 31, 2020
0 parents commit 5635ac0
Show file tree
Hide file tree
Showing 54 changed files with 3,562 additions and 0 deletions.
31 changes: 31 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
[*]
charset = utf-8
end_of_line = crlf
indent_size = 4
indent_style = space
insert_final_newline = true
max_line_length = 120
tab_width = 4
trim_trailing_whitespace = true

[*.cs]
csharp_braces_for_for = required
csharp_braces_for_foreach = required
csharp_braces_for_ifelse = required
csharp_braces_for_while = required
csharp_use_heuristics_for_body_style = false
csharp_keep_existing_attribute_arrangement = false
csharp_place_attribute_on_same_line = never
csharp_wrap_after_declaration_lpar = true
csharp_wrap_parameters_style = chop_if_long
csharp_wrap_before_comma = false
# var preferences
csharp_for_built_in_types = use_var_when_evident
csharp_for_simple_types = use_var_when_evident
csharp_for_other_types = use_var_when_evident

[{*.yaml, *.yml}]
indent_size = 2
trim_trailing_whitespace = true
insert_final_newline = false
max_line_length = off
76 changes: 76 additions & 0 deletions .github/CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
# Contributor Covenant Code of Conduct

## Our Pledge

In the interest of fostering an open and welcoming environment, we as
contributors and maintainers pledge to making participation in our project and
our community a harassment-free experience for everyone, regardless of age, body
size, disability, ethnicity, sex characteristics, gender identity and expression,
level of experience, education, socio-economic status, nationality, personal
appearance, race, religion, or sexual identity and orientation.

## Our Standards

Examples of behavior that contributes to creating a positive environment
include:

* Using welcoming and inclusive language
* Being respectful of differing viewpoints and experiences
* Gracefully accepting constructive criticism
* Focusing on what is best for the community
* Showing empathy towards other community members

Examples of unacceptable behavior by participants include:

* The use of sexualized language or imagery and unwelcome sexual attention or
advances
* Trolling, insulting/derogatory comments, and personal or political attacks
* Public or private harassment
* Publishing others' private information, such as a physical or electronic
address, without explicit permission
* Other conduct which could reasonably be considered inappropriate in a
professional setting

## Our Responsibilities

Project maintainers are responsible for clarifying the standards of acceptable
behavior and are expected to take appropriate and fair corrective action in
response to any instances of unacceptable behavior.

Project maintainers have the right and responsibility to remove, edit, or
reject comments, commits, code, wiki edits, issues, and other contributions
that are not aligned to this Code of Conduct, or to ban temporarily or
permanently any contributor for other behaviors that they deem inappropriate,
threatening, offensive, or harmful.

## Scope

This Code of Conduct applies both within project spaces and in public spaces
when an individual is representing the project or its community. Examples of
representing a project or community include using an official project e-mail
address, posting via an official social media account, or acting as an appointed
representative at an online or offline event. Representation of a project may be
further defined and clarified by project maintainers.

## Enforcement

Instances of abusive, harassing, or otherwise unacceptable behavior may be
reported by contacting the project team at [email protected]. All
complaints will be reviewed and investigated and will result in a response that
is deemed necessary and appropriate to the circumstances. The project team is
obligated to maintain confidentiality with regard to the reporter of an incident.
Further details of specific enforcement policies may be posted separately.

Project maintainers who do not follow or enforce the Code of Conduct in good
faith may face temporary or permanent repercussions as determined by other
members of the project's leadership.

## Attribution

This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
available at <https://www.contributor-covenant.org/version/1/4/code-of-conduct.html>

[homepage]: https://www.contributor-covenant.org

For answers to common questions about this code of conduct, see
<https://www.contributor-covenant.org/faq>
45 changes: 45 additions & 0 deletions .github/CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# Contributing

When contributing to this repository, please first discuss the change you wish to make via issue with the owners of this repository before making a change.

## Pull Request Process

We use github to host code, to track issues and feature requests, as well as accept pull requests.

Pull requests are the best way to propose changes to the codebase (we use [Github Flow](https://guides.github.com/introduction/flow/index.html)).
We actively welcome your pull requests:

1. Fork the repo and create your branch from master.
2. If you've added code that should be tested, add tests.
3. If you've changed APIs, update the documentation.
4. Increase the `VersionPrefix` in [Dodo.DataMover.csproj](src/Dodo.DataMover/Dodo.DataMover.csproj). \
The versioning scheme we use is [SemVer](https://semver.org/). \
The `VersionPrefix` should contains only major and minor versions (ex: `1.2`).
5. Ensure the test suite passes.
6. Issue that pull request.
7. Properly fill pull request body section. Best practice here is to describe your changes as a list of changes and add link to the according issue for each change.

## Report bugs and feature suggestions using Github's issues

We use GitHub issues to track public bugs and feature suggestions. Report a bug or suggest a feature by opening a new issue.

## Use a Consistent Coding Style

This project uses [EditorConfig](https://editorconfig.org/). All style settings you may find in the [.editorconfig](../.editorconfig) file.

Please, use consistent code style in your contributions.

## License

By contributing, you agree that your contributions will be licensed under its [Apache License 2.0](../LICENSE).

## Code of Conduct

This project has adopted the [Code of Conduct](./CODE_OF_CONDUCT.md).

## NuGet package release process for repository owners and collaborators

You can find latest releases on the [releases pane](https://github.com/dodopizza/mysql-data-mover/releases) or NuGet repository.
Description of the CI workflows and release process described [here](/.github/workflows/CI_AND_RELEASE.md).

**Must read** if you plan to publish new release or prerelease version of the package.
27 changes: 27 additions & 0 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
---
name: Bug report
about: Create a report to help us improve
title: ''
labels: ''
assignees: ''

---

**Describe the bug**
A clear and concise description of what the bug is.

**To Reproduce**
Steps to reproduce the behavior:
1. Go to '...'
2. Click on '....'
3. Scroll down to '....'
4. See error

**Expected behavior**
A clear and concise description of what you expected to happen.

**Screenshots**
If applicable, add screenshots to help explain your problem.

**Additional information**
Add any other context about the problem here.
14 changes: 14 additions & 0 deletions .github/ISSUE_TEMPLATE/feature_request.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
---
name: Feature request
about: Suggest an idea for this project
title: ''
labels: ''
assignees: ''

---

**Problem description**
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]

**Additional information**
Add any other context or screenshots about the feature request here.
32 changes: 32 additions & 0 deletions .github/workflows/CI_AND_RELEASE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# Continuous Integration and Release Process

This project has adopted [GitHub Flow](https://guides.github.com/introduction/flow/index.html) for development lifecycle.

Also Continuous Integration (CI) and some routine actions are achieved using [GitHub Actions](https://github.com/features/actions).

## Workflows

There are several workflows to react on different GitHub events:

- [Continuous Integration](./on-push.yml)
- _Purpose_: Build application docker image and run unit tests to ensure that changes doesn't broke anything.
- _Run conditions_: Runs on every `push` event to any branch except `master`.

- [On Pull Request](./on-pull-request.yml)
- _Purpose_: Build application docker image and run unit and integration tests to ensure that changes doesn't broke anything.
- _Run conditions_: On every `pull request` to `master` branch.

- [On Push to Master](./on-push-to-master.yml)
- _Purpose_: Build application docker image and run unit and integration tests on `master` branch and create draft for the release.
- _Run conditions_: Runs on every `push` event to `master` branch.

- [On Release](./on-release.yml)
- _Purpose_: Publish new release as Docker image into [Docker Hub](https://hub.docker.com/r/dodopizza/mysql-data-mover).
- _Run conditions_: Runs on every `release published` event.

## How to publish new release

1. On every `push` event to `master` branch there is created draft for the future release (automated with `On Push To Master` workflow).
2. Double check application version in the `VersionPrefix` field in [Dodo.DataMover.csproj](src/Dodo.DataMover/Dodo.DataMover.csproj).
3. You have to check release notes in the release draft. It is good practices to describe all changes in the release and add links to the issues for each change.
4. Publish the release. `On Release` workflow will publish new release as Docker image into [Docker Hub](https://hub.docker.com/r/dodopizza/mysql-data-mover).
27 changes: 27 additions & 0 deletions .github/workflows/on-pull-request.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: Pull Request

on:
pull_request:
branches:
- master

jobs:
build:
name: Pull request
runs-on: ubuntu-18.04
steps:

- name: Checkout code
uses: actions/checkout@v2

- name: Build and test
uses: docker/build-push-action@v1
with:
push: false
repository: dodopizza/mysql-data-mover
tags: test

- name: Integration test
timeout-minutes: 10
run: |
./run-integration-tests.sh -t 'test'
68 changes: 68 additions & 0 deletions .github/workflows/on-push-to-master.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
name: Push to master

on:
push:
branches:
- master

jobs:
build:
name: Push to master
runs-on: ubuntu-18.04
steps:

- name: Checkout code
uses: actions/checkout@v2

- name: Set common vars
id: common_vars
run: |
version_prefix=$(cat ./src/Dodo.DataMover/Dodo.DataMover.csproj | grep "<VersionPrefix>" | sed -e "s/ *<\/*VersionPrefix>//g")
version_suffix="${{ github.run_number }}"
if [ -z "${version_prefix}" ]; then exit 1; fi
app_version="${version_prefix}.${version_suffix}"
echo "app_version: ${app_version}"
echo "::set-output name=app_version::${app_version}"
- name: Build image
uses: docker/build-push-action@v1
with:
push: false
repository: dodopizza/mysql-data-mover
tags: ${{ steps.common_vars.outputs.app_version }}

- name: Integration test
timeout-minutes: 30
run: |
./run-integration-tests.sh -t ${{ steps.common_vars.outputs.app_version }}
- name: Get binaries from builded image
run: |
mkdir ./output
id=$( docker create dodopizza/mysql-data-mover:${{ steps.common_vars.outputs.app_version }} )
docker cp $id:/app/ ./output
docker rm -v $id
ls -l ./output
cd ./output
zip -r ./mysql-data-mover.zip .
- name: Create draft release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ steps.common_vars.outputs.app_version }}
release_name: Release v${{ steps.common_vars.outputs.app_version }}
draft: true
prerelease: false

- name: Upload release asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./output/mysql-data-mover.zip
asset_name: mysql-data-mover-${{ steps.common_vars.outputs.app_version }}.zip
asset_content_type: application/zip
23 changes: 23 additions & 0 deletions .github/workflows/on-push.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: Build and test

on:
push:
branches:
- "*"
- "!master"

jobs:
build:
name: Build and test
runs-on: ubuntu-18.04
steps:

- name: Checkout code
uses: actions/checkout@v2

- name: Build and test
uses: docker/build-push-action@v1
with:
push: false
repository: dodopizza/mysql-data-mover
tags: test
33 changes: 33 additions & 0 deletions .github/workflows/on-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: Release

on:
release:
types: [published]

jobs:
build:
name: Release
runs-on: ubuntu-18.04
steps:

- name: Checkout code
uses: actions/checkout@v2

- name: Set common vars
id: common_vars
# Ex:
# refs/tags/0.1.12345 -> 0.1.12345
run: |
app_version=$( echo ${{ github.ref }} | sed -n 's/refs\/tags\/\(.*\)/\1/p' )
if [ -z "${app_version}" ]; then exit 1; fi
echo "app_version: ${app_version}"
echo "::set-output name=app_version::${app_version}"
- name: Build and push image
uses: docker/build-push-action@v1
with:
push: true
username: ${{ secrets.DOCKERHUB_REGISTRY_USER }}
password: ${{ secrets.DOCKERHUB_REGISTRY_PASSWORD }}
repository: dodopizza/mysql-data-mover
tags: ${{ steps.common_vars.outputs.app_version }}
Loading

0 comments on commit 5635ac0

Please sign in to comment.