diff options
| -rw-r--r-- | .dockerignore | 2 | ||||
| -rw-r--r-- | Dockerfile | 10 | ||||
| -rw-r--r-- | docs/contributing/1.-contributing-guide.md | 27 | ||||
| -rwxr-xr-x | scripts/docker.sh | 12 |
4 files changed, 49 insertions, 2 deletions
diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 00000000..3e4b57aa --- /dev/null +++ b/.dockerignore @@ -0,0 +1,2 @@ +.git* +docs/ diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 00000000..bf4ae2bf --- /dev/null +++ b/Dockerfile @@ -0,0 +1,10 @@ +ARG VERSION=3 +FROM python:$VERSION + +RUN mkdir /isort +WORKDIR /isort +COPY . /isort + +RUN python3 -m pip install poetry && poetry install + +CMD /isort/scripts/done.sh diff --git a/docs/contributing/1.-contributing-guide.md b/docs/contributing/1.-contributing-guide.md index 6503fc1b..1455f903 100644 --- a/docs/contributing/1.-contributing-guide.md +++ b/docs/contributing/1.-contributing-guide.md @@ -28,7 +28,26 @@ Once you have verified that your system matches the base requirements you can st 4. `poetry install` * Optionally, isolate poetry's installation from the rest of your system using the instructions on the poetry site here: https://python-poetry.org/docs/#installation 5. `./scripts/test.sh` should yield Success: no issues found -6. `./scripts/done.sh` should yield a Safety report checking packages +6. `./scripts/clean.sh` should yield a Safety report checking packages + +### Docker development + +If you would instead like to develop using Docker, the only local requirement is docker. +See the [docker docs](https://docs.docker.com/get-started/) if you have not used docker before. + +Once you have the docker daemon running and have cloned the repository, you can get started by following these steps: + +1. `cd isort` +2. `./scripts/docker.sh` + +A local test cycle might look like the following: + +1. `docker build ./ -t isort:latest` +2. `docker run isort` +3. if #2 fails, debug, save, and goto #1; `docker run -it isort bash` will get you into the failed environment +4. `./scripts/docker.sh` +5. if #4 fails, debug, save and goto #1; you may need to specify a different `--build-arg VERSION=$VER` +6. congrats! you are probably ready to push a contribution ## Making a contribution Congrats! You're now ready to make a contribution! Use the following as a guide to help you reach a successful pull-request: @@ -40,7 +59,11 @@ Congrats! You're now ready to make a contribution! Use the following as a guide 2. Create an issue branch for your local work `git checkout -b issue/$ISSUE-NUMBER`. 3. Do your magic here. 4. Ensure your code matches the [HOPE-8 Coding Standard](https://github.com/hugapi/HOPE/blob/master/all/HOPE-8--Style-Guide-for-Hug-Code.md#hope-8----style-guide-for-hug-code) used by the project. -5. Submit a pull request to the main project repository via GitHub. +5. Run tests locally to make sure everything is still working + `./scripts/done.sh` + _Or if you are using Docker_ + `docker run isort:latest` +6. Submit a pull request to the main project repository via GitHub. Thanks for the contribution! It will quickly get reviewed, and, once accepted, will result in your name being added to the acknowledgments list :). diff --git a/scripts/docker.sh b/scripts/docker.sh new file mode 100755 index 00000000..364bb570 --- /dev/null +++ b/scripts/docker.sh @@ -0,0 +1,12 @@ +#!/bin/bash +set -ux + +result=0 + +for ver in {3.6,3.7,3.8}; do + # latest tag will override after each build, leaving only the newest python version tagged + docker build ./ --build-arg VERSION=$ver -t "isort:$ver" -t "isort:latest" && docker run "isort:$ver" + result=$(( $? + $result )) +done + +exit $result |
