Skip to content

Commit bf37d96

Browse files
Merge pull request #4 from code0-tech/#1-lib-core
lib core
2 parents 9dca54e + 9a50c85 commit bf37d96

30 files changed

Lines changed: 5792 additions & 18 deletions

.github/workflows/ci.yml

Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
tags:
8+
- "v*"
9+
pull_request:
10+
workflow_dispatch:
11+
12+
permissions:
13+
contents: read
14+
15+
env:
16+
CARGO_TERM_COLOR: always
17+
RUST_BACKTRACE: "1"
18+
19+
jobs:
20+
check:
21+
name: Build and test
22+
runs-on: ubuntu-latest
23+
steps:
24+
- name: Check out repository
25+
uses: actions/checkout@v6
26+
with:
27+
persist-credentials: false
28+
29+
- name: Install Rust
30+
uses: dtolnay/rust-toolchain@stable
31+
with:
32+
components: clippy, rustfmt
33+
34+
- name: Cache Cargo
35+
uses: Swatinem/rust-cache@v2
36+
37+
- name: Check formatting
38+
run: cargo fmt --all -- --check
39+
40+
- name: Build workspace
41+
run: cargo build --workspace --locked
42+
43+
- name: Test workspace
44+
run: cargo test --workspace --locked
45+
46+
- name: Lint workspace
47+
run: cargo clippy --workspace --all-targets --locked -- -D warnings
48+
49+
publish:
50+
name: Publish lupus
51+
if: startsWith(github.ref, 'refs/tags/v')
52+
needs: check
53+
runs-on: ubuntu-latest
54+
environment: crates-io
55+
steps:
56+
- name: Check out repository
57+
uses: actions/checkout@v6
58+
with:
59+
persist-credentials: false
60+
61+
- name: Install Rust
62+
uses: dtolnay/rust-toolchain@stable
63+
64+
- name: Verify tag matches crate version
65+
shell: bash
66+
run: |
67+
set -euo pipefail
68+
crate_version="$(cargo metadata --no-deps --format-version 1 |
69+
jq -r '.packages[] | select(.name == "lupus") | .version')"
70+
tag_version="${GITHUB_REF_NAME#v}"
71+
if [[ "$tag_version" != "$crate_version" ]]; then
72+
echo "Tag $GITHUB_REF_NAME does not match lupus version $crate_version" >&2
73+
exit 1
74+
fi
75+
76+
- name: Publish to crates.io
77+
run: cargo publish -p lupus --locked
78+
env:
79+
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}

0 commit comments

Comments
 (0)