|
@@ -1,19 +1,63 @@
|
|
|
-# This workflow will upload a Python Package using Twine when a release is created
|
|
|
-# For more information see: https://help.github.com/en/actions/language-and-framework-guides/using-python-with-github-actions#publishing-to-package-registries
|
|
|
-
|
|
|
-# This workflow uses actions that are not certified by GitHub.
|
|
|
-# They are provided by a third-party and are governed by
|
|
|
-# separate terms of service, privacy policy, and support
|
|
|
-# documentation.
|
|
|
-
|
|
|
-name: Publish package
|
|
|
+name: Publish on Pypi
|
|
|
|
|
|
on:
|
|
|
workflow_dispatch:
|
|
|
+ inputs:
|
|
|
+ version:
|
|
|
+ description: "The Pypi package version to create (ex: 1.0.0)"
|
|
|
+ required: true
|
|
|
|
|
|
jobs:
|
|
|
+ test-package:
|
|
|
+ timeout-minutes: 20
|
|
|
+ runs-on: ubuntu-18.04
|
|
|
+ steps:
|
|
|
+ - uses: actions/checkout@v2
|
|
|
+ - uses: actions/setup-python@v2
|
|
|
+ with:
|
|
|
+ python-version: 3.8
|
|
|
+
|
|
|
+ - name: Extract branch name
|
|
|
+ shell: bash
|
|
|
+ run: echo "##[set-output name=branch;]$(echo ${GITHUB_REF#refs/heads/})"
|
|
|
+ id: extract_branch
|
|
|
+
|
|
|
+ - name: Ensure package version is properly set
|
|
|
+ run: |
|
|
|
+ echo 'version="${{ github.event.inputs.version }}"' | grep -f - setup.py
|
|
|
+
|
|
|
+ - name: Validate branch name
|
|
|
+ run: |
|
|
|
+ echo """
|
|
|
+ import re, sys
|
|
|
+ setup = open('setup.py').read()
|
|
|
+ x = re.search(r'version=\"(\d+)\.(\d+)\.(\d+)(?:\.([a-zA-Z0-9_]+))?\"', setup)
|
|
|
+ if not x:
|
|
|
+ raise ValueError('Invalid version expression')
|
|
|
+ if f'release/{x.group(1)}.{x.group(2)}' != sys.argv[1]:
|
|
|
+ raise ValueError('Branch name mismatch')
|
|
|
+ """ > /tmp/check.py
|
|
|
+ python /tmp/check.py "${{ steps.extract_branch.outputs.branch }}"
|
|
|
+
|
|
|
+ - name: Install dependencies
|
|
|
+ run: |
|
|
|
+ python -m pip install --upgrade pip
|
|
|
+ pip install build
|
|
|
+
|
|
|
+ - name: Build and test the package
|
|
|
+ run: |
|
|
|
+ python setup.py build_py && python -m build
|
|
|
+ rm -rf src taipy
|
|
|
+ pip install dist/*.tar.gz
|
|
|
+
|
|
|
+ python -c "import taipy as tp; tp.Scenario"
|
|
|
+ python -c "import taipy as tp; tp.gui"
|
|
|
+ python -c "import taipy as tp; tp.rest"
|
|
|
+
|
|
|
publish-to-pypi:
|
|
|
- environment: production
|
|
|
+ needs: [test-package]
|
|
|
+ timeout-minutes: 20
|
|
|
+ environment: publish
|
|
|
runs-on: ubuntu-18.04
|
|
|
steps:
|
|
|
- uses: actions/checkout@v2
|
|
@@ -35,5 +79,34 @@ jobs:
|
|
|
user: __token__
|
|
|
password: ${{ secrets.PYPI_API_TOKEN }}
|
|
|
|
|
|
- - name: Install package from PyPI
|
|
|
- run: pip install ${{ github.event.repository.name }}
|
|
|
+ test-published-package:
|
|
|
+ needs: [publish-to-pypi]
|
|
|
+ timeout-minutes: 30
|
|
|
+ strategy:
|
|
|
+ matrix:
|
|
|
+ python-versions: ['3.8','3.9','3.10']
|
|
|
+ os: [ubuntu-18.04,windows-latest,macos-latest]
|
|
|
+ runs-on: ${{ matrix.os }}
|
|
|
+ steps:
|
|
|
+ - uses: actions/checkout@v2
|
|
|
+ - uses: actions/setup-python@v2
|
|
|
+ with:
|
|
|
+ python-version: ${{ matrix.python-versions }}
|
|
|
+
|
|
|
+ - name: Prepare tests on unix
|
|
|
+ if: matrix.os != 'windows-latest'
|
|
|
+ run: |
|
|
|
+ rm -rf taipy
|
|
|
+
|
|
|
+ - name: Prepare tests on windows
|
|
|
+ if: matrix.os == 'windows-latest'
|
|
|
+ run: |
|
|
|
+ rmdir -Recurse -Force taipy
|
|
|
+
|
|
|
+ - name: Install and test package
|
|
|
+ run: |
|
|
|
+ pip install --upgrade pip
|
|
|
+ pip install --no-cache-dir ${{ github.event.repository.name }}==${{ github.event.inputs.version }}
|
|
|
+ python -c "import taipy as tp; tp.Scenario"
|
|
|
+ python -c "import taipy as tp; tp.gui"
|
|
|
+ python -c "import taipy as tp; tp.rest"
|