diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index a038de8..591615a 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,15 +1,21 @@ -name: tests +name: CI on: push: branches: [ master ] + paths-ignore: + - 'docs/**' + - '*.md' + - '*.rst' + - 'benchmarks/**' pull_request: branches: [ master ] + paths-ignore: + - '*.md' + - '*.rst' jobs: build: - - runs-on: ${{ matrix.os }} strategy: fail-fast: false matrix: @@ -23,37 +29,73 @@ jobs: - '3.8' - '3.9' - '3.10' + - '3.11' + - 'pypy3.8' + - 'pypy3.9' + + runs-on: ${{ matrix.os }} + defaults: + # Windows sucks. Force use bash instead of PowerShell + run: + shell: bash + + env: + # We disable some features for PyPy by this environment variable such as: + # – Installation of `fast` extras: `uvloop` on PyPy is useless and may be even slower + # than the default loop; + # – Coverage reports: code introspection disables any optimizations, so tests with + # coverage enabled are very slow on PyPy. + # More: https://www.pypy.org/performance.html + IS_PYPY: ${{ startswith(matrix.python-version, 'pypy') }} + # Windows has also some limitations: + # – Poetry installer doesn't work on Windows with PyPy. + IS_WINDOWS: ${{ startswith(matrix.os, 'windows') }} steps: - - uses: actions/checkout@v2 + - name: Checkout code + uses: actions/checkout@master + - name: Set up Python ${{ matrix.python-version }} on ${{ matrix.os }} - uses: actions/setup-python@v2 + uses: actions/setup-python@v4 with: python-version: ${{ matrix.python-version }} - - name: Install Poetry + + - name: Install and configure Poetry uses: snok/install-poetry@v1 + if: "env.IS_PYPY == 'false' || env.IS_WINDOWS == 'false'" with: + version: 1.2.1 virtualenvs-create: true virtualenvs-in-project: true + installer-parallel: true + + - name: Install and configure Poetry (PyPy on Windows) + if: "env.IS_PYPY == 'true' && env.IS_WINDOWS == 'true'" + run: | + set -eu + pip install "poetry==1.2.1" + poetry config virtualenvs.create true + poetry config virtualenvs.in-project true + poetry config installer.parallel true - name: Load cached venv id: cached-poetry-dependencies uses: actions/cache@v2 with: path: .venv - key: venv-${{ runner.os }}-${{ hashFiles('**/poetry.lock') }} + key: venv-${{ matrix.os }}-${{ matrix.python-version }}-${{ hashFiles('**/poetry.lock') }}-${{ secrets.CACHE_VERSION }} + - name: Install dependencies if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true' - run: poetry install --no-interaction --no-root - - - name: Install library run: poetry install --no-interaction - name: Test with pytest run: | - poetry run pytest -p no:warnings --cov=apscheduler_di --cov-config .coveragerc --cov-report=xml + flags="" + [[ "$IS_PYPY" == "false" ]] && flags="$flags --cov=apscheduler-di --cov-config .coveragerc --cov-report=xml" + poetry run pytest -p no:warnings $flags tests/ - uses: codecov/codecov-action@v1 with: diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 1917492..fdd65ac 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -1,4 +1,4 @@ -name: Deploy +name: Publish to the Pypi on: push: @@ -12,25 +12,29 @@ jobs: steps: - uses: actions/checkout@master - - name: Set up Python 3.9 - uses: actions/setup-python@v2 + - name: Set up Python 3.10 + uses: actions/setup-python@v4 with: - python-version: 3.9 + python-version: "3.10" + + - name: Install and configure Poetry + uses: snok/install-poetry@v1 + with: + version: 1.2.1 + virtualenvs-create: false + installer-parallel: true - - name: Install dependencies - run: | - pip install -U pip virtualenv poetry - poetry config virtualenvs.create false - name: Build run: | poetry build - name: Try install wheel run: | + pip install -U virtualenv mkdir -p try_install cd try_install virtualenv venv - venv/bin/pip install ../dist/apscheduler_di-*.whl - venv/bin/python -c "import apscheduler_di; print(apscheduler_di.__version__)" + venv/bin/pip install ../dist/glQiwiApi-*.whl + venv/bin/python -c "import glQiwiApi; print(glQiwiApi.__version__)" - name: Publish artifacts uses: actions/upload-artifact@v2 with: @@ -53,4 +57,4 @@ jobs: uses: pypa/gh-action-pypi-publish@master with: user: __token__ - password: ${{ secrets.PYPI_TOKEN }} + password: ${{ secrets.PYPI_TOKEN }} \ No newline at end of file