From c778fd04185a3407521400be1c5ca2329b8e13c3 Mon Sep 17 00:00:00 2001 From: tdstein Date: Thu, 30 May 2024 13:41:54 -0400 Subject: [PATCH] ci: speed up pip install --- .github/workflows/ci.yaml | 30 ++++++++---------------------- .github/workflows/coverage.yaml | 25 +++++++++++++++++++++++++ Makefile | 10 ++++++++-- 3 files changed, 41 insertions(+), 24 deletions(-) create mode 100644 .github/workflows/coverage.yaml diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index e4e0c3b3..90d2363a 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -1,9 +1,11 @@ name: CI on: - - push - - pull_request + pull_request: + push: + branches: + - main concurrency: - group: ${{ github.head_ref }} + group: ${{ github.workflow }}-${{ github.ref }} cancel-in-progress: true jobs: lint: @@ -15,28 +17,10 @@ jobs: python-version: 3.x check-latest: true cache: 'pip' + - uses: yezz123/setup-uv@v4 - run: make deps - run: make lint - cov: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - uses: actions/setup-python@v5 - with: - python-version: 3.x - check-latest: true - cache: 'pip' - - run: make deps - - run: make dev - - run: make test - - run: make cov-xml - - uses: orgoro/coverage@v3.1 - with: - coverageFile: coverage.xml - thresholdAll: 0.8 - token: ${{ secrets.GITHUB_TOKEN }} - test: runs-on: ubuntu-latest strategy: @@ -55,6 +39,7 @@ jobs: python-version: ${{ matrix.python-version }} check-latest: true cache: 'pip' + - uses: yezz123/setup-uv@v4 - run: make deps - run: make dev - run: make test @@ -68,5 +53,6 @@ jobs: python-version: 3.x check-latest: true cache: 'pip' + - uses: yezz123/setup-uv@v4 - run: make deps - run: make build diff --git a/.github/workflows/coverage.yaml b/.github/workflows/coverage.yaml new file mode 100644 index 00000000..9f931f09 --- /dev/null +++ b/.github/workflows/coverage.yaml @@ -0,0 +1,25 @@ +name: Coverage +on: + - pull_request +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true +jobs: + cov: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-python@v5 + with: + python-version: 3.x + check-latest: true + cache: 'pip' + - run: make deps + - run: make dev + - run: make test + - run: make cov-xml + - uses: orgoro/coverage@v3.1 + with: + coverageFile: coverage.xml + thresholdAll: 0.8 + token: ${{ secrets.GITHUB_TOKEN }} diff --git a/Makefile b/Makefile index 926c6a34..aa398c4b 100644 --- a/Makefile +++ b/Makefile @@ -4,9 +4,15 @@ NAME := posit-sdk # Command aliases -PIP := pip3 PYTHON := python3 +# Check if 'uv' is available +ifneq ($(shell command -v uv 2>/dev/null),) +PIP := uv pip +else +PIP := pip3 +endif + .PHONY: build clean @@ -52,7 +58,7 @@ cov-xml: # Target for installing project dependencies deps: - $(PIP) install -r requirements.txt -r requirements-dev.txt + $(PIP) install --upgrade pip setuptools wheel -r requirements.txt -r requirements-dev.txt # Target for installing the project in editable mode dev: