From a135990dc8966a771f9cc5cbe1d036a53169d8bb Mon Sep 17 00:00:00 2001 From: youngfree <471011042@qq.com> Date: Mon, 9 Mar 2020 15:11:47 +0800 Subject: [PATCH] future / add action.yml (#19) * Create pythonpublish.yml * modify publish.yml and del travis.yml * modify publish.yml and del travis.yml -2.0 * modify publish.yml -name --- .github/workflows/publish.yml | 40 ++++++++++++++++++++++++++++++++++ .github/workflows/unittest.yml | 21 ++++++++++++++++++ .travis.yml | 39 --------------------------------- 3 files changed, 61 insertions(+), 39 deletions(-) create mode 100644 .github/workflows/publish.yml create mode 100644 .github/workflows/unittest.yml delete mode 100644 .travis.yml diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml new file mode 100644 index 0000000..7565d81 --- /dev/null +++ b/.github/workflows/publish.yml @@ -0,0 +1,40 @@ +# This workflows 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 + +name: Publish to pypi + +on: + release: + types: [created] + +jobs: + publish: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v2 + - name: Set up Node + uses: actions/setup-node@v1 + with: + node-version: '10' + - name: Install npm Dependencies + run: | + cd frontend + npm install + npm run build + cd .. + - name: Set up Python + uses: actions/setup-python@v1 + with: + python-version: '3.6' + - name: Install python dependencies + run: | + python -m pip install --upgrade pip + pip install setuptools wheel twine + - name: Build and publish + env: + TWINE_USERNAME: __token__ + TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }} + run: | + python setup.py sdist + twine upload dist/* diff --git a/.github/workflows/unittest.yml b/.github/workflows/unittest.yml new file mode 100644 index 0000000..755ab39 --- /dev/null +++ b/.github/workflows/unittest.yml @@ -0,0 +1,21 @@ +name: Unit Test + +on: [push, pull_request] + +jobs: + unittest: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v2 + - name: Set up Python + uses: actions/setup-python@v1 + with: + python-version: '3.6' + - name: Install python dependencies + run: | + python -m pip install --upgrade pip + pip install -r requirements.txt + pip install . + - name: Unit Test + run: pytest diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index fb2ed46..0000000 --- a/.travis.yml +++ /dev/null @@ -1,39 +0,0 @@ -jobs: - include: - - stage: unit test - language: python - catch: pip - python: - - "3.6" - # command to install dependencies - install: - - pip install -r requirements.txt - - pip install . - # command to run tests - script: pytest - - - stage: release to pypi - if: type = push AND tag IS present - language: python - catch: - - pip - - npm - python: - - "3.6" - node_js: - - "10" - install: - - cd frontend - - npm install - - npm run build - - cd .. - script: - - echo "No script for pypi release" - deploy: - provider: pypi - skip_existing: true - skip-cleanup: true - user: __token__ - password: ${{ secrets.pypi_password }} - on: - tags: true