From 9e40b6fbbdaf283d2bd3413e2f29cce159a4fa98 Mon Sep 17 00:00:00 2001 From: Dmitry Date: Sat, 9 Oct 2021 15:13:30 +0300 Subject: [PATCH] use poetry in ci --- .github/workflows/pythonpackage.yml | 32 +++++++++++++++++------------ .github/workflows/pythonpublish.yml | 28 ++++++++++++++++--------- .travis.yml | 11 +++++++++- 3 files changed, 47 insertions(+), 24 deletions(-) diff --git a/.github/workflows/pythonpackage.yml b/.github/workflows/pythonpackage.yml index 30d2477..704d5c1 100644 --- a/.github/workflows/pythonpackage.yml +++ b/.github/workflows/pythonpackage.yml @@ -13,30 +13,36 @@ on: jobs: build: - runs-on: ubuntu-18.04 + runs-on: ubuntu-latest strategy: max-parallel: 4 matrix: python-version: [3.6, 3.7, 3.8, 3.9] steps: - - uses: actions/checkout@v1 + - uses: actions/checkout@v2 - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v1 + uses: actions/setup-python@v2 with: python-version: ${{ matrix.python-version }} - - name: Install dependencies - run: | - python -m pip install --upgrade pip - pip install -r requirements.txt + - name: Upgrade pip + run: python -m pip install --upgrade pip + - name: Load cached Poetry installation + uses: actions/cache@v2 + with: + path: ~/.local + key: poetry-0 + - name: Install Poetry + uses: snok/install-poetry@v1 + - name: Install deps + run: poetry install + - name: Install deps form requirements.txt + run: poetry run pip install -r requirements.txt - name: Lint with flake8 run: | - pip install flake8 # stop the build if there are Python syntax errors or undefined names - flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics + poetry run flake8 sync_ics2gcal --count --select=E9,F63,F7,F82 --show-source --statistics # exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide - flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics + poetry run flake8 sync_ics2gcal --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics - name: Test with pytest - run: | - pip install pytest - pytest -v + run: poetry run pytest -v diff --git a/.github/workflows/pythonpublish.yml b/.github/workflows/pythonpublish.yml index 9e383e8..9a2c0bf 100644 --- a/.github/workflows/pythonpublish.yml +++ b/.github/workflows/pythonpublish.yml @@ -10,17 +10,25 @@ jobs: steps: - uses: actions/checkout@v2 - name: Set up Python - uses: actions/setup-python@v1 + uses: actions/setup-python@v2 with: python-version: '3.x' - - name: Install dependencies - run: | - python -m pip install --upgrade pip - pip install setuptools setuptools_scm setuptools_scm_git_archive wheel twine - - name: Build and publish + - name: Upgrade pip + run: python -m pip install --upgrade pip + - name: Load cached Poetry installation + uses: actions/cache@v2 + with: + path: ~/.local + key: poetry-0 + - name: Install Poetry + uses: snok/install-poetry@v1 + - name: Install deps + run: poetry install + - name: Build + run: poetry build + - name: Publish env: - TWINE_USERNAME: __token__ - TWINE_PASSWORD: ${{ secrets.pypi_token }} + REPO_USERNAME: __token__ + REPO_PASSWORD: ${{ secrets.pypi_token }} run: | - python setup.py sdist bdist_wheel - twine upload dist/* + poetry publish -n -u $REPO_USERNAME -p $REPO_PASSWORD diff --git a/.travis.yml b/.travis.yml index 09d1177..50567da 100644 --- a/.travis.yml +++ b/.travis.yml @@ -6,5 +6,14 @@ python: - "3.8" - "3.9" +before_install: +- pip install poetry +install: +- poetry install script: - - pytest -v +# stop the build if there are Python syntax errors or undefined names +- poetry run flake8 sync_ics2gcal --count --select=E9,F63,F7,F82 --show-source --statistics +# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide +- poetry run flake8 sync_ics2gcal --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics +# run tests +- poetry run pytest -v