Skip to content
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

setup CI #3

Merged
merged 5 commits into from
Mar 28, 2024
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
22 changes: 22 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: CI

on:
pull_request:
schedule: [ cron: "40 1 * * *" ]

permissions:
contents: read

env:
RUSTFLAGS: -Dwarnings

jobs:
test:
runs-on: ubuntu-latest
timeout-minutes: 45
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
- uses: Swatinem/rust-cache@v2
- run: cargo fmt -- --check
- run: cargo build
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "cold-stat"
version = "0.1.1"
version = "0.1.2"
edition = "2021"
authors = ["TATSUNO Yasuhiro <[email protected]>"]
license = "MIT"
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# cold-stat

![Crates.io Version](https://img.shields.io/crates/v/cold-stat)
[![Crates.io Version](https://img.shields.io/crates/v/cold-stat)](https://crates.io/crates/cold-stat)

A CLI tool to statically analyze the initialization time, known as cold-start, of AWS Lambda functions.

Expand Down
10 changes: 3 additions & 7 deletions src/lambda_invoker.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ impl LambdaInvoker {
}
}

pub async fn iterate(&self, iterations: u8) -> Result<(), anyhow::Error> {
pub async fn iterate(&self, iterations: u16) -> Result<(), anyhow::Error> {
let config = self.get_function_configuration().await?;
let mut env = config
.environment
Expand Down Expand Up @@ -110,12 +110,8 @@ impl LambdaInvoker {
Some(last_update_status) => {
info!("Checking if last update is successful: {last_update_status}");
match last_update_status {
LastUpdateStatus::Successful => {
Ok(true)
}
LastUpdateStatus::Failed | LastUpdateStatus::InProgress => {
Ok(false)
}
LastUpdateStatus::Successful => Ok(true),
LastUpdateStatus::Failed | LastUpdateStatus::InProgress => Ok(false),
unknown => {
warn!("LastUpdateStatus unknown: {unknown}");
Err(anyhow!("Unknown LastUpdateStatus, fn config is {config:?}"))
Expand Down
2 changes: 1 addition & 1 deletion src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ struct Args {
default_value_t = 100,
help = "Number of iterations to invoke the function. It is recommended to set 30 at least. Because the number of collected cold starts often is a bit shorter than the specified `ITERATIONS` due to eventual consistency of CloudWatch Logs."
)]
iterations: u8,
iterations: u16,

#[arg(
short,
Expand Down