diff --git a/.github/workflows/check.yaml b/.github/workflows/check.yaml index a32b4ff..fb0d1df 100644 --- a/.github/workflows/check.yaml +++ b/.github/workflows/check.yaml @@ -21,30 +21,44 @@ jobs: matrix: python-version: ["3.9", "3.10", "3.11", "3.12"] + name: check ${{ matrix.python-version }} steps: - uses: actions/checkout@v4 + + - name: Set up uv + run: curl -LsSf https://astral.sh/uv/install.sh | sh - - name: Install rye - uses: phi-friday/install-rye@v2 - id: install-rye - with: - python_version: ${{ matrix.python-version }} + - name: Set up Python ${{ matrix.python-version }} + id: setup-python + run: | + uv python install ${{ matrix.python-version }} + uv python pin ${{ matrix.python-version }} + uv lock + echo "PY=$(uv run python -VV | shasum -a 256 | cut -d' ' -f1)" >> $GIHUB_OUPUT - - name: Load cached venv - id: cached-venv-dependencies + - name: Restore uv cache uses: actions/cache@v4 + id: uv-cache with: - path: .venv - key: venv-${{ runner.os }}-${{ steps.install-rye.outputs.python-version }}-${{ hashFiles('**/pyproject.toml') }} - + path: /tmp/.uv-cache + key: uv-${{ steps.setup-python.outputs.PY }}-${{ hashFiles('uv.lock') }} + restore-keys: | + uv-${{ steps.setup-python.outputs.PY }}-${{ hashFiles('uv.lock') }} + uv-${{ steps.setup-python.outputs.PY }} + - name: Install dependencies - if: steps.cached-venv-dependencies.outputs.cache-hit != 'true' - run: | - rye sync + if: steps.uv-cache.outputs.cache-hit != 'true' + run: uv sync + + - name: Restore pre-commit cache + uses: actions/cache@v4 + with: + path: ~/.cache/pre-commit + key: pre-commit-${{ steps.setup-python.outputs.PY }}-${{ hashFiles('.pre-commit-config.yaml') }} - name: Test with pytest run: | - rye run pytest + uv run pytest - name: Upload coverage reports to Codecov uses: codecov/codecov-action@v4 diff --git a/.github/workflows/lint.yaml b/.github/workflows/lint.yaml index a0af68f..909bb59 100644 --- a/.github/workflows/lint.yaml +++ b/.github/workflows/lint.yaml @@ -21,28 +21,43 @@ on: jobs: build: runs-on: ubuntu-latest + env: + PYTHON_VERSION: 3.9 steps: - uses: actions/checkout@v4 - - name: Install rye - uses: phi-friday/install-rye@v2 - id: install-rye - with: - python_version: "3.9" + - name: Set up uv + run: curl -LsSf https://astral.sh/uv/install.sh | sh + + - name: Set up Python + id: setup-python + run: | + uv python install ${{ env.PYTHON_VERSION }} + uv python pin ${{ env.PYTHON_VERSION }} + uv lock + echo "PY=$(uv run python -VV | shasum -a 256 | cut -d' ' -f1)" >> $GIHUB_OUPUT - - name: Load cached venv - id: cached-venv-dependencies + - name: Restore uv cache uses: actions/cache@v4 + id: uv-cache with: - path: .venv - key: venv-${{ runner.os }}-${{ steps.install-rye.outputs.python-version }}-${{ hashFiles('**/pyproject.toml') }} - + path: /tmp/.uv-cache + key: uv-${{ steps.setup-python.outputs.PY }}-${{ hashFiles('uv.lock') }} + restore-keys: | + uv-${{ steps.setup-python.outputs.PY }}-${{ hashFiles('uv.lock') }} + uv-${{ steps.setup-python.outputs.PY }} + - name: Install dependencies - if: steps.cached-venv-dependencies.outputs.cache-hit != 'true' - run: | - rye sync + if: steps.uv-cache.outputs.cache-hit != 'true' + run: uv sync + + - name: Restore pre-commit cache + uses: actions/cache@v4 + with: + path: ~/.cache/pre-commit + key: pre-commit-${{ steps.setup-python.outputs.PY }}-${{ hashFiles('.pre-commit-config.yaml') }} - name: Code checks run: | - rye run pre-commit run --all-files --show-diff-on-failure \ No newline at end of file + uv run pre-commit run --all-files --show-diff-on-failure \ No newline at end of file diff --git a/.github/workflows/publish.yaml b/.github/workflows/publish.yaml index 1ebef4e..35821a1 100644 --- a/.github/workflows/publish.yaml +++ b/.github/workflows/publish.yaml @@ -8,9 +8,8 @@ jobs: publish: runs-on: ubuntu-latest name: "Publish library" - strategy: - matrix: - python-version: ["3.12"] + env: + PYTHON_VERSION: 3.12 steps: - name: Check out @@ -19,20 +18,23 @@ jobs: token: "${{ secrets.GITHUB_TOKEN }}" fetch-depth: 0 - - name: Install rye - uses: phi-friday/install-rye@v2 - id: install-rye - with: - python_version: ${{ matrix.python-version }} + - name: Set up uv + run: curl -LsSf https://astral.sh/uv/install.sh | sh + + - name: Set up Python + id: setup-python + run: | + uv python install ${{ env.PYTHON_VERSION }} + uv python pin ${{ env.PYTHON_VERSION }} - name: Build package run: | - rye install dunamai - VERSION=$(dunamai from any --no-metadata --style pep440) - rye version $VERSION - rye build + VERSION=$(uvx dunamai from any --no-metadata --style pep440) + echo $VERSION + sed -i'' -E "s/version = \"0.0.0\"/version = \"$VERSION\"/g" pyproject.toml + uvx --from build pyproject-build --installer uv - name: Release to PyPI run: | - rye publish --yes \ - --username __token__ --token ${{ secrets.PYPI_API_TOKEN }} \ No newline at end of file + uvx twine upload dist/* --non-interactive \ + --username __token__ --password ${{ secrets.PYPI_API_TOKEN }} \ No newline at end of file