Skip to content

Commit

Permalink
🚀 Fix github workflows
Browse files Browse the repository at this point in the history
  • Loading branch information
GLEF1X committed Nov 7, 2022
1 parent d065fd9 commit eb1a8a9
Show file tree
Hide file tree
Showing 2 changed files with 68 additions and 22 deletions.
64 changes: 53 additions & 11 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -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:
Expand All @@ -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:
Expand Down
26 changes: 15 additions & 11 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Deploy
name: Publish to the Pypi

on:
push:
Expand All @@ -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:
Expand All @@ -53,4 +57,4 @@ jobs:
uses: pypa/gh-action-pypi-publish@master
with:
user: __token__
password: ${{ secrets.PYPI_TOKEN }}
password: ${{ secrets.PYPI_TOKEN }}

0 comments on commit eb1a8a9

Please sign in to comment.