ci: run fmt, clippy and tests on the Gitea runner #18
18
.github/workflows/rust.yml
vendored
18
.github/workflows/rust.yml
vendored
@@ -10,13 +10,19 @@ env:
|
||||
CARGO_TERM_COLOR: always
|
||||
|
||||
jobs:
|
||||
build:
|
||||
|
||||
check:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- name: Build
|
||||
run: cargo build --verbose
|
||||
- name: Run tests
|
||||
run: cargo test --verbose
|
||||
# The Gitea runner image doesn't ship with Rust, unlike GitHub's.
|
||||
- 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 --all-targets -- -D warnings
|
||||
- name: Test
|
||||
run: cargo test
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
use console::style;
|
||||
use dialoguer::{theme::ColorfulTheme, Input};
|
||||
use dialoguer::{Input, theme::ColorfulTheme};
|
||||
use gemini_rs::prelude::*;
|
||||
use std::time::Duration;
|
||||
|
||||
|
||||
@@ -19,10 +19,12 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||
.add_text_part("Answer as if you were Yoda")
|
||||
.build();
|
||||
|
||||
let user_prompt = vec![Content::builder()
|
||||
.role(Role::User)
|
||||
.add_text_part("What is the airspeed of an unladen swallow?")
|
||||
.build()];
|
||||
let user_prompt = vec![
|
||||
Content::builder()
|
||||
.role(Role::User)
|
||||
.add_text_part("What is the airspeed of an unladen swallow?")
|
||||
.build(),
|
||||
];
|
||||
|
||||
let request = GenerateContentRequest::builder()
|
||||
.contents(user_prompt)
|
||||
|
||||
@@ -15,10 +15,12 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||
location_id,
|
||||
);
|
||||
|
||||
let prompt = vec![Content::builder()
|
||||
.role(Role::User)
|
||||
.add_text_part("Tell me the story of the genesis of the universe as a bedtime story.")
|
||||
.build()];
|
||||
let prompt = vec![
|
||||
Content::builder()
|
||||
.role(Role::User)
|
||||
.add_text_part("Tell me the story of the genesis of the universe as a bedtime story.")
|
||||
.build(),
|
||||
];
|
||||
|
||||
let request = GenerateContentRequest::builder().contents(prompt).build();
|
||||
|
||||
|
||||
@@ -14,10 +14,12 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||
location_id,
|
||||
);
|
||||
|
||||
let prompt = vec![Content::builder()
|
||||
.role(Role::User)
|
||||
.add_text_part("What is the airspeed of an unladen swallow?")
|
||||
.build()];
|
||||
let prompt = vec![
|
||||
Content::builder()
|
||||
.role(Role::User)
|
||||
.add_text_part("What is the airspeed of an unladen swallow?")
|
||||
.build(),
|
||||
];
|
||||
|
||||
let request = GenerateContentRequest::builder().contents(prompt).build();
|
||||
let response = gemini.generate_content(&request, "gemini-pro").await?;
|
||||
|
||||
Reference in New Issue
Block a user