Skip to content

Commit

Permalink
fix: github actions
Browse files Browse the repository at this point in the history
  • Loading branch information
phi-friday committed Feb 27, 2024
1 parent d35ef7b commit bc90116
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 43 deletions.
21 changes: 8 additions & 13 deletions .github/workflows/check.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,25 +21,20 @@ jobs:
with:
python-version: ${{ matrix.python-version }}

- name: Install Poetry
uses: snok/install-poetry@v1
with:
virtualenvs-create: true
virtualenvs-in-project: true
installer-parallel: true
- name: Install rye
uses: eifinger/setup-rye@v1

- name: Load cached venv
id: cached-poetry-dependencies
id: cached-venv-dependencies
uses: actions/cache@v4
with:
path: .venv
key: venv-${{ runner.os }}-${{ matrix.python-version }}-${{ hashFiles('**/poetry.lock') }}
key: venv-${{ runner.os }}-${{ matrix.python-version }}-${{ hashFiles('**/pyproject.toml') }}

- name: Install dependencies
if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true'
if: steps.cached-venv-dependencies.outputs.cache-hit != 'true'
run: |
poetry config installer.max-workers 10
poetry install --no-interaction --extras uvloop --with=dev --without=docs
rye sync --features uvloop
- name: Load cached pre-commit
id: cached-pre-commit-dependencies
Expand All @@ -50,11 +45,11 @@ jobs:

- name: Code checks
run: |
poetry run pre-commit run --all-files --show-diff-on-failure
rye run pre-commit run --all-files --show-diff-on-failure
- name: Test with pytest
run: |
poetry run pytest
rye run pytest
- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v4
Expand Down
24 changes: 10 additions & 14 deletions .github/workflows/docs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,28 +21,24 @@ jobs:
with:
python-version: ${{ matrix.python-version }}

- name: Install Poetry
uses: snok/install-poetry@v1
with:
virtualenvs-create: true
virtualenvs-in-project: true
installer-parallel: true
- name: Install rye
uses: eifinger/setup-rye@v1

- name: Load cached venv
id: cached-poetry-dependencies
id: cached-venv-dependencies
uses: actions/cache@v4
with:
path: .venv
key: venv-doc-${{ runner.os }}-${{ matrix.python-version }}-${{ hashFiles('**/poetry.lock') }}
key: venv-doc-${{ runner.os }}-${{ matrix.python-version }}-${{ hashFiles('**/pyproject.toml') }}

- name: Install dependencies
if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true'
if: steps.cached-venv-dependencies.outputs.cache-hit != 'true'
run: |
poetry run pip install dunamai
VERSION=$(poetry run dunamai from any --no-metadata --style pep440)
poetry version $VERSION
poetry install --no-interaction --with=docs
pip install dunamai
VERSION=$(dunamai from any --no-metadata --style pep440)
rye version $VERSION
rye sync --no-dev --features docs
- name: Create docs
run: |
poetry run make html
rye run html
14 changes: 5 additions & 9 deletions .github/workflows/publish.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,23 +24,19 @@ jobs:
with:
python-version: ${{ matrix.python-version }}

- name: Install Poetry
uses: snok/install-poetry@v1
with:
virtualenvs-create: true
virtualenvs-in-project: true
installer-parallel: true
- name: Install rye
uses: eifinger/setup-rye@v1

- name: Install dependencies
run: pip install dunamai

- name: Build package
run: |
VERSION=$(dunamai from any --no-metadata --style pep440)
poetry version $VERSION
poetry build
rye version $VERSION
rye build
- name: Release to PyPI
run: |
poetry publish -u __token__ -p ${{ secrets.PYPI_API_TOKEN }} || \
rye publish --token ${{ secrets.PYPI_API_TOKEN }} || \
echo 'Version exists'
13 changes: 6 additions & 7 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,7 @@
name = "async-wrapper"
version = "0.0.0"
description = "async wrapper"
authors = [
{ name = "phi", email = "phi.friday@gmail.com" }
]
authors = [{ name = "phi", email = "phi.friday@gmail.com" }]
readme = "README.md"
license = "MIT"
classifiers = [
Expand All @@ -18,7 +16,7 @@ classifiers = [
"Programming Language :: Python :: Implementation :: CPython",
"Framework :: AnyIO",
"Framework :: AsyncIO",
"Framework :: Trio"
"Framework :: Trio",
]

requires-python = ">= 3.8"
Expand All @@ -30,9 +28,7 @@ dependencies = [
]

[project.optional-dependencies]
uvloop = [
"uvloop>=0.19.0; platform_system != 'Windows'",
]
uvloop = ["uvloop>=0.19.0; platform_system != 'Windows'"]
docs = [
"sphinx>=7.1.0",
"readthedocs-sphinx-search>=0.3.2",
Expand All @@ -52,6 +48,9 @@ dev-dependencies = [
"pytest-cov>=4.1.0",
]

[tool.rye.scripts]
html = { cmd = "make html" }

[build-system]
requires = ["hatchling"]
build-backend = "hatchling.build"
Expand Down

0 comments on commit bc90116

Please sign in to comment.