From 4b3fa6eb468091291165ed4afc575a02b9d212d5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebasti=C3=A1n=20Ram=C3=ADrez?= Date: Sat, 12 Oct 2024 15:08:36 +0200 Subject: [PATCH] =?UTF-8?q?=F0=9F=91=B7=20Use=20uv=20in=20CI=20(#105)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/smokeshow.yml | 17 ++++++++++++----- .github/workflows/test.yml | 33 ++++++++++++++++++++------------- requirements-github-actions.txt | 1 + 3 files changed, 33 insertions(+), 18 deletions(-) create mode 100644 requirements-github-actions.txt diff --git a/.github/workflows/smokeshow.yml b/.github/workflows/smokeshow.yml index d3a975d..5402a02 100644 --- a/.github/workflows/smokeshow.yml +++ b/.github/workflows/smokeshow.yml @@ -8,11 +8,13 @@ on: permissions: statuses: write +env: + UV_SYSTEM_PYTHON: 1 + jobs: smokeshow: if: ${{ github.event.workflow_run.conclusion == 'success' }} runs-on: ubuntu-latest - steps: - name: Dump GitHub context env: @@ -21,16 +23,21 @@ jobs: - uses: actions/setup-python@v5 with: python-version: '3.9' - - - run: pip install smokeshow - + - name: Setup uv + uses: astral-sh/setup-uv@v3 + with: + version: "0.4.15" + enable-cache: true + cache-dependency-glob: | + requirements**.txt + pyproject.toml + - run: uv pip install -r requirements-github-actions.txt - uses: actions/download-artifact@v4 with: name: coverage-html path: htmlcov github-token: ${{ secrets.GITHUB_TOKEN }} run-id: ${{ github.event.workflow_run.id }} - - run: smokeshow upload htmlcov env: SMOKESHOW_GITHUB_STATUS_DESCRIPTION: Coverage {coverage-percentage} diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 14138b6..1aab321 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -21,6 +21,9 @@ on: required: false default: 'false' +env: + UV_SYSTEM_PYTHON: 1 + jobs: test: runs-on: ubuntu-latest @@ -43,14 +46,14 @@ jobs: uses: actions/setup-python@v5 with: python-version: ${{ matrix.python-version }} - # Issue ref: https://github.com/actions/setup-python/issues/436 - # cache: "pip" - # cache-dependency-path: pyproject.toml - - uses: actions/cache@v4 - id: cache + - name: Setup uv + uses: astral-sh/setup-uv@v3 with: - path: ${{ env.pythonLocation }} - key: ${{ runner.os }}-python-${{ env.pythonLocation }}-${{ hashFiles('pyproject.toml', 'requirements-tests.txt') }} + version: "0.4.15" + enable-cache: true + cache-dependency-glob: | + requirements**.txt + pyproject.toml # Allow debugging with tmate - name: Setup tmate session uses: mxschmitt/action-tmate@v3 @@ -58,8 +61,7 @@ jobs: with: limit-access-to-actor: true - name: Install Dependencies - if: steps.cache.outputs.cache-hit != 'true' - run: pip install -r requirements-tests.txt + run: uv pip install -r requirements-tests.txt - name: Lint run: bash scripts/lint.sh - run: mkdir coverage @@ -87,16 +89,21 @@ jobs: - uses: actions/setup-python@v5 with: python-version: '3.8' - # Issue ref: https://github.com/actions/setup-python/issues/436 - # cache: "pip" - # cache-dependency-path: pyproject.toml + - name: Setup uv + uses: astral-sh/setup-uv@v3 + with: + version: "0.4.15" + enable-cache: true + cache-dependency-glob: | + requirements**.txt + pyproject.toml - name: Get coverage files uses: actions/download-artifact@v4 with: pattern: coverage-* path: coverage merge-multiple: true - - run: pip install coverage[toml] + - run: uv pip install -r requirements-tests.txt - run: ls -la coverage - run: coverage combine coverage - run: coverage report diff --git a/requirements-github-actions.txt b/requirements-github-actions.txt new file mode 100644 index 0000000..0304a29 --- /dev/null +++ b/requirements-github-actions.txt @@ -0,0 +1 @@ +smokeshow