From b0fb8d4860c347b1b572572b34e067ad81b6524b Mon Sep 17 00:00:00 2001 From: Ivan Schaller Date: Wed, 22 Jun 2022 19:27:03 +0200 Subject: [PATCH] fix and add ci/cd tests --- .woodpecker/publish_build.yml | 42 +++++++++++++++++ .woodpecker/publish_docker.yml | 1 - .woodpecker/test_build.yml | 47 +++++++++++++++++++ .../{build_docker.yml => test_docker.yml} | 15 +++--- .woodpecker/test_release.yml | 39 +++++++++++++++ .woodpecker/tests.yml | 1 - pyproject.toml | 12 ++++- 7 files changed, 146 insertions(+), 11 deletions(-) create mode 100644 .woodpecker/publish_build.yml create mode 100644 .woodpecker/test_build.yml rename .woodpecker/{build_docker.yml => test_docker.yml} (81%) create mode 100644 .woodpecker/test_release.yml diff --git a/.woodpecker/publish_build.yml b/.woodpecker/publish_build.yml new file mode 100644 index 0000000..5ab4e32 --- /dev/null +++ b/.woodpecker/publish_build.yml @@ -0,0 +1,42 @@ +############# +# build app # +############# +# branch: master +# event: tag + +depends_on: + - tests + +clone: + git: + when: + #branch: master + event: tag + image: woodpeckerci/plugin-git + +pipeline: + + # build wheel and dist + build-pypi: + when: + #branch: master + event: tag + image: cr.44net.ch/drone-plugins/test + pull: true + commands: + - hatch build + + # release pypi + release-pypi: + when: + #branch: master + event: tag + image: cr.44net.ch/drone-plugins/test + pull: true + secrets: + - source: pypi_username + target: HATCH_PYPI_USER + - source: pypi_token + target: HATCH_PYPI_AUTH + commands: + - hatch publish diff --git a/.woodpecker/publish_docker.yml b/.woodpecker/publish_docker.yml index f0aa5f7..aa0c2c9 100644 --- a/.woodpecker/publish_docker.yml +++ b/.woodpecker/publish_docker.yml @@ -69,4 +69,3 @@ pipeline: from_secret: cr-dhub-username password: from_secret: cr-dhub-key - diff --git a/.woodpecker/test_build.yml b/.woodpecker/test_build.yml new file mode 100644 index 0000000..97ed94b --- /dev/null +++ b/.woodpecker/test_build.yml @@ -0,0 +1,47 @@ +################## +# test build app # +################## +# branch: master +# event: pull_request + +depends_on: + - tests + +clone: + git: + when: + branch: master + event: pull_request + image: woodpeckerci/plugin-git + +pipeline: + + # build wheel and dist + test-build-pypi: + when: + branch: master + event: pull_request + image: cr.44net.ch/drone-plugins/test + pull: true + commands: + - hatch build + + # test code with different python versions - amd64 + test-tox-amd64: + when: + branch: master + event: pull_request + image: cr.44net.ch/drone-plugins/test:1-linux-amd64 + pull: true + commands: + - tox + + # test code with different python versions - arm64 + test-tox-arm64: + when: + branch: master + event: pull_request + image: cr.44net.ch/drone-plugins/test:1-linux-arm64 + pull: true + commands: + - tox diff --git a/.woodpecker/build_docker.yml b/.woodpecker/test_docker.yml similarity index 81% rename from .woodpecker/build_docker.yml rename to .woodpecker/test_docker.yml index 701eab1..29f18af 100644 --- a/.woodpecker/build_docker.yml +++ b/.woodpecker/test_docker.yml @@ -1,6 +1,6 @@ -####################### -# build docker images # -####################### +############################ +# test build docker images # +############################ # branch: master # event: pull_request @@ -17,7 +17,7 @@ clone: pipeline: # build docker image for amd64 - x86 - dryrun-build-amd64: + test-build-amd64: when: branch: master event: pull_request @@ -29,11 +29,11 @@ pipeline: platforms: linux/amd64 dockerfile: docker/Dockerfile.amd64 auto_tag: true - auto_tag_suffix: linux-amd64 + auto_tag_suffix: linux-amd64-test build_args: BUILD_VERSION=${CI_COMMIT_TAG} # build docker image for arm64 - dryrun-build-arm64: + test-build-arm64: when: branch: master event: pull_request @@ -45,6 +45,5 @@ pipeline: platforms: linux/arm64 dockerfile: docker/Dockerfile.arm64 auto_tag: true - auto_tag_suffix: linux-arm64 + auto_tag_suffix: linux-arm64-test build_args: BUILD_VERSION=${CI_COMMIT_TAG} - diff --git a/.woodpecker/test_release.yml b/.woodpecker/test_release.yml new file mode 100644 index 0000000..097b9f1 --- /dev/null +++ b/.woodpecker/test_release.yml @@ -0,0 +1,39 @@ +######################## +# test publish release # +######################## +# branch: master +# event: pull_request + +depends_on: + - tests + +clone: + git: + when: + branch: master + event: pull_request + image: woodpeckerci/plugin-git + +pipeline: + + # create release tar + test-create-release-tar: + when: + branch: master + event: pull_request + image: cr.44net.ch/baseimages/debian-base + pull: true + commands: + - tar -czf manga-dlp-${CI_COMMIT_TAG}.tar.gz --files-from=release-files.txt + - tar -tzf manga-dlp-${CI_COMMIT_TAG}.tar.gz + + # create release-notes + test-create-release-notes: + when: + branch: master + event: pull_request + image: cr.44net.ch/baseimages/debian-base + pull: true + commands: + - bash get_release_notes.sh ${CI_COMMIT_TAG} + - cat RELEASENOTES.md diff --git a/.woodpecker/tests.yml b/.woodpecker/tests.yml index 7add2ac..5115caf 100644 --- a/.woodpecker/tests.yml +++ b/.woodpecker/tests.yml @@ -59,4 +59,3 @@ pipeline: sonar_token: from_secret: sq-44net-token usingProperties: true - diff --git a/pyproject.toml b/pyproject.toml index 42f2695..391a5f5 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -92,6 +92,16 @@ ignore-vcs = true [tool.hatch.build.targets.sdist] include = ["mangadlp"] -exclude = ["docker"] +exclude = [ + "docker", + ".tox", + ".mypy_cache" +] [tool.hatch.build.targets.wheel] +include = ["mangadlp"] +exclude = [ + "docker", + ".tox", + ".mypy_cache" +]