Rijai reposetup (#1)
* Adding azure-pipelines.yml file to set up the build and a sample yml file to set up conda env on build machine * Update azure-pipelines.yml for Azure Pipelines [skip ci] * Update azure-pipelines.yml for Azure Pipelines [skip ci] * Update azure-pipelines.yml for Azure Pipelines [skip ci] * Update azure-pipelines.yml for Azure Pipelines [skip ci] * Update azure-pipelines.yml for Azure Pipelines [skip ci] * Adding config files to go with pre-commit checks, also added instruction for the same in the CONTRIBUTING.md guide
This commit is contained in:
Родитель
2c5b8e587e
Коммит
ca7ad2cadf
|
@ -0,0 +1,37 @@
|
|||
|
||||
# Pull request against these branches will trigger this build
|
||||
pr:
|
||||
- master
|
||||
- staging
|
||||
|
||||
#Any commit to this branch will trigger the build.
|
||||
trigger:
|
||||
- staging
|
||||
- master
|
||||
|
||||
pool:
|
||||
vmImage: 'ubuntu-16.04'
|
||||
|
||||
steps:
|
||||
|
||||
- bash: |
|
||||
echo "##vso[task.prependpath]/usr/share/miniconda/bin"
|
||||
displayName: Add Conda to PATH
|
||||
|
||||
- bash: |
|
||||
conda remove -q -n nlp --all -y
|
||||
conda env create -f environment.yml
|
||||
conda env list
|
||||
source activate nlp
|
||||
displayName: 'Build Configuration'
|
||||
|
||||
- bash: |
|
||||
source activate nlp
|
||||
python -m ipykernel install --user --name nlp --display-name "nlp"
|
||||
# pytest --junitxml=junit/test-unitttest.xml #not running any tests for now
|
||||
displayName: 'Run Unit tests'
|
||||
|
||||
- task: PublishTestResults@2
|
||||
inputs:
|
||||
testResultsFiles: '**/test-unitttest.xml'
|
||||
testRunTitle: 'Test results for PyTest'
|
|
@ -0,0 +1,16 @@
|
|||
[flake8]
|
||||
# Intial set of rules
|
||||
# Feel Free to add any new rule here with description of what it does.
|
||||
|
||||
# E203 Whitespace before ':'
|
||||
# E266 Too many leading '#' for block comment
|
||||
# E501 Line too long (82 > 79 characters)
|
||||
# W503 Line break occurred before a binary operator
|
||||
# F403 'from module import *' used; unable to detect undefined names
|
||||
# F405 '<function>' may be undefined, or defined from star imports
|
||||
# E402 module level import not at top of file
|
||||
# E731 do not assign a lambda expression, use a def
|
||||
# F821 undefined name 'get_ipython' --> from generated python files using nbconvert
|
||||
|
||||
ignore = E203, E266, W503, F403, F405, E402, E731, F821
|
||||
max-line-length = 79
|
|
@ -0,0 +1,10 @@
|
|||
repos:
|
||||
- repo: https://github.com/ambv/black
|
||||
rev: stable
|
||||
hooks:
|
||||
- id: black
|
||||
language_version: python3.6
|
||||
- repo: https://github.com/pre-commit/pre-commit-hooks
|
||||
rev: v1.2.3
|
||||
hooks:
|
||||
- id: flake8
|
|
@ -2,10 +2,14 @@
|
|||
|
||||
Contribution are welcome! Here's a few things to know:
|
||||
|
||||
* [Microsoft Contributor License Agreement](#microsoft-contributor-license-agreement)
|
||||
* [Steps to Contributing](#steps-to-contributing)
|
||||
* [Coding Guidelines](#recommenders-team-contribution-guidelines)
|
||||
* [Code of Conduct](#code-of-conduct)
|
||||
- [Contribution Guidelines](#contribution-guidelines)
|
||||
- [Microsoft Contributor License Agreement](#microsoft-contributor-license-agreement)
|
||||
- [Steps to Contributing](#steps-to-contributing)
|
||||
- [Coding Guidelines](#coding-guidelines)
|
||||
- [Code of Conduct](#code-of-conduct)
|
||||
- [Do not point fingers](#do-not-point-fingers)
|
||||
- [Provide code feedback based on evidence](#provide-code-feedback-based-on-evidence)
|
||||
- [Ask questions do not give answers](#ask-questions-do-not-give-answers)
|
||||
|
||||
## Microsoft Contributor License Agreement
|
||||
|
||||
|
@ -22,7 +26,25 @@ Here are the basic steps to get started with your first contribution. Please rea
|
|||
4. Create a test that replicates the issue.
|
||||
5. Make code changes.
|
||||
6. Ensure unit tests pass and code style / formatting is consistent (see [wiki](https://github.com/Microsoft/Recommenders/wiki/Coding-Guidelines#python-and-docstrings-style) for more details).
|
||||
7. Create a pull request against <b>staging</b> branch.
|
||||
7. We use [pre-commit](https://pre-commit.com/) package to run our pre-commit hooks. We use black formatter and flake8 linting on each commit. In order to set up pre-commit on your machine, follow the steps here, please note that you only need to run these steps the first time you use pre-commit for this project.
|
||||
|
||||
* Update your conda environment, pre-commit is part of the yaml file or just do
|
||||
```
|
||||
$ pip install pre-commit
|
||||
```
|
||||
* Set up pre-commit by running following command, this will put pre-commit under your .git/hooks directory.
|
||||
```
|
||||
$ pre-commit install
|
||||
```
|
||||
```
|
||||
$ git commit -m "message"
|
||||
```
|
||||
* Each time you commit, git will run the pre-commit hooks (black and flake8 for now) on any python files that are getting committed and are part of the git index. If black modifies/formats the file, or if flake8 finds any linting errors, the commit will not succeed. You will need to stage the file again if black changed the file, or fix the issues identified by flake8 and and stage it again.
|
||||
|
||||
* To run pre-commit on all files just run
|
||||
```
|
||||
$ pre-commit run --all-files
|
||||
8. Create a pull request against <b>staging</b> branch.
|
||||
|
||||
Note: We use the staging branch to land all new features, so please remember to create the Pull Request against staging.
|
||||
|
||||
|
|
|
@ -0,0 +1,25 @@
|
|||
#
|
||||
# To create the conda environment:
|
||||
# $ conda env create -f environment.yml
|
||||
#
|
||||
# To update the conda environment:
|
||||
# $ conda env update -f environment.yml
|
||||
#
|
||||
# To register the conda environment in Jupyter:
|
||||
# $ conda activate nlp
|
||||
# $ python -m ipykernel install --user --name nlp
|
||||
#
|
||||
name: nlp
|
||||
channels:
|
||||
- defaults
|
||||
- conda-forge
|
||||
dependencies:
|
||||
- python==3.6.8
|
||||
- ipykernel>=4.6.1
|
||||
- jupyter>=1.0.0
|
||||
- pytest>=3.6.4
|
||||
- pip:
|
||||
- black>=18.6b4
|
||||
- papermill>=0.15.0
|
||||
- ipywebrtc
|
||||
- pre-commit>=1.14.4
|
|
@ -0,0 +1,2 @@
|
|||
[tool.black]
|
||||
line-length = 79
|
Загрузка…
Ссылка в новой задаче