Skip to content

Commit 851f7e5

Browse files
authored
Support uv, enable trusted publishing (#236)
1 parent be22eea commit 851f7e5

File tree

4 files changed

+90
-67
lines changed

4 files changed

+90
-67
lines changed

.github/workflows/build.yml

Lines changed: 0 additions & 57 deletions
This file was deleted.

.github/workflows/ci.yml

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
name: CI
2+
on:
3+
push:
4+
branches:
5+
- main
6+
tags:
7+
- v*
8+
pull_request:
9+
10+
permissions:
11+
contents: read
12+
13+
env:
14+
UV_SYSTEM_PYTHON: 1
15+
16+
jobs:
17+
test:
18+
runs-on: ${{ matrix.os }}
19+
strategy:
20+
fail-fast: false
21+
matrix:
22+
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12", "3.13"]
23+
os: [macOS-latest, ubuntu-latest, windows-latest]
24+
25+
steps:
26+
- name: Checkout
27+
uses: actions/checkout@v4
28+
- name: Set Up Python ${{ matrix.python-version }}
29+
uses: actions/setup-python@v5
30+
with:
31+
python-version: ${{ matrix.python-version }}
32+
allow-prereleases: true
33+
- uses: hynek/setup-cached-uv@v2
34+
with:
35+
cache-dependency-path: pyproject.toml
36+
- name: Install
37+
run: make EXTRAS=dev install
38+
- name: Test
39+
run: make test
40+
- name: Lint
41+
run: make lint
42+
43+
build:
44+
needs: test
45+
runs-on: ubuntu-latest
46+
steps:
47+
- uses: actions/checkout@v4
48+
- uses: actions/setup-python@v5
49+
with:
50+
python-version: '3.12'
51+
- uses: hynek/setup-cached-uv@v2
52+
with:
53+
cache-dependency-path: pyproject.toml
54+
- name: Install
55+
run: make EXTRAS=dev install
56+
- name: Build
57+
run: python -m build
58+
- name: Upload
59+
uses: actions/upload-artifact@v3
60+
with:
61+
name: sdist
62+
path: dist
63+
64+
publish:
65+
needs: build
66+
runs-on: ubuntu-latest
67+
if: startsWith(github.ref, 'refs/tags/v')
68+
permissions:
69+
id-token: write
70+
steps:
71+
- uses: actions/download-artifact@v3
72+
with:
73+
name: sdist
74+
path: dist
75+
- uses: pypa/gh-action-pypi-publish@release/v1

makefile

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,19 +7,24 @@ else
77
ACTIVATE:=.venv/bin/activate
88
endif
99

10+
UV:=$(shell uv --version)
11+
ifdef UV
12+
VENV:=uv venv
13+
PIP:=uv pip
14+
else
15+
VENV:=python -m venv
16+
PIP:=python -m pip
17+
endif
18+
1019
.venv:
11-
python -m venv .venv
12-
source $(ACTIVATE) && make install
13-
echo 'run `source $(ACTIVATE)` to use virtualenv'
20+
$(VENV) .venv
1421

1522
venv: .venv
23+
source $(ACTIVATE) && make install
24+
echo 'run `source $(ACTIVATE)` to use virtualenv'
1625

1726
install:
18-
python -m pip install -U pip
19-
python -m pip install -Ue .[$(EXTRAS)]
20-
21-
release: lint test clean
22-
flit publish
27+
$(PIP) install -Ue .[$(EXTRAS)]
2328

2429
format:
2530
python -m ufmt format $(SRCS)

pyproject.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,8 @@ ruff = [
3939
dev = [
4040
"attribution==1.8.0",
4141
"black==24.8.0",
42-
"coverage==7.6.1",
43-
"flit==3.9.0",
42+
"build>=1.2",
43+
"coverage>=7",
4444
"flake8==7.1.1",
4545
"mypy==1.11.2",
4646
"pygls==1.3.1",

0 commit comments

Comments
 (0)