Create rust CI (#1)
Sets up CI in github actions Had to format some code to get it to pass
This commit is contained in:
parent
d18d72b646
commit
06cde8ae68
65
.github/workflows/rust.yml
vendored
Normal file
65
.github/workflows/rust.yml
vendored
Normal file
@ -0,0 +1,65 @@
|
||||
on: [push, pull_request]
|
||||
|
||||
name: Continuous Integration
|
||||
|
||||
jobs:
|
||||
check:
|
||||
name: Check
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions-rs/toolchain@v1
|
||||
with:
|
||||
profile: minimal
|
||||
toolchain: stable
|
||||
override: true
|
||||
- uses: actions-rs/cargo@v1
|
||||
with:
|
||||
command: check
|
||||
|
||||
test:
|
||||
name: Test Suite
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions-rs/toolchain@v1
|
||||
with:
|
||||
profile: minimal
|
||||
toolchain: stable
|
||||
override: true
|
||||
- uses: actions-rs/cargo@v1
|
||||
with:
|
||||
command: test
|
||||
args: unit
|
||||
|
||||
fmt:
|
||||
name: Rustfmt
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions-rs/toolchain@v1
|
||||
with:
|
||||
profile: minimal
|
||||
toolchain: stable
|
||||
override: true
|
||||
- run: rustup component add rustfmt
|
||||
- uses: actions-rs/cargo@v1
|
||||
with:
|
||||
command: fmt
|
||||
args: --all -- --check
|
||||
|
||||
clippy:
|
||||
name: Clippy
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions-rs/toolchain@v1
|
||||
with:
|
||||
profile: minimal
|
||||
toolchain: stable
|
||||
override: true
|
||||
- run: rustup component add clippy
|
||||
- uses: actions-rs/cargo@v1
|
||||
with:
|
||||
command: clippy
|
||||
args: -- -D warnings
|
11
src/lib.rs
11
src/lib.rs
@ -432,7 +432,7 @@ mod integration {
|
||||
|
||||
use api::ErrorMessage;
|
||||
|
||||
use crate::{OpenAIClient, OpenAIError, api};
|
||||
use crate::{api, OpenAIClient, OpenAIError};
|
||||
|
||||
/// Used by tests to get a client to the actual api
|
||||
fn get_client() -> OpenAIClient {
|
||||
@ -452,11 +452,16 @@ mod integration {
|
||||
let client = get_client();
|
||||
let result = client.engine(api::Engine::Ada).await;
|
||||
match result {
|
||||
Err(OpenAIError::APIError(ErrorMessage{message, error_type})) => {
|
||||
Err(OpenAIError::APIError(ErrorMessage {
|
||||
message,
|
||||
error_type,
|
||||
})) => {
|
||||
assert_eq!(message, "No engine with that ID: ada");
|
||||
assert_eq!(error_type, "invalid_request_error");
|
||||
}
|
||||
_ => {panic!("Expected an error message, got {:?}", result)}
|
||||
_ => {
|
||||
panic!("Expected an error message, got {:?}", result)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user