Skip to content

Commit

Permalink
fix: action
Browse files Browse the repository at this point in the history
  • Loading branch information
phi-friday committed Feb 27, 2024
1 parent 9e0c1c3 commit 2aefc30
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 26 deletions.
37 changes: 21 additions & 16 deletions .github/workflows/check.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,33 +11,38 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.8", "3.9", "3.10", "3.11"]
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- name: Install poetry
run: |
pipx install poetry
poetry config installer.modern-installation false
poetry config virtualenvs.in-project true
- name: Install rye
uses: eifinger/setup-rye@v1

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

- name: Install dependencies
if: steps.cached-venv-dependencies.outputs.cache-hit != 'true'
run: |
poetry install --all-extras --with=dev
rye pin cpython@${{ matrix.python-version }}
rye sync --all-features
- name: Load cached pre-commit
id: cached-pre-commit-dependencies
uses: actions/cache@v4
with:
path: ~/.cache/pre-commit
key: precommit-${{ runner.os }}-${{ matrix.python-version }}-${{ hashFiles('.pre-commit-config.yaml') }}

- 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
19 changes: 9 additions & 10 deletions .github/workflows/publish.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:

steps:
- name: Check out
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
token: "${{ secrets.GITHUB_TOKEN }}"
fetch-depth: 0
Expand All @@ -25,25 +25,24 @@ jobs:
poetry config installer.modern-installation false
poetry config virtualenvs.in-project true
- name: Setup Python Env ${{ matrix.python-version }}
uses: actions/setup-python@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}

- 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
echo "from __future__ import annotations
__version__: str = \"$VERSION\"" > \
src/timeout_executor/_version.py
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 }} --yes || \
echo 'Version exists'

0 comments on commit 2aefc30

Please sign in to comment.