diff --git a/.dockerignore b/.dockerignore index 91224e5..a40fa3b 100644 --- a/.dockerignore +++ b/.dockerignore @@ -1 +1,6 @@ **/* + +!src +!**/*.py +!pyproject.toml +!poetry.lock diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml new file mode 100644 index 0000000..511bfc3 --- /dev/null +++ b/.github/workflows/deploy.yml @@ -0,0 +1,61 @@ +name: Publish Python Package + +on: + push: + tags: + - '[0-2].[0-9]+.[0-9]+*' + +jobs: + + pypi: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@master + + - name: Set up Python + uses: actions/setup-python@v1 + with: + python-version: "3.8" + + - name: Publish Package to PyPI + env: + PYPI_USERNAME: ${{ secrets.PYPI_USERNAME }} + PYPI_PASSWORD: ${{ secrets.PYPI_PASSWORD }} + run: | + python -m pip install --upgrade pip + pip install poetry + poetry config repositories.testpypi https://test.pypi.org/legacy/ + poetry build + poetry publish -u $PYPI_USERNAME -p $PYPI_PASSWORD + sleep 10s + + dockerhub: + needs: pypi + + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@master + + - name: Extract tag name + id: tag_name + run: | + echo ::set-output name=TAG::${GITHUB_REF/refs\/tags\//} + + - name: Build Docker image + env: + TAG: ${{ steps.tag_name.outputs.TAG }} + run: | + docker build . -t fdooch/audiomatch:"${TAG}" --build-arg package_version="${TAG}" + + - name: Log in to the Dockerhub registry + env: + DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }} + DOCKERHUB_TOKEN: ${{ secrets.DOCKERHUB_TOKEN }} + run: | + echo "${DOCKERHUB_TOKEN}" | docker login -u "${DOCKERHUB_USERNAME}" --password-stdin + + - name: Push to Dockerhub + run: | + docker push fdooch/audiomatch:"${TAG}" diff --git a/Dockerfile b/Dockerfile index 7b61b43..09e0783 100644 --- a/Dockerfile +++ b/Dockerfile @@ -5,4 +5,9 @@ RUN apk update \ && echo "http://dl-cdn.alpinelinux.org/alpine/edge/community" >> /etc/apk/repositories \ && apk add --no-cache chromaprint-dev -CMD ["/bin/sh"] +ARG package_version +ENV PACKAGE_VERSION=$package_version + +RUN pip3 install "audiomatch==${PACKAGE_VERSION}" + +ENTRYPOINT ["audiomatch"] diff --git a/README.rst b/README.rst index c970905..0b8be9c 100644 --- a/README.rst +++ b/README.rst @@ -6,6 +6,19 @@ audiomatch :alt: Build Status :target: https://github.com/unmade/audiomatch/blob/master/.github/workflows/lint-and-test.yml +.. image:: https://codecov.io/gh/unmade/audiomatch/branch/master/graph/badge.svg + :alt: Coverage Status + :target: https://codecov.io/gh/unmade/audiomatch + +.. image:: https://img.shields.io/pypi/v/audiomatch.svg + :alt: PyPI Package latest release + :target: https://pypi.org/project/audiomatch + +.. image:: https://img.shields.io/badge/License-MIT-purple.svg + :alt: MIT License + :target: https://github.com/unmade/apiwrappers/blob/master/LICENSE + + A small command-line tool to find similar audio files Installation @@ -26,7 +39,7 @@ docker: .. code-block:: bash - docker run --rm -v=/path/to/audio/folder:/tmp -it fdooch/audiomatch /bin/sh + docker run --rm -v "$(pwd)":/tmp fdooch/audiomatch "/tmp/*" Quickstart ========== @@ -62,7 +75,9 @@ Let's find out which files sound similar: ./demo/Pennyroyal Tea (Solo Acoustic).mp3 ./demo/Pennyroyal Tea (Unplugged in NYC).m4a -*Note: input audio files should be at least 10 seconds long* +*Note #1: input audio files should be at least 10 seconds long* + +*Note #2: in some rare cases false positives are possible* What's happening here is that *audiomatch* takes all audio files from the directory and compares them with each other. diff --git a/pyproject.toml b/pyproject.toml index 89703ff..09fc385 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,14 +1,25 @@ [tool.poetry] name = "audiomatch" -version = "0.1.0" -description = "" +version = "0.1.3" +description = "A small command-line tool to find similar audio files" +keywords = ["duplicate", "detection", "audio", "fingerprinting", "command-line"] +readme = "README.rst" authors = ["Aleksei Maslakov "] +license = "MIT" packages = [ { include = "audiomatch", from = "src" }, ] +classifiers = [ + "Development Status :: 4 - Beta", + "License :: OSI Approved :: MIT License", + "Operating System :: OS Independent", + "Programming Language :: Python :: 3.8", + "Topic :: Multimedia :: Sound/Audio :: Analysis", + "Typing :: Typed", +] [tool.poetry.scripts] -audiomatch = "audiomatch.cli:main" +audiomatch = "audiomatch.cli:invoke" [tool.poetry.dependencies] python = "^3.8"