-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add lint, build, and test commands to justfile
, add fmt and clippy to CI workflow
#59
Merged
austin-denoble
merged 4 commits into
main
from
adenoble/refactor-justfile-add-clippy-fmt
Oct 1, 2024
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
40884aa
refactor justfile to have build and gen as different commands, add li…
austin-denoble 5cc0523
add clippy changes, use allows where necessary for now to get things …
austin-denoble 5a07a9a
clean up errors in doc comments causing warnings, clean up dead code …
austin-denoble c710466
review feedback - justfile tweaks
austin-denoble File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,34 +1,55 @@ | ||
name: CI | ||
|
||
on: | ||
pull_request: {} | ||
push: | ||
branches: | ||
- main | ||
workflow_dispatch: {} | ||
pull_request: {} | ||
push: | ||
branches: | ||
- main | ||
workflow_dispatch: {} | ||
|
||
jobs: | ||
test: | ||
runs-on: ${{ matrix.os }} | ||
strategy: | ||
matrix: | ||
os: [ubuntu-latest] | ||
rust: [stable] | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: hecrj/setup-rust-action@v2 | ||
with: | ||
rust-version: ${{ matrix.rust }} | ||
- name: Install protoc | ||
uses: arduino/setup-protoc@v3 | ||
- name: Build SDK | ||
run: cargo build | ||
- name: Build documentation | ||
run: cargo doc --no-deps | ||
- name: Run tests | ||
env: | ||
PINECONE_API_KEY: ${{ secrets.PINECONE_API_KEY }} | ||
SERVERLESS_INDEX_NAME: ${{ secrets.SERVERLESS_INDEX_NAME }} | ||
POD_INDEX_NAME: ${{ secrets.POD_INDEX_NAME }} | ||
COLLECTION_NAME: ${{ secrets.COLLECTION_NAME }} | ||
run: cargo test --verbose | ||
test: | ||
name: Test | ||
runs-on: ${{ matrix.os }} | ||
strategy: | ||
matrix: | ||
os: [ubuntu-latest] | ||
rust: [stable] | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: hecrj/setup-rust-action@v2 | ||
with: | ||
rust-version: ${{ matrix.rust }} | ||
- name: Install protoc | ||
uses: arduino/setup-protoc@v3 | ||
- name: Build SDK | ||
run: cargo build | ||
- name: Build documentation | ||
run: cargo doc --no-deps | ||
- name: Run tests | ||
env: | ||
PINECONE_API_KEY: ${{ secrets.PINECONE_API_KEY }} | ||
SERVERLESS_INDEX_NAME: ${{ secrets.SERVERLESS_INDEX_NAME }} | ||
POD_INDEX_NAME: ${{ secrets.POD_INDEX_NAME }} | ||
COLLECTION_NAME: ${{ secrets.COLLECTION_NAME }} | ||
run: cargo test --verbose | ||
fmt: | ||
name: Rustfmt | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: dtolnay/rust-toolchain@stable | ||
with: | ||
components: rustfmt | ||
- name: Enforce formatting | ||
run: cargo fmt --check | ||
clippy: | ||
name: Clippy | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: dtolnay/rust-toolchain@stable | ||
with: | ||
components: clippy | ||
- name: Run clippy | ||
run: cargo clippy -- -D warnings |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,39 @@ | ||
api_version := "2024-07" | ||
|
||
# Generate version file | ||
generate-version: | ||
echo "/// Pinecone API version\npub const API_VERSION: &str = \"{{api_version}}\";" > src/version.rs | ||
# Lint files and run tests with optional specific test cases | ||
test *tests: lint | ||
# Runs the specified tests, or all tests if none specified | ||
cargo test {{tests}} --verbose | ||
|
||
# Update git submodules recursively | ||
update: | ||
git submodule update --init --recursive | ||
|
||
# Run linting tools (cargo fmt and clippy) | ||
lint: | ||
cargo fmt && cargo clippy | ||
|
||
# Build the OpenAPI and Protobuf definitions in `codegen/apis` | ||
build-apis: | ||
# Run cargo build | ||
build: | ||
cargo build | ||
|
||
# Build the OpenAPI and Protobuf definitions in the `codegen/apis` submodule | ||
gen-build-submodule-apis: | ||
cd codegen/apis && just build | ||
|
||
# Generate the control plane OpenAPI code based on the yaml files in `codegen/apis/_build` | ||
build-openapi: build-apis generate-version | ||
gen-openapi: gen-build-submodule-apis gen-version_file | ||
./codegen/build-oas.sh {{api_version}} | ||
|
||
# Generate the data plane protobuf code based on the yaml files in `codegen/apis/_build` | ||
build-proto: build-apis generate-version | ||
gen-proto: gen-build-submodule-apis gen-version_file | ||
./codegen/build-proto.sh {{api_version}} | ||
|
||
# Generate all OpenAPI and protobuf code | ||
build-client: build-apis generate-version | ||
gen-client: gen-build-submodule-apis gen-version_file | ||
./codegen/build-oas.sh {{api_version}} | ||
./codegen/build-proto.sh {{api_version}} | ||
|
||
# Generate version file | ||
gen-version_file: | ||
echo "/// Pinecone API version\npub const API_VERSION: &str = \"{{api_version}}\";" > src/version.rs |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
might want to add a comment for consistency.