From ef6f4851be4c7c929b57d0ab031eacef7bcb9793 Mon Sep 17 00:00:00 2001 From: Anton Rau Date: Wed, 17 Mar 2021 11:56:13 +0100 Subject: [PATCH] Testing publishing to PyPI via CI. --- .github/workflows/test_and_deploy.yml | 78 ++++++++++++++++++++------- poetry.lock | 14 ++--- 2 files changed, 66 insertions(+), 26 deletions(-) diff --git a/.github/workflows/test_and_deploy.yml b/.github/workflows/test_and_deploy.yml index 4f54d4e..179f2c3 100644 --- a/.github/workflows/test_and_deploy.yml +++ b/.github/workflows/test_and_deploy.yml @@ -3,30 +3,70 @@ name: test-and-deploy on: push: branches: [ master ] + tags: + - "v*" pull_request: branches: [ master ] + workflow_dispatch: jobs: - build: - - runs-on: ubuntu-latest + test: + name: Test ${{ matrix.platform }} py${{ matrix.python-version }} + runs-on: ${{ matrix.platform }} strategy: matrix: - python-version: [3.7, 3.8, 3.9] + platform: + - ubuntu-latest + - windows-latest + - macos-latest + python-version: + - 3.7 + - 3.8 + - 3.9 + steps: + - name: Checkout + uses: actions/checkout@v2 + - name: Setup Python ${{ matrix.python-version }} + uses: actions/setup-python@v2 + with: + python-version: ${{ matrix.python-version }} + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install poetry==1.1.5 + poetry install + env: + POETRY_VIRTUALENVS_CREATE: false + - name: Test with pytest + run: | + pytest + deploy: + name: Deploy + needs: + - test + runs-on: ubuntu-latest + if: contains(github.ref, 'tags') steps: - - uses: actions/checkout@v2 - - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v1 - with: - python-version: ${{ matrix.python-version }} - - name: Install dependencies - run: | - python -m pip install --upgrade pip - pip install poetry==1.1.5 - poetry install - env: - POETRY_VIRTUALENVS_CREATE: false - - name: Test with pytest - run: | - pytest + - name: Checkout + uses: actions/checkout@v2 + - name: Set up Python 3.8 + uses: actions/setup-python@v2 + with: + python-version: 3.8 + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install poetry==1.1.5 + poetry install + env: + POETRY_VIRTUALENVS_CREATE: false + - name: Build and publish + env: + POETRY_HTTP_BASIC_PYPI_USERNAME: __token__ + POETRY_HTTP_BASIC_PYPI_PASSWORD: + POETRY_PYPI_TOKEN_PYPI: ${{ secrets.TWINE_API_KEY }} + run: | + git tag + poetry build + poetry publish diff --git a/poetry.lock b/poetry.lock index f714860..78122f9 100644 --- a/poetry.lock +++ b/poetry.lock @@ -284,7 +284,7 @@ python-versions = "*" [[package]] name = "mdit-py-plugins" -version = "0.2.5" +version = "0.2.6" description = "Collection of plugins for markdown-it-py" category = "dev" optional = false @@ -705,8 +705,8 @@ test = ["pytest"] [[package]] name = "tifffile" -version = "2021.3.5" -description = "Read and write TIFF(r) files" +version = "2021.3.16" +description = "Read and write TIFF files" category = "main" optional = false python-versions = ">=3.7" @@ -1036,8 +1036,8 @@ mccabe = [ {file = "mccabe-0.6.1.tar.gz", hash = "sha256:dd8d182285a0fe56bace7f45b5e7d1a6ebcbf524e8f3bd87eb0f125271b8831f"}, ] mdit-py-plugins = [ - {file = "mdit-py-plugins-0.2.5.tar.gz", hash = "sha256:06dbda99e7d81184c4f6de7c7e3409b29f5cef35404beed6feaf624646219bf5"}, - {file = "mdit_py_plugins-0.2.5-py3-none-any.whl", hash = "sha256:3c78db5cfdcf8f55f0af2b096de391bffcef0b3600222f434efb016d7c267cec"}, + {file = "mdit-py-plugins-0.2.6.tar.gz", hash = "sha256:1e467ca2ea056e8065cbd5d6c61e5052bb50826bde84c40f6a5ed77e82125710"}, + {file = "mdit_py_plugins-0.2.6-py3-none-any.whl", hash = "sha256:77fd75dad81109ee91f30eb49146196f79afbbae041f298ae4886c8c2b5e23d7"}, ] mypy = [ {file = "mypy-0.812-cp35-cp35m-macosx_10_9_x86_64.whl", hash = "sha256:a26f8ec704e5a7423c8824d425086705e381b4f1dfdef6e3a1edab7ba174ec49"}, @@ -1293,8 +1293,8 @@ sphinxcontrib-serializinghtml = [ {file = "sphinxcontrib_serializinghtml-1.1.4-py2.py3-none-any.whl", hash = "sha256:f242a81d423f59617a8e5cf16f5d4d74e28ee9a66f9e5b637a18082991db5a9a"}, ] tifffile = [ - {file = "tifffile-2021.3.5-py3-none-any.whl", hash = "sha256:8ae99b2d7a80512628dc7f7de5a178525b28cb50cc69e82578a67106c28beee6"}, - {file = "tifffile-2021.3.5.tar.gz", hash = "sha256:f55a4c8bcbfdd28157529c2e2a7c066da1636a202144f1696092b9290f52685d"}, + {file = "tifffile-2021.3.16-py3-none-any.whl", hash = "sha256:b4e85d86d27abe54a778c344c422606e2cb82ae843e83ecb3d675040877d8ffc"}, + {file = "tifffile-2021.3.16.tar.gz", hash = "sha256:0512ce677a508c5e4eca8608092e55b07b681f84c92565ecf49b36ef02aa56bf"}, ] toml = [ {file = "toml-0.10.2-py2.py3-none-any.whl", hash = "sha256:806143ae5bfb6a3c6e736a764057db0e6a0e05e338b5630894a5f779cabb4f9b"},