diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index a24e7bc..9a9b522 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -7,6 +7,12 @@ on: push: branches: - main + # poetry-dynamic-versioning gets the version from release tag. + # that's why the same steps work for pushes to main & releases. + release: + # without this a new release tag triggers 3 builds instead of 1 + # https://github.community/t/action-run-being-trigger-multiple-times/16144 + types: [published] jobs: test-and-deploy: @@ -15,6 +21,9 @@ jobs: - name: Set Environment variables run: echo "SPARK_LOCAL_IP=localhost" >> $GITHUB_ENV - uses: actions/checkout@v2 + with: + # poetry-dynamic-versioning needs the full history. latest commit is not enough. + fetch-depth: '0' - name: Set up JDK 8 uses: actions/setup-java@v2 @@ -29,7 +38,7 @@ jobs: with: python-version: '3.7' - name: Install Poetry - run: pip install poetry==1.1.4 + run: pip install poetry==1.1.4 poetry-dynamic-versioning==0.12.1 - name: Install libkrb5-dev run: sudo apt-get install libkrb5-dev # This is needed for installing pykerberos - name: Install python dependencies @@ -39,6 +48,13 @@ jobs: run: poetry run pytest working-directory: ./python + - name: Build python package + run: poetry build + working-directory: ./python + - name: Publish to PyPI + run: poetry publish -u '__token__' -p '${{ secrets.PYPI_TOKEN }}' + working-directory: ./python + - name: Set up Apache Maven Central uses: actions/setup-java@v2 with: # running setup-java again overwrites the settings.xml diff --git a/README.md b/README.md index df90443..6d9a0c4 100644 --- a/README.md +++ b/README.md @@ -105,6 +105,11 @@ satisfies the requirements of `DruidSource` ### PySpark +Install the latest pre-release version: +``` +pip install 'rovio-ingest>0.0.0' --pre +``` + First, set the following spark conf: ```python diff --git a/python/pyproject.toml b/python/pyproject.toml index c71b960..14abb99 100644 --- a/python/pyproject.toml +++ b/python/pyproject.toml @@ -16,7 +16,10 @@ [tool.poetry] name = "rovio-ingest" -version = "1.0.0" +# NOTE: This version is ignored. +# - Versions are managed by poetry-dynamic-versioning +# - Git tags are used to create new releases +version = "0.0.1" description = "" authors = ["Vivek Balakrishnan ", "Juho Autio "] @@ -33,6 +36,22 @@ sparkmagic = "^0.15.0" boto3 = "*" safety = "^1.10.3" +[tool.poetry-dynamic-versioning] +enable = true +metadata = true +dirty = true +vcs = "git" +style = "pep440" +format-jinja = """ + {%- if distance == 0 -%} + {{ serialize_pep440(base, stage, revision) }} + {%- elif revision is not none -%} + {{ serialize_pep440(base, stage, revision + 1, dev=distance) }} + {%- else -%} + {{ serialize_pep440(bump_version(base), stage, revision, dev=distance) }} + {%- endif -%} + """ + [build-system] requires = ["poetry>=0.12"] build-backend = "poetry.masonry.api"