diff --git a/.github/workflows/check.yaml b/.github/workflows/check.yaml index c5d7f07..2043873 100644 --- a/.github/workflows/check.yaml +++ b/.github/workflows/check.yaml @@ -17,46 +17,38 @@ on: jobs: build: runs-on: ubuntu-latest + env: + UV_CACHE_DIR: /tmp/.uv-cache strategy: matrix: python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"] + name: check ${{ matrix.python-version }} steps: - uses: actions/checkout@v4 - - name: Install rye - uses: phi-friday/install-rye@v2 - id: install-rye - with: - python_version: ${{ matrix.python-version }} - - - name: prepare dependencies - id: prepare-dependencies - run: | - rye install uv - rye lock # init venv - rye build + - name: Set up uv + run: curl -LsSf https://astral.sh/uv/install.sh | sh - - name: Load cached venv - id: cached-venv-dependencies - uses: actions/cache@v4 - with: - path: .venv - key: venv-test-${{ runner.os }}-${{ steps.install-rye.outputs.python-version }}-${{ hashFiles('**/pyproject.toml') }} + - name: Set up Python ${{ matrix.python-version }} + id: setup-python + run: | + uv python install ${{ matrix.python-version }} + uv python pin ${{ matrix.python-version }} - name: Install dependencies - if: steps.cached-venv-dependencies.outputs.cache-hit != 'true' run: | - export UV_PYTHON=$(rye run python -c "import sys; print(sys.executable)") + export UV_PYTHON=$(uv run python -c "import sys; print(sys.executable)") uv pip compile pyproject.toml -o requirements.txt --extra test uv pip install -r requirements.txt - name: Install self run: | - export UV_PYTHON=$(rye run python -c "import sys; print(sys.executable)") + export UV_PYTHON=$(uv run python -c "import sys; print(sys.executable)") + uvx --from build pyproject-build --installer uv uv pip install dist/airflow_serde_polars-0.0.0-py3-none-any.whl --reinstall-package airflow-serde-polars - name: Test with pytest run: | - source .venv/bin/activate - pytest -m "airflow or not airflow" \ No newline at end of file + uv run pytest -m "airflow or not airflow" + \ No newline at end of file diff --git a/.github/workflows/lint.yaml b/.github/workflows/lint.yaml index 6747c13..87ea2b2 100644 --- a/.github/workflows/lint.yaml +++ b/.github/workflows/lint.yaml @@ -21,28 +21,55 @@ on: jobs: build: runs-on: ubuntu-latest + env: + PYTHON_VERSION: 3.8 + UV_CACHE_DIR: /tmp/.uv-cache 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: "3.8" - - name: Load cached venv - id: cached-venv-dependencies + - name: Set up Python + id: setup-python + run: | + uv python install ${{ env.PYTHON_VERSION }} + uv python pin ${{ env.PYTHON_VERSION }} + uv lock + PY=$(uv run python -VV | shasum -a 256 | cut -d' ' -f1) + echo PY: $PY + echo "PY=$PY" >> "$GITHUB_OUTPUT" + + - name: Restore uv cache uses: actions/cache@v4 + id: uv-cache with: - path: .venv - key: venv-lint-${{ runner.os }}-${{ steps.install-rye.outputs.python-version }}-${{ hashFiles('**/pyproject.toml') }} - + path: ${{ env.UV_CACHE_DIR }} + 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 + + - name: Minimize uv cache + run: uv cache prune --ci \ No newline at end of file diff --git a/.github/workflows/publish.yaml b/.github/workflows/publish.yaml index 1ebef4e..363fe65 100644 --- a/.github/workflows/publish.yaml +++ b/.github/workflows/publish.yaml @@ -8,9 +8,6 @@ jobs: publish: runs-on: ubuntu-latest name: "Publish library" - strategy: - matrix: - python-version: ["3.12"] steps: - name: Check out @@ -19,20 +16,17 @@ 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: 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