Skip to content

Commit f0188e3

Browse files
authored
Merge pull request #1 from JacobCoffee/feat/ci-improvements
2 parents 7147bae + 4529abc commit f0188e3

File tree

7 files changed

+1211
-358
lines changed

7 files changed

+1211
-358
lines changed

.github/workflows/ci.yml

Lines changed: 72 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,9 @@ on:
77
branches: [main]
88

99
jobs:
10-
test:
11-
name: Test on ${{ matrix.os }} - Python ${{ matrix.python-version }}
10+
# Smoke tests - quick validation on all platforms
11+
smoke-test:
12+
name: Smoke test on ${{ matrix.os }} - Python ${{ matrix.python-version }}
1213
runs-on: ${{ matrix.os }}
1314
strategy:
1415
fail-fast: false
@@ -30,32 +31,63 @@ jobs:
3031
enable-cache: true
3132

3233
- name: Install bunenv
33-
run: uv pip install -e .
34+
run: uv pip install -e . --system
3435

3536
- name: Test bunenv --version
3637
run: uv run bunenv --version
3738

3839
- name: Test bunenv --list
39-
run: uv run bunenv --list | head -5
40+
run: uv run bunenv --list --github-token="${{ secrets.GITHUB_TOKEN }}" | head -5
4041
shell: bash
4142

42-
- name: Create test environment (Unix)
43-
if: runner.os != 'Windows'
43+
- name: Test bunenv --help
44+
run: uv run bunenv --help
45+
46+
# Full integration test - only on one platform to save time/bandwidth
47+
integration-test:
48+
name: Integration test (Ubuntu + Python 3.12)
49+
runs-on: ubuntu-latest
50+
51+
steps:
52+
- uses: actions/checkout@v4
53+
54+
- name: Set up Python
55+
uses: actions/setup-python@v5
56+
with:
57+
python-version: "3.12"
58+
59+
- name: Install uv
60+
uses: astral-sh/setup-uv@v4
61+
with:
62+
enable-cache: true
63+
64+
- name: Install bunenv
65+
run: uv pip install -e . --system
66+
67+
- name: Create test environment with latest Bun
4468
run: |
4569
uv run bunenv test-env --bun=latest
4670
source test-env/bin/activate
71+
echo "Testing Bun installation..."
4772
bun --version
73+
echo "Testing Bun functionality..."
74+
bun --help
75+
deactivate_bun
4876
49-
- name: Create test environment (Windows)
50-
if: runner.os == 'Windows'
77+
- name: Create test environment with specific version
5178
run: |
52-
uv run bunenv test-env --bun=latest
53-
test-env\Scripts\activate.bat
54-
bun --version
55-
shell: cmd
79+
uv run bunenv test-env-1.3.0 --bun=1.3.0
80+
source test-env-1.3.0/bin/activate
81+
bun --version | grep "1.3.0"
82+
deactivate_bun
83+
84+
- name: Test environment cleanup
85+
run: |
86+
rm -rf test-env test-env-1.3.0
87+
echo "Cleanup successful"
5688
5789
lint:
58-
name: Lint
90+
name: Lint & Format
5991
runs-on: ubuntu-latest
6092

6193
steps:
@@ -69,19 +101,43 @@ jobs:
69101
- name: Install uv
70102
uses: astral-sh/setup-uv@v4
71103

72-
- name: Install dependencies
73-
run: uv pip install ruff
104+
- name: Sync dependencies
105+
run: uv sync --group dev
74106

75107
- name: Run ruff check
76108
run: uv run ruff check src/
77109

78110
- name: Run ruff format check
79111
run: uv run ruff format --check src/
80112

113+
- name: Run codespell
114+
run: uv run codespell src/ README.md
115+
116+
type-check:
117+
name: Type Check
118+
runs-on: ubuntu-latest
119+
120+
steps:
121+
- uses: actions/checkout@v4
122+
123+
- name: Set up Python
124+
uses: actions/setup-python@v5
125+
with:
126+
python-version: "3.12"
127+
128+
- name: Install uv
129+
uses: astral-sh/setup-uv@v4
130+
131+
- name: Sync dependencies
132+
run: uv sync --group dev
133+
134+
- name: Run ty
135+
uses: JacobCoffee/ty-action@v0.0.1
136+
81137
build:
82138
name: Build package
83139
runs-on: ubuntu-latest
84-
needs: [test, lint]
140+
needs: [smoke-test, integration-test, lint, type-check]
85141

86142
steps:
87143
- uses: actions/checkout@v4

.github/workflows/publish.yml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,16 @@ name: Publish to PyPI
33
on:
44
release:
55
types: [published]
6-
workflow_dispatch:
76

87
jobs:
8+
ci:
9+
name: Run CI checks
10+
uses: ./.github/workflows/ci.yml
11+
912
build:
1013
name: Build distribution
1114
runs-on: ubuntu-latest
15+
needs: ci
1216

1317
steps:
1418
- uses: actions/checkout@v4

.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,5 +74,4 @@ docs/_templates/
7474

7575
# uv
7676
.uv/
77-
uv.lock
7877
nodeenv/

.pre-commit-config.yaml

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
default_language_version:
2+
python: "3.12"
3+
default_install_hook_types: [commit-msg, pre-commit]
4+
repos:
5+
- repo: https://github.com/compilerla/conventional-pre-commit
6+
rev: v4.3.0
7+
hooks:
8+
- id: conventional-pre-commit
9+
stages: [commit-msg]
10+
11+
- repo: https://github.com/pre-commit/pre-commit-hooks
12+
rev: v6.0.0
13+
hooks:
14+
- id: check-ast
15+
- id: check-case-conflict
16+
- id: check-toml
17+
- id: debug-statements
18+
- id: end-of-file-fixer
19+
- id: mixed-line-ending
20+
- id: trailing-whitespace
21+
22+
- repo: https://github.com/astral-sh/ruff-pre-commit
23+
rev: v0.14.6
24+
hooks:
25+
- id: ruff-check
26+
args: ["--fix"]
27+
- id: ruff-format
28+
29+
- repo: https://github.com/codespell-project/codespell
30+
rev: v2.4.1
31+
hooks:
32+
- id: codespell
33+
additional_dependencies:
34+
- tomli
35+
36+
- repo: https://github.com/JacobCoffee/ty-pre-commit
37+
rev: v0.0.1
38+
hooks:
39+
- id: ty

pyproject.toml

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,3 +50,51 @@ name = "testpypi"
5050
url = "https://test.pypi.org/simple/"
5151
publish-url = "https://test.pypi.org/legacy/"
5252
explicit = true
53+
54+
[dependency-groups]
55+
dev = [
56+
"ruff>=0.14.6",
57+
"ty>=0.0.1a26",
58+
"prek>=0.2.18",
59+
"pytest>=7.4.3",
60+
"pytest-cov>=4.1.0",
61+
"codespell>=2.2.6",
62+
"pytest-sugar>=1.1.1",
63+
]
64+
65+
[tool.ruff]
66+
line-length = 120
67+
src = ["src"]
68+
target-version = "py38"
69+
70+
[tool.ruff.lint]
71+
select = ["E", "F", "W", "I"] # Errors, pyflakes, warnings, isort
72+
ignore = [
73+
"E501", # Line too long (handled by formatter)
74+
"COM812", # Missing trailing comma (conflicts with formatter)
75+
"ISC001", # Implicit string concatenation (conflicts with formatter)
76+
]
77+
# Note: Code adapted from nodeenv - keeping original style mostly intact
78+
79+
[tool.ruff.format]
80+
quote-style = "double"
81+
indent-style = "space"
82+
83+
[tool.ruff.lint.pydocstyle]
84+
convention = "google"
85+
86+
[tool.ruff.lint.mccabe]
87+
max-complexity = 15
88+
89+
[tool.ty]
90+
91+
[tool.ty.environment]
92+
python = ".venv"
93+
94+
[tool.ty.src]
95+
exclude = []
96+
97+
[tool.codespell]
98+
quiet-level = 3
99+
ignore-words-list = "selectin, alog"
100+
skip = "uv.lock, dist, build"

0 commit comments

Comments
 (0)