Skip to content

Commit 948f88d

Browse files
authored
Merge pull request #137 from cvxgrp/136-update-workflows
136 update workflows
2 parents a9c4aa1 + 9618400 commit 948f88d

File tree

8 files changed

+1254
-3050
lines changed

8 files changed

+1254
-3050
lines changed

Diff for: .github/workflows/pre-commit.yml

+14-3
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,23 @@
11
name: pre-commit
22

3+
permissions:
4+
contents: read
5+
36
on:
4-
pull_request:
57
push:
68

79
jobs:
10+
deptry:
11+
runs-on: ubuntu-latest
12+
13+
steps:
14+
- name: "Build the virtual environment for ${{ github.repository }}"
15+
uses: cvxgrp/.github/actions/uv/[email protected]
16+
17+
- uses: cvxgrp/.github/actions/[email protected]
18+
19+
820
pre-commit:
921
runs-on: ubuntu-latest
1022
steps:
11-
- uses: actions/checkout@v4
12-
- uses: pre-commit/[email protected]
23+
- uses: cvxgrp/.github/actions/[email protected]

Diff for: .github/workflows/release.yml

+24-8
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,39 @@
1-
name: Upload Python Package
1+
name: Bump version and publish
22

33
on:
4-
release:
5-
types: [published]
4+
workflow_dispatch
65

76
jobs:
8-
build:
7+
tag:
8+
permissions:
9+
contents: write
10+
911
runs-on: ubuntu-latest
12+
1013
steps:
11-
- uses: cvxgrp/.github/actions/[email protected]
14+
- name: "Build the virtual environment for ${{ github.repository }}"
15+
uses: cvxgrp/.github/actions/uv/[email protected]
1216

13-
deploy:
17+
- name: Generate Tag
18+
uses: cvxgrp/.github/actions/[email protected]
19+
with:
20+
github_token: ${{ secrets.GITHUB_TOKEN }}
21+
22+
publish:
23+
needs: tag
1424
runs-on: ubuntu-latest
15-
needs: build
1625
environment: release
1726

1827
permissions:
28+
contents: read
1929
# This permission is required for trusted publishing.
2030
id-token: write
2131

2232
steps:
23-
- uses: cvxgrp/.github/actions/[email protected]
33+
- uses: actions/download-artifact@v4
34+
with:
35+
name: dist
36+
path: dist
37+
38+
- name: Publish to PyPI
39+
uses: pypa/gh-action-pypi-publish@release/v1

Diff for: .github/workflows/test.yml

+6-3
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,14 @@ jobs:
1313

1414
strategy:
1515
matrix:
16-
os: [ubuntu-latest, windows-latest, macos-latest]
17-
python-version: ['3.10']
16+
os: [ubuntu-latest, macos-latest]
17+
python-version: ['3.10', '3.11', '3.12', '3.13']
1818

1919
# Steps represent a sequence of tasks that will be executed as part of the job
2020
steps:
21-
- uses: cvxgrp/.github/actions/[email protected]
21+
- name: "Build the virtual environment for ${{ github.repository }}"
22+
uses: cvxgrp/.github/actions/uv/[email protected]
2223
with:
2324
python-version: ${{ matrix.python-version }}
25+
26+
- uses: cvxgrp/.github/actions/[email protected]

Diff for: .pre-commit-config.yaml

+2-7
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,11 @@ repos:
1212
- id: black
1313

1414
- repo: https://github.com/charliermarsh/ruff-pre-commit
15-
rev: 'v0.0.286'
15+
rev: 'v0.9.4'
1616
hooks:
1717
- id: ruff
1818
args: [ --fix, --exit-non-zero-on-fix ]
19+
files: ^cvx/
1920

2021
- repo: https://github.com/igorshubovych/markdownlint-cli
2122
rev: v0.35.0
@@ -37,9 +38,3 @@ repos:
3738

3839
- id: check-github-workflows
3940
args: ["--verbose"]
40-
41-
- repo: https://github.com/python-poetry/poetry
42-
rev: '1.6.1' # add version here
43-
hooks:
44-
- id: poetry-check
45-
# - id: poetry-lock

Diff for: Makefile

+42-35
Original file line numberDiff line numberDiff line change
@@ -1,48 +1,55 @@
1+
# Colors for pretty output
2+
BLUE := \033[36m
3+
BOLD := \033[1m
4+
RESET := \033[0m
5+
16
.DEFAULT_GOAL := help
27

3-
SHELL=/bin/bash
8+
.PHONY: help verify install fmt test marimo clean
9+
10+
##@ Development Setup
11+
12+
venv:
13+
@printf "$(BLUE)Creating virtual environment...$(RESET)\n"
14+
@curl -LsSf https://astral.sh/uv/install.sh | sh
15+
@uv venv --python 3.12
416

5-
UNAME=$(shell uname -s)
17+
install: venv ## Install all dependencies using uv
18+
@printf "$(BLUE)Installing dependencies...$(RESET)\n"
19+
@uv sync --dev --frozen
620

7-
.PHONY: install
8-
install: ## Install a virtual environment
9-
@poetry install -vv --all-extras
21+
##@ Code Quality
1022

11-
.PHONY: fmt
12-
fmt: ## Run autoformatting and linting
13-
@poetry run pre-commit run --all-files
23+
fmt: venv ## Run code formatting and linting
24+
@printf "$(BLUE)Running formatters and linters...$(RESET)\n"
25+
@uv pip install pre-commit
26+
@uv run pre-commit install
27+
@uv run pre-commit run --all-files
1428

15-
.PHONY: test
16-
test: install ## Run tests
17-
@poetry run pytest
29+
##@ Testing
1830

19-
.PHONY: clean
20-
clean: ## Clean up caches and build artifacts
21-
@git clean -X -d -f
31+
test: install ## Run all tests
32+
@printf "$(BLUE)Running tests...$(RESET)\n"
33+
@uv pip install pytest
34+
@uv run pytest src/tests
2235

36+
##@ Cleanup
2337

24-
.PHONY: coverage
25-
coverage: install ## test and coverage
26-
@poetry run coverage run --source=cvx/. -m pytest
27-
@poetry run coverage report -m
28-
@poetry run coverage html
38+
clean: ## Clean generated files and directories
39+
@printf "$(BLUE)Cleaning project...$(RESET)\n"
40+
@git clean -d -X -f
2941

30-
@if [ ${UNAME} == "Darwin" ]; then \
31-
open htmlcov/index.html; \
32-
elif [ ${UNAME} == "linux" ]; then \
33-
xdg-open htmlcov/index.html 2> /dev/null; \
34-
fi
42+
##@ Marimo & Jupyter
3543

36-
.PHONY: tree
37-
tree: install ## make a tree
38-
@poetry show --tree
44+
jupyter: install ## Start a Jupyter server
45+
@printf "$(BLUE)Start Jupyter server...$(RESET)\n"
46+
@uv pip install jupyterlab
47+
@uv run jupyter lab
3948

40-
.PHONY: help
41-
help: ## Display this help screen
42-
@echo -e "\033[1mAvailable commands:\033[0m"
43-
@grep -E '^[a-z.A-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.*?## "}; {printf " \033[36m%-18s\033[0m %s\n", $$1, $$2}' | sort
49+
##@ Help
4450

45-
.PHONY: jupyter
46-
jupyter: install ## Run jupyter lab
47-
@poetry run pip install jupyterlab
48-
@poetry run jupyter lab
51+
help: ## Display this help message
52+
@printf "$(BOLD)Usage:$(RESET)\n"
53+
@printf " make $(BLUE)<target>$(RESET)\n\n"
54+
@printf "$(BOLD)Targets:$(RESET)\n"
55+
@awk 'BEGIN {FS = ":.*##"; printf ""} /^[a-zA-Z_-]+:.*?##/ { printf " $(BLUE)%-15s$(RESET) %s\n", $$1, $$2 } /^##@/ { printf "\n$(BOLD)%s$(RESET)\n", substr($$0, 5) }' $(MAKEFILE_LIST)

0 commit comments

Comments
 (0)