diff --git a/.drone.jsonnet b/.drone.jsonnet index b174d0c..d3cd828 100644 --- a/.drone.jsonnet +++ b/.drone.jsonnet @@ -5,8 +5,8 @@ local PythonVersion(pyversion='3.5') = { PY_COLORS: 1, }, commands: [ - 'pip install -r test-requirements.txt -qq', - 'pip install -qq .', + 'pip install pipenv -qq', + 'pipenv install --dev', 'docker-tidy --help', ], depends_on: [ @@ -29,8 +29,8 @@ local PipelineLint = { PY_COLORS: 1, }, commands: [ - 'pip install -r test-requirements.txt -qq', - 'pip install -qq .', + 'pip install pipenv -qq', + 'pipenv install --dev', 'flake8 ./dockertidy', ], }, @@ -40,6 +40,36 @@ local PipelineLint = { }, }; +local PipelineDeps = { + kind: 'pipeline', + name: 'dependencies', + platform: { + os: 'linux', + arch: 'amd64', + }, + steps: [ + { + name: 'pipenv', + image: 'python:3.7', + environment: { + PY_COLORS: 1, + }, + commands: [ + 'pip install pipenv -qq', + 'pipenv install --dev', + 'pipenv check', + 'pipenv-sync check', + ], + }, + ], + depends_on: [ + 'lint', + ], + trigger: { + ref: ['refs/heads/master', 'refs/tags/**', 'refs/pull/**'], + }, +}; + local PipelineTest = { kind: 'pipeline', name: 'test', @@ -51,10 +81,10 @@ local PipelineTest = { PythonVersion(pyversion='3.5'), PythonVersion(pyversion='3.6'), PythonVersion(pyversion='3.7'), - PythonVersion(pyversion='3.8-rc'), + PythonVersion(pyversion='3.8'), ], depends_on: [ - 'lint', + 'dependencies', ], trigger: { ref: ['refs/heads/master', 'refs/tags/**', 'refs/pull/**'], @@ -76,8 +106,8 @@ local PipelineSecurity = { PY_COLORS: 1, }, commands: [ - 'pip install -r test-requirements.txt -qq', - 'pip install -qq .', + 'pip install pipenv -qq', + 'pipenv install --dev', 'bandit -r ./dockertidy -x ./dockertidy/tests', ], }, @@ -332,6 +362,7 @@ local PipelineNotifications = { [ PipelineLint, + PipelineDeps, PipelineTest, PipelineSecurity, PipelineBuildPackage, diff --git a/.drone.yml b/.drone.yml new file mode 100644 index 0000000..0ab2568 --- /dev/null +++ b/.drone.yml @@ -0,0 +1,491 @@ +--- +kind: pipeline +name: lint + +platform: + os: linux + arch: amd64 + +steps: +- name: flake8 + image: python:3.7 + commands: + - pip install pipenv -qq + - pipenv install --dev + - flake8 ./dockertidy + environment: + PY_COLORS: 1 + +trigger: + ref: + - refs/heads/master + - refs/tags/** + - refs/pull/** + +--- +kind: pipeline +name: dependencies + +platform: + os: linux + arch: amd64 + +steps: +- name: pipenv + image: python:3.7 + commands: + - pip install pipenv -qq + - pipenv install --dev + - pipenv check + - pipenv-sync check + environment: + PY_COLORS: 1 + +trigger: + ref: + - refs/heads/master + - refs/tags/** + - refs/pull/** + +depends_on: +- lint + +--- +kind: pipeline +name: test + +platform: + os: linux + arch: amd64 + +steps: +- name: python35-pytest + image: python:3.5 + commands: + - pip install pipenv -qq + - pipenv install --dev + - docker-tidy --help + environment: + PY_COLORS: 1 + depends_on: + - clone + +- name: python36-pytest + image: python:3.6 + commands: + - pip install pipenv -qq + - pipenv install --dev + - docker-tidy --help + environment: + PY_COLORS: 1 + depends_on: + - clone + +- name: python37-pytest + image: python:3.7 + commands: + - pip install pipenv -qq + - pipenv install --dev + - docker-tidy --help + environment: + PY_COLORS: 1 + depends_on: + - clone + +- name: python38-pytest + image: python:3.8 + commands: + - pip install pipenv -qq + - pipenv install --dev + - docker-tidy --help + environment: + PY_COLORS: 1 + depends_on: + - clone + +trigger: + ref: + - refs/heads/master + - refs/tags/** + - refs/pull/** + +depends_on: +- dependencies + +--- +kind: pipeline +name: security + +platform: + os: linux + arch: amd64 + +steps: +- name: bandit + image: python:3.7 + commands: + - pip install pipenv -qq + - pipenv install --dev + - bandit -r ./dockertidy -x ./dockertidy/tests + environment: + PY_COLORS: 1 + +trigger: + ref: + - refs/heads/master + - refs/tags/** + - refs/pull/** + +depends_on: +- test + +--- +kind: pipeline +name: build-package + +platform: + os: linux + arch: amd64 + +steps: +- name: build + image: python:3.7 + commands: + - python setup.py sdist bdist_wheel + +- name: checksum + image: alpine + commands: + - cd dist/ && sha256sum * > ../sha256sum.txt + +- name: publish-github + image: plugins/github-release + settings: + api_key: + from_secret: github_token + files: + - dist/* + - sha256sum.txt + note: CHANGELOG.md + overwrite: true + title: ${DRONE_TAG} + when: + ref: + - refs/tags/** + +- name: publish-pypi + image: plugins/pypi + settings: + password: + from_secret: pypi_password + repository: https://upload.pypi.org/legacy/ + skip_build: true + username: + from_secret: pypi_username + when: + ref: + - refs/tags/** + +trigger: + ref: + - refs/heads/master + - refs/tags/** + - refs/pull/** + +depends_on: +- security + +--- +kind: pipeline +name: build-container-amd64 + +platform: + os: linux + arch: amd64 + +steps: +- name: build + image: python:3.7 + commands: + - python setup.py bdist_wheel + +- name: dryrun + image: plugins/docker:18-linux-amd64 + settings: + dockerfile: Dockerfile + dry_run: true + password: + from_secret: docker_password + repo: xoxys/${DRONE_REPO_NAME} + username: + from_secret: docker_username + when: + ref: + - refs/pull/** + +- name: publish + image: plugins/docker:18-linux-amd64 + settings: + auto_tag: true + auto_tag_suffix: amd64 + dockerfile: Dockerfile + password: + from_secret: docker_password + repo: xoxys/${DRONE_REPO_NAME} + username: + from_secret: docker_username + when: + ref: + - refs/heads/master + - refs/tags/** + +trigger: + ref: + - refs/heads/master + - refs/tags/** + - refs/pull/** + +depends_on: +- security + +--- +kind: pipeline +name: build-container-arm64 + +platform: + os: linux + arch: arm64 + +steps: +- name: build + image: python:3.7 + commands: + - python setup.py bdist_wheel + +- name: dryrun + image: plugins/docker:18-linux-arm64 + settings: + dockerfile: Dockerfile + dry_run: true + password: + from_secret: docker_password + repo: xoxys/${DRONE_REPO_NAME} + username: + from_secret: docker_username + when: + ref: + - refs/pull/** + +- name: publish + image: plugins/docker:18-linux-arm64 + settings: + auto_tag: true + auto_tag_suffix: arm64 + dockerfile: Dockerfile + password: + from_secret: docker_password + repo: xoxys/${DRONE_REPO_NAME} + username: + from_secret: docker_username + when: + ref: + - refs/heads/master + - refs/tags/** + +trigger: + ref: + - refs/heads/master + - refs/tags/** + - refs/pull/** + +depends_on: +- security + +--- +kind: pipeline +name: build-container-arm + +platform: + os: linux + arch: arm + +steps: +- name: build + image: python:3.7 + commands: + - python setup.py bdist_wheel + +- name: dryrun + image: plugins/docker:18-linux-arm + settings: + dockerfile: Dockerfile + dry_run: true + password: + from_secret: docker_password + repo: xoxys/${DRONE_REPO_NAME} + username: + from_secret: docker_username + when: + ref: + - refs/pull/** + +- name: publish + image: plugins/docker:18-linux-arm + settings: + auto_tag: true + auto_tag_suffix: arm + dockerfile: Dockerfile + password: + from_secret: docker_password + repo: xoxys/${DRONE_REPO_NAME} + username: + from_secret: docker_username + when: + ref: + - refs/heads/master + - refs/tags/** + +trigger: + ref: + - refs/heads/master + - refs/tags/** + - refs/pull/** + +depends_on: +- security + +--- +kind: pipeline +name: docs + +platform: + os: linux + arch: amd64 + +concurrency: + limit: 1 + +steps: +- name: assets + image: byrnedo/alpine-curl + commands: + - mkdir -p docs/themes/hugo-geekdoc/ + - curl -L https://github.com/xoxys/hugo-geekdoc/releases/latest/download/hugo-geekdoc.tar.gz | tar -xz -C docs/themes/hugo-geekdoc/ --strip-components=1 + +- name: test + image: klakegg/hugo:0.59.1-ext-alpine + commands: + - cd docs/ && hugo-official + +- name: freeze + image: appleboy/drone-ssh:1.5.5 + settings: + host: + from_secret: ssh_host + key: + from_secret: ssh_key + script: + - cp -R /var/www/virtual/geeklab/html/docker-tidy.geekdocs.de/ /var/www/virtual/geeklab/html/dockertidy_freeze/ + - ln -sfn /var/www/virtual/geeklab/html/dockertidy_freeze /var/www/virtual/geeklab/docker-tidy.geekdocs.de + username: + from_secret: ssh_username + +- name: publish + image: appleboy/drone-scp + settings: + host: + from_secret: ssh_host + key: + from_secret: ssh_key + rm: true + source: docs/public/* + strip_components: 2 + target: /var/www/virtual/geeklab/html/docker-tidy.geekdocs.de/ + username: + from_secret: ssh_username + +- name: cleanup + image: appleboy/drone-ssh:1.5.5 + settings: + host: + from_secret: ssh_host + key: + from_secret: ssh_key + script: + - ln -sfn /var/www/virtual/geeklab/html/docker-tidy.geekdocs.de /var/www/virtual/geeklab/docker-tidy.geekdocs.de + - rm -rf /var/www/virtual/geeklab/html/dockertidy_freeze/ + username: + from_secret: ssh_username + +trigger: + ref: + - refs/heads/master + - refs/tags/** + +depends_on: +- build-package +- build-container-amd64 +- build-container-arm64 +- build-container-arm + +--- +kind: pipeline +name: notifications + +platform: + os: linux + arch: amd64 + +steps: +- name: manifest + image: plugins/manifest + settings: + auto_tag: true + ignore_missing: true + password: + from_secret: docker_password + spec: manifest.tmpl + username: + from_secret: docker_username + +- name: readme + image: sheogorath/readme-to-dockerhub + environment: + DOCKERHUB_PASSWORD: + from_secret: docker_password + DOCKERHUB_REPO_NAME: ${DRONE_REPO_NAME} + DOCKERHUB_REPO_PREFIX: xoxys + DOCKERHUB_USERNAME: + from_secret: docker_username + README_PATH: README.md + SHORT_DESCRIPTION: docker-tidy - Simple annotation based documentation for your roles + +- name: matrix + image: plugins/matrix + settings: + homeserver: + from_secret: matrix_homeserver + password: + from_secret: matrix_password + roomid: + from_secret: matrix_roomid + template: "Status: **{{ build.status }}**
Build: [{{ repo.Owner }}/{{ repo.Name }}]({{ build.link }}) ({{ build.branch }}) by {{ build.author }}
Message: {{ build.message }}" + username: + from_secret: matrix_username + +trigger: + ref: + - refs/heads/master + - refs/tags/** + status: + - success + - failure + +depends_on: +- docs + +--- +kind: signature +hmac: 19f4fda6c951d44a90518e229013e8b031ed950b09e18d09b2c42087a44d7760 + +... diff --git a/Pipfile b/Pipfile index 0dc4ddc..9f8e0a2 100644 --- a/Pipfile +++ b/Pipfile @@ -45,6 +45,3 @@ environs = "*" nested-lookup = "*" "ruamel.yaml" = "*" websocket-client = "*" - -[requires] -python_version = "3.7" diff --git a/Pipfile.lock b/Pipfile.lock index 832d2b7..1373116 100644 --- a/Pipfile.lock +++ b/Pipfile.lock @@ -121,10 +121,10 @@ }, "marshmallow": { "hashes": [ - "sha256:3a94945a7461f2ab4df9576e51c97d66bee2c86155d3d3933fab752b31effab8", - "sha256:4b95c7735f93eb781dfdc4dded028108998cad759dda8dd9d4b5b4ac574cbf13" + "sha256:90854221bbb1498d003a0c3cc9d8390259137551917961c8b5258c64026b2f85", + "sha256:ac2e13b30165501b7d41fc0371b8df35944f5849769d136f20e2c5f6cdc6e665" ], - "version": "==3.5.0" + "version": "==3.5.1" }, "nested-lookup": { "hashes": [ @@ -549,10 +549,10 @@ }, "marshmallow": { "hashes": [ - "sha256:3a94945a7461f2ab4df9576e51c97d66bee2c86155d3d3933fab752b31effab8", - "sha256:4b95c7735f93eb781dfdc4dded028108998cad759dda8dd9d4b5b4ac574cbf13" + "sha256:90854221bbb1498d003a0c3cc9d8390259137551917961c8b5258c64026b2f85", + "sha256:ac2e13b30165501b7d41fc0371b8df35944f5849769d136f20e2c5f6cdc6e665" ], - "version": "==3.5.0" + "version": "==3.5.1" }, "mccabe": { "hashes": [ diff --git a/docs/.keep b/docs/.keep new file mode 100644 index 0000000..e69de29 diff --git a/setup.py b/setup.py index 155c7d2..2e8d520 100644 --- a/setup.py +++ b/setup.py @@ -76,7 +76,7 @@ setup( "importlib-metadata==1.5.0; python_version < '3.8'", "ipaddress==1.0.23", "jsonschema==3.2.0", - "marshmallow==3.5.0", + "marshmallow==3.5.1", "nested-lookup==0.2.21", "pathspec==0.7.0", "pyrsistent==0.15.7",