Skip to content

Commit 574ec77

Browse files
blackopsreplclaude
andcommitted
Add CI, release workflows, crates.io publishing, and full Makefile
- Add GitHub Actions CI workflow (format, clippy, build, test, asset freshness) - Add release workflow for GitHub Releases on version tags - Add crates.io publish workflow triggered by version tags - Replace minimal Makefile with full build system (build, test, lint, ci-local, pre-release, version management, publishing targets) - Add crates.io metadata to Cargo.toml (rust-version, repository, keywords, categories, exclude) - Add commit-and-tag-version config with custom Cargo.toml updater - Add pre-commit hooks config - Fix cargo fmt formatting in src/lib.rs Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 4a89834 commit 574ec77

9 files changed

Lines changed: 535 additions & 14 deletions

File tree

‎.github/workflows/ci.yml‎

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: [main, dev, release/*, feature/*]
6+
pull_request:
7+
branches: [main, dev, release/*]
8+
9+
env:
10+
CARGO_TERM_COLOR: always
11+
12+
jobs:
13+
check:
14+
name: Check
15+
runs-on: ubuntu-latest
16+
17+
steps:
18+
- uses: actions/checkout@v4
19+
20+
- name: Install Rust
21+
run: |
22+
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --default-toolchain stable
23+
echo "$HOME/.cargo/bin" >> $GITHUB_PATH
24+
25+
- name: Cache cargo
26+
uses: actions/cache@v4
27+
with:
28+
path: |
29+
~/.cargo/registry
30+
~/.cargo/git
31+
target
32+
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
33+
34+
- name: Verify assets are up to date
35+
run: |
36+
make clean
37+
make assets
38+
git diff --exit-code static/sf/sf.css static/sf/sf.js
39+
40+
- name: Check formatting
41+
run: cargo fmt --all -- --check
42+
43+
- name: Run clippy
44+
run: cargo clippy --all-targets -- -D warnings
45+
46+
- name: Build
47+
run: cargo build
48+
49+
- name: Run tests
50+
run: cargo test
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
name: Publish to crates.io
2+
3+
on:
4+
push:
5+
tags:
6+
- 'v*'
7+
8+
env:
9+
CARGO_TERM_COLOR: always
10+
11+
jobs:
12+
publish:
13+
name: Publish
14+
runs-on: ubuntu-latest
15+
16+
steps:
17+
- uses: actions/checkout@v4
18+
19+
- name: Install Rust
20+
run: |
21+
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --default-toolchain stable
22+
echo "$HOME/.cargo/bin" >> $GITHUB_PATH
23+
24+
- name: Cache cargo
25+
uses: actions/cache@v4
26+
with:
27+
path: |
28+
~/.cargo/registry
29+
~/.cargo/git
30+
target
31+
key: ${{ runner.os }}-cargo-publish-${{ hashFiles('**/Cargo.lock') }}
32+
33+
- name: Check formatting
34+
run: cargo fmt --all -- --check
35+
36+
- name: Run clippy
37+
run: cargo clippy --all-targets -- -D warnings
38+
39+
- name: Build
40+
run: cargo build --release
41+
42+
- name: Run tests
43+
run: cargo test
44+
45+
- name: Dry-run publish
46+
run: cargo publish --dry-run
47+
48+
- name: Publish solverforge-ui
49+
run: cargo publish --token ${{ secrets.CARGO_REGISTRY_TOKEN }}

‎.github/workflows/release.yml‎

Lines changed: 101 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,101 @@
1+
name: Release
2+
3+
on:
4+
push:
5+
tags:
6+
- 'v*'
7+
workflow_dispatch:
8+
inputs:
9+
version:
10+
description: 'Version to release (e.g., 0.2.0)'
11+
required: true
12+
13+
permissions:
14+
contents: write
15+
16+
env:
17+
CARGO_TERM_COLOR: always
18+
19+
jobs:
20+
test:
21+
name: Run Tests
22+
runs-on: ubuntu-latest
23+
24+
steps:
25+
- uses: actions/checkout@v4
26+
27+
- name: Install Rust
28+
run: |
29+
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --default-toolchain stable
30+
echo "$HOME/.cargo/bin" >> $GITHUB_PATH
31+
32+
- name: Cache cargo
33+
uses: actions/cache@v4
34+
with:
35+
path: |
36+
~/.cargo/registry
37+
~/.cargo/git
38+
target
39+
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
40+
41+
- name: Check formatting
42+
run: cargo fmt --all -- --check
43+
44+
- name: Run clippy
45+
run: cargo clippy --all-targets -- -D warnings
46+
47+
- name: Build
48+
run: cargo build --release
49+
50+
- name: Run tests
51+
run: cargo test
52+
53+
create-release:
54+
name: Create GitHub Release
55+
runs-on: ubuntu-latest
56+
needs: [test]
57+
58+
steps:
59+
- uses: actions/checkout@v4
60+
with:
61+
fetch-depth: 0
62+
63+
- name: Get version
64+
id: version
65+
run: |
66+
if [ -n "${{ github.event.inputs.version }}" ]; then
67+
echo "version=${{ github.event.inputs.version }}" >> $GITHUB_OUTPUT
68+
else
69+
echo "version=${GITHUB_REF#refs/tags/v}" >> $GITHUB_OUTPUT
70+
fi
71+
72+
- name: Generate changelog
73+
id: changelog
74+
run: |
75+
PREV_TAG=$(git describe --tags --abbrev=0 HEAD^ 2>/dev/null || echo "")
76+
if [ -n "$PREV_TAG" ]; then
77+
CHANGELOG=$(git log --pretty=format:"* %s (%h)" $PREV_TAG..HEAD)
78+
else
79+
CHANGELOG=$(git log --pretty=format:"* %s (%h)" -20)
80+
fi
81+
echo "changelog<<EOF" >> $GITHUB_OUTPUT
82+
echo "$CHANGELOG" >> $GITHUB_OUTPUT
83+
echo "EOF" >> $GITHUB_OUTPUT
84+
85+
- name: Create Release
86+
uses: softprops/action-gh-release@v1
87+
with:
88+
name: v${{ steps.version.outputs.version }}
89+
body: |
90+
## What's Changed
91+
92+
${{ steps.changelog.outputs.changelog }}
93+
94+
## Installation
95+
96+
```toml
97+
[dependencies]
98+
solverforge-ui = "${{ steps.version.outputs.version }}"
99+
```
100+
draft: false
101+
prerelease: ${{ contains(steps.version.outputs.version, '-') }}

‎.pre-commit-config.yaml‎

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
repos:
2+
- repo: https://github.com/pre-commit/pre-commit-hooks
3+
rev: v4.5.0
4+
hooks:
5+
- id: check-yaml
6+
- id: end-of-file-fixer
7+
- id: trailing-whitespace
8+
- id: check-merge-conflict
9+
- id: check-added-large-files
10+
11+
- repo: https://github.com/gitleaks/gitleaks
12+
rev: v8.18.0
13+
hooks:
14+
- id: gitleaks
15+
- repo: https://github.com/doublify/pre-commit-rust
16+
rev: v1.0
17+
hooks:
18+
- id: fmt
19+
args: ["--", "--check"]
20+
- id: clippy
21+
args: ["--", "-D", "warnings"]

‎.versionrc.json‎

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
{
2+
"packageFiles": [
3+
{
4+
"filename": "Cargo.toml",
5+
"updater": "scripts/cargo-version.js"
6+
}
7+
],
8+
"bumpFiles": [
9+
{
10+
"filename": "Cargo.toml",
11+
"updater": "scripts/cargo-version.js"
12+
}
13+
]
14+
}

‎Cargo.toml‎

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,21 @@
22
name = "solverforge-ui"
33
version = "0.1.0"
44
edition = "2021"
5+
rust-version = "1.75"
56
description = "Frontend component library for SolverForge constraint-optimization applications"
67
license = "Apache-2.0"
8+
repository = "https://github.com/SolverForge/solverforge-ui"
9+
readme = "README.md"
10+
keywords = ["solverforge", "ui", "axum", "embedded-assets", "scheduling"]
11+
categories = ["web-programming", "gui"]
12+
exclude = [
13+
"screenshots/",
14+
"css-src/",
15+
"js-src/",
16+
"WIREFRAME.md",
17+
"scripts/",
18+
".versionrc.json",
19+
]
720

821
[dependencies]
922
axum = "0.8"

0 commit comments

Comments
 (0)