diff options
| -rw-r--r-- | .dockerignore | 1 | ||||
| -rw-r--r-- | Pipfile | 3 | ||||
| -rw-r--r-- | Pipfile.lock | 34 | ||||
| -rw-r--r-- | README.md | 2 | ||||
| -rw-r--r-- | azure-pipelines.yml | 50 | ||||
| -rw-r--r-- | docker/ci.Dockerfile | 14 | ||||
| -rw-r--r-- | scripts/deploy.sh | 18 | 
7 files changed, 76 insertions, 46 deletions
| diff --git a/.dockerignore b/.dockerignore index 65555c9..8914ea8 100644 --- a/.dockerignore +++ b/.dockerignore @@ -16,4 +16,3 @@ docker  docker-compose.yml  LICENSE  README.md -tox.ini @@ -19,6 +19,7 @@ flake8-import-order = "*"  flake8-tidy-imports = "*"  flake8-todo = "*"  flake8-string-format = "*" +flake8-formatter-junit-xml = "*"  [requires]  python_version = "3.6" @@ -33,5 +34,3 @@ buildbox = "docker build -t pythondiscord/snekbox:latest -f docker/Dockerfile ."  pushbox = "docker push pythondiscord/snekbox:latest"  buildboxbase = "docker build -t pythondiscord/snekbox-base:latest -f docker/base.Dockerfile ."  pushboxbase = "docker push pythondiscord/snekbox-base:latest" -buildci = "docker build -t pythondiscord/snekbox-ci:latest -f docker/ci.Dockerfile ." -pushci = "docker push pythondiscord/snekbox-ci:latest" diff --git a/Pipfile.lock b/Pipfile.lock index c43ba17..358c6c0 100644 --- a/Pipfile.lock +++ b/Pipfile.lock @@ -1,7 +1,7 @@  {      "_meta": {          "hash": { -            "sha256": "69252c30c95d0d71881c0478808afefb980044b1f88590d088b4ea4483a138af" +            "sha256": "fe7027dedd12b67ee1b1f6a38e18184e8c3a77479b3ef564cce983d6816dc10d"          },          "pipfile-spec": 6,          "requires": { @@ -176,11 +176,11 @@          },          "flake8-bugbear": {              "hashes": [ -                "sha256:07b6e769d7f4e168d590f7088eae40f6ddd9fa4952bed31602def65842682c83", -                "sha256:0ccf56975f4db1d69dc1cf3598c99d768ebf95d0cad27d76087954aa399b515a" +                "sha256:5070774b668be92c4312e5ca82748ddf4ecaa7a24ff062662681bb745c7896eb", +                "sha256:fef9c9826d14ec23187ae1edeb3c6513c4e46bf0e70d86bac38f7d9aabae113d"              ],              "index": "pypi", -            "version": "==18.8.0" +            "version": "==19.3.0"          },          "flake8-docstrings": {              "hashes": [ @@ -190,6 +190,14 @@              "index": "pypi",              "version": "==1.3.0"          }, +        "flake8-formatter-junit-xml": { +            "hashes": [ +                "sha256:1ddd9356bb30ba736c3f14c769c837cfacf4f79c3d383ab963ef9d38eea05a9c", +                "sha256:6358a44ecafdf0f9c8ee5314859b8d6f553dc2e55e946a24c538185e1eba7ce6" +            ], +            "index": "pypi", +            "version": "==0.0.6" +        },          "flake8-import-order": {              "hashes": [                  "sha256:90a80e46886259b9c396b578d75c749801a41ee969a235e163cfe1be7afd2543", @@ -230,10 +238,10 @@          },          "identify": {              "hashes": [ -                "sha256:407cbb36e8b72b45cfa96a97ae13ccabca4c36557e03616958bd895dfcd3f77d", -                "sha256:721abbbb1269fa1172799119981c22c5ace022544ce82eedc29b1b0d753baaa5" +                "sha256:244e7864ef59f0c7c50c6db73f58564151d91345cd9b76ed793458953578cadd", +                "sha256:8ff062f90ad4b09cfe79b5dfb7a12e40f19d2e68a5c9598a49be45f16aba7171"              ], -            "version": "==1.4.0" +            "version": "==1.4.1"          },          "importlib-metadata": {              "hashes": [ @@ -250,6 +258,12 @@              "markers": "python_version < '3.7'",              "version": "==1.0.2"          }, +        "junit-xml": { +            "hashes": [ +                "sha256:602f1c480a19d64edb452bf7632f76b5f2cb92c1938c6e071dcda8ff9541dc21" +            ], +            "version": "==1.8" +        },          "mccabe": {              "hashes": [                  "sha256:ab8a6258860da4b6677da4bd2fe5dc2c659cff31b3ee4f7f5d64e79735b80d42", @@ -259,11 +273,11 @@          },          "more-itertools": {              "hashes": [ -                "sha256:0125e8f60e9e031347105eb1682cef932f5e97d7b9a1a28d9bf00c22a5daef40", -                "sha256:590044e3942351a1bdb1de960b739ff4ce277960f2425ad4509446dbace8d9d1" +                "sha256:2112d2ca570bb7c3e53ea1a35cd5df42bb0fd10c45f0fb97178679c3c03d64c7", +                "sha256:c3e4748ba1aad8dba30a4886b0b1a2004f9a863837b8654e7059eebf727afa5a"              ],              "markers": "python_version > '2.7'", -            "version": "==6.0.0" +            "version": "==7.0.0"          },          "nodeenv": {              "hashes": [ @@ -1,4 +1,4 @@ -[](https://gitlab.com/discord-python/projects/snekbox/commits/master) [](https://gitlab.com/discord-python/projects/snekbox/commits/master) +[](https://dev.azure.com/python-discord/Python%20Discord/_build/latest?definitionId=13&branchName=master)  # snekbox diff --git a/azure-pipelines.yml b/azure-pipelines.yml new file mode 100644 index 0000000..e423b28 --- /dev/null +++ b/azure-pipelines.yml @@ -0,0 +1,50 @@ +# https://aka.ms/yaml + +jobs: +- job: test +  displayName: 'Lint' + +  pool: +    vmImage: 'Ubuntu-16.04' + +  steps: +  - task: UsePythonVersion@0 +    displayName: 'Set Python version' +    inputs: +      versionSpec: '3.6.x' +      addToPath: true + +  - script: pip3 install pipenv +    displayName: 'Install pipenv' + +  - script: pipenv install --dev --deploy --system +    displayName: 'Install project using pipenv' + +  - script: python3 -m flake8 --format junit-xml --output-file test-lint.xml +    displayName: 'Run linter' + +  - task: PublishTestResults@2 +    condition: succeededOrFailed() +    inputs: +      testResultsFiles: '**/test-*.xml' +      testRunTitle: 'Snekbox Flake8 Lint Results' + +- job: build +  displayName: 'Build' +  dependsOn: test +  condition: and(succeeded(), ne(variables['Build.Reason'], 'PullRequest')) + +  steps: +  - task: Docker@1 +    displayName: 'Login: Docker Hub' + +    inputs: +      containerregistrytype: 'Container Registry' +      dockerRegistryEndpoint: 'DockerHub' +      command: 'login' + +  - script: docker build -t pythondiscord/snekbox:latest -f docker/Dockerfile . +    displayName: 'Build Final Image' + +  - script: docker push pythondiscord/snekbox:latest +    displayName: 'Push Image to Dockerhub' diff --git a/docker/ci.Dockerfile b/docker/ci.Dockerfile deleted file mode 100644 index 0d654fd..0000000 --- a/docker/ci.Dockerfile +++ /dev/null @@ -1,14 +0,0 @@ -FROM python:3.6.6-alpine3.7 - -RUN apk add --no-cache libstdc++ protobuf build-base docker - -ENV PIPENV_VENV_IN_PROJECT=1 -ENV PIPENV_IGNORE_VIRTUALENVS=1 -ENV PIPENV_NOSPIN=1 -ENV PIPENV_HIDE_EMOJIS=1 -ENV PYTHONPATH=/snekbox - -RUN pip install pipenv - -COPY binaries/nsjail2.5-alpine-x86_64 /usr/sbin/nsjail -RUN chmod +x /usr/sbin/nsjail diff --git a/scripts/deploy.sh b/scripts/deploy.sh deleted file mode 100644 index 9d4ec4f..0000000 --- a/scripts/deploy.sh +++ /dev/null @@ -1,18 +0,0 @@ -#!/bin/bash - -# Build and deploy on master branch -if [[ $CI_COMMIT_REF_SLUG == 'master' ]]; then -    echo "Connecting to docker hub" -    echo "$DOCKER_PASSWORD" | docker login -u "$DOCKER_USERNAME" --password-stdin - -    echo "Building image" -    pipenv run buildbox - -    echo "Pushing image" -    pipenv run pushbox - -    # echo "Deploying container" -    # curl -H "token: $AUTODEPLOY_TOKEN" $AUTODEPLOY_WEBHOOK -else -    echo "Skipping deploy" -fi | 
