From 913be604315bf72e44ac873c4d2195a6de552d3d Mon Sep 17 00:00:00 2001 From: Paul Sanders Date: Sun, 27 Oct 2024 07:38:35 -0400 Subject: [PATCH] Update CI/CD to use setup-uv and uv publish --- .github/workflows/{ci.yaml => ci.yml} | 28 ++++--------------- .../{pypi_publish.yaml => pypi_publish.yml} | 11 +++----- ...lease-drafter.yaml => release_drafter.yml} | 0 3 files changed, 10 insertions(+), 29 deletions(-) rename .github/workflows/{ci.yaml => ci.yml} (61%) rename .github/workflows/{pypi_publish.yaml => pypi_publish.yml} (62%) rename .github/workflows/{release-drafter.yaml => release_drafter.yml} (100%) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yml similarity index 61% rename from .github/workflows/ci.yaml rename to .github/workflows/ci.yml index ce292b3..38b77e5 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yml @@ -16,25 +16,17 @@ jobs: steps: - uses: actions/checkout@v4 - name: Install uv - run: curl -LsSf https://astral.sh/uv/install.sh | sh + uses: astral-sh/setup-uv@v3 + with: + enable-cache: true - name: Set up Python uses: actions/setup-python@v5 with: python-version: ${{ env.PYTHON_VERSION }} - - name: Restore uv cache - uses: actions/cache@v4 - with: - path: ${{ env.UV_CACHE_DIR }} - key: uv-${{ runner.os }}-${{ hashFiles('uv.lock') }} - restore-keys: | - uv-${{ runner.os }}-${{ hashFiles('uv.lock') }} - uv-${{ runner.os }} - name: Install Dependencies run: uv sync --frozen --all-extras - name: mypy check run: uv run mypy camel_converter tests - - name: Minimize uv cache - run: uv cache prune --ci testing: strategy: fail-fast: false @@ -45,19 +37,13 @@ jobs: steps: - uses: actions/checkout@v4 - name: Install uv - run: curl -LsSf https://astral.sh/uv/install.sh | sh + uses: astral-sh/setup-uv@v3 + with: + enable-cache: true - name: Set up Python uses: actions/setup-python@v5 with: python-version: ${{ matrix.python-version }} - - name: Restore uv cache - uses: actions/cache@v4 - with: - path: ${{ env.UV_CACHE_DIR }} - key: uv-${{ runner.os }}-${{ hashFiles('uv.lock') }} - restore-keys: | - uv-${{ runner.os }}-${{ hashFiles('uv.lock') }} - uv-${{ runner.os }} - name: Install Dependencies run: uv sync --frozen --all-extras - name: Test with pytest @@ -68,5 +54,3 @@ jobs: with: token: ${{ secrets.CODECOV_TOKEN }} fail_ci_if_error: true - - name: Minimize uv cache - run: uv cache prune --ci diff --git a/.github/workflows/pypi_publish.yaml b/.github/workflows/pypi_publish.yml similarity index 62% rename from .github/workflows/pypi_publish.yaml rename to .github/workflows/pypi_publish.yml index ec1ab8a..5360419 100644 --- a/.github/workflows/pypi_publish.yaml +++ b/.github/workflows/pypi_publish.yml @@ -11,7 +11,9 @@ jobs: steps: - uses: actions/checkout@v4 - name: Install uv - run: curl -LsSf https://astral.sh/uv/install.sh | sh + uses: astral-sh/setup-uv@v3 + with: + enable-cache: true - name: Set up Python uses: actions/setup-python@v5 with: @@ -19,9 +21,4 @@ jobs: - name: Install Dependencies run: uv sync --frozen --all-extras - name: Build and publish package - env: - TWINE_USERNAME: __token__ - TWINE_PASSWORD: "${{ secrets.PYPI_API_KEY }}" - run: | - uvx --from build pyproject-build --installer uv - uvx twine upload dist/* + run: uv publish diff --git a/.github/workflows/release-drafter.yaml b/.github/workflows/release_drafter.yml similarity index 100% rename from .github/workflows/release-drafter.yaml rename to .github/workflows/release_drafter.yml