diff options
| -rw-r--r-- | .dockerignore | 1 | ||||
| -rw-r--r-- | Pipfile | 3 | ||||
| -rw-r--r-- | Pipfile.lock | 16 | ||||
| -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, 67 insertions, 37 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 @@ -24,6 +24,7 @@ flake8-import-order = "*"  flake8-tidy-imports = "*"  flake8-todo = "*"  flake8-string-format = "*" +flake8-formatter-junit-xml = "*"  [requires]  python_version = "3.6" @@ -39,7 +40,5 @@ 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"  buildweb = "docker build -t pythondiscord/snekboxweb:latest -f docker/Dockerfile.webapp ."  pushweb = "docker push pythondiscord/snekboxweb:latest" diff --git a/Pipfile.lock b/Pipfile.lock index a7b5238..11a6201 100644 --- a/Pipfile.lock +++ b/Pipfile.lock @@ -1,7 +1,7 @@  {      "_meta": {          "hash": { -            "sha256": "5560465709134fb6096835f67c91567819bc6239a2f0182b2fca70ec3d0fb3f5" +            "sha256": "0c682a13bfe227f8f95421c69f8d68b6fca2d4a841a45688f2cac078a97b1db1"          },          "pipfile-spec": 6,          "requires": { @@ -192,6 +192,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", @@ -349,6 +357,12 @@              ],              "version": "==2.10"          }, +        "junit-xml": { +            "hashes": [ +                "sha256:602f1c480a19d64edb452bf7632f76b5f2cb92c1938c6e071dcda8ff9541dc21" +            ], +            "version": "==1.8" +        },          "markupsafe": {              "hashes": [                  "sha256:00bc623926325b26bb9605ae9eae8a215691f33cae5df11ca5424f06f2d1f473", @@ -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  |