Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
62 changes: 62 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
name: CI

on:
push:
branches: [main]
pull_request:

concurrency:
group: ci-${{ github.ref }}
cancel-in-progress: true

env:
CARGO_TERM_COLOR: always

jobs:
# the clustering core, without the optional hnsw stack
core:
name: Core (no default features)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
with:
components: clippy, rustfmt
- uses: Swatinem/rust-cache@v2

- name: Format
run: cargo fmt --check

- name: Clippy
run: cargo clippy --no-default-features --all-targets -- -D warnings

- name: Test (debug)
run: cargo test --no-default-features
# release too: the optimality and property tests crawl in debug
- name: Test (release)
run: cargo test --no-default-features --release

# separate so an hnsw breakage doesn't take the core red
knn:
name: With kNN feature
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
with:
components: clippy
- uses: Swatinem/rust-cache@v2
- name: Clippy
run: cargo clippy --all-features --all-targets -- -D warnings
- name: Test
run: cargo test --all-features

semver:
name: Semver
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: obi1kenobi/cargo-semver-checks-action@v2
with:
feature-group: only-explicit-features
features: knn
54 changes: 44 additions & 10 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -1,21 +1,55 @@
name: Publish to crates.io

# tags only — this used to fire on every push to main
on:
push:
branches:
- main
tags:
- 'v*'

env:
CARGO_TERM_COLOR: always

jobs:
publish:
# publishing can't be undone, so re-check here rather than trust an earlier CI run
verify:
name: Verify
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
with:
toolchain: stable
override: true
- uses: katyo/publish-crates@v2
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
with:
registry-token: ${{ secrets.CARGO_REGISTRY_TOKEN }}
components: clippy, rustfmt
- uses: Swatinem/rust-cache@v2

- name: Format
run: cargo fmt --check
- name: Clippy
run: cargo clippy --no-default-features --all-targets -- -D warnings
- name: Test
run: cargo test --no-default-features --release

- name: Tag matches Cargo.toml version
run: |
tag="${GITHUB_REF_NAME#v}"
manifest=$(cargo metadata --no-deps --format-version 1 \
| python3 -c 'import json,sys; print(json.load(sys.stdin)["packages"][0]["version"])')
if [ "$tag" != "$manifest" ]; then
echo "tag v$tag does not match Cargo.toml version $manifest" >&2
exit 1
fi

- name: Package
run: cargo package --no-default-features

publish:
name: Publish
needs: [verify]
runs-on: ubuntu-latest
# add a required reviewer to this environment for a manual confirm step
environment: crates-io
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
- uses: Swatinem/rust-cache@v2
- name: Publish
run: cargo publish --token ${{ secrets.CARGO_REGISTRY_TOKEN }}
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
/target
/data
.idea
.idea/
.fleet
Loading
Loading