Skip to content

Commit

Permalink
Add CI
Browse files Browse the repository at this point in the history
  • Loading branch information
konstin committed Aug 23, 2024
1 parent b9c4696 commit 6718905
Show file tree
Hide file tree
Showing 4 changed files with 65 additions and 9 deletions.
55 changes: 55 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
name: Rust

on: [push, pull_request]

env:
CARGO_TERM_COLOR: always

jobs:
lint:
name: "Lint"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: 3.12
- name: "Install Rustfmt"
run: rustup component add rustfmt
- name: "Install uv"
run: curl -LsSf https://astral.sh/uv/install.sh | sh
- name: "rustfmt"
run: cargo fmt --all --check
- name: "Prettier"
run: npx prettier --check "**/*.{md,yml}"
- name: "Ruff"
run: |
uvx ruff check --diff .
uvx ruff format --diff .
clippy:
name: "Clippy"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
# > selecting a toolchain either by action or manual `rustup` calls should happen
# > before Swatinem/rust-cache, as the cache uses the current rustc version as its cache key
- name: "Install clippy"
run: |
rustup toolchain install stable --profile minimal
rustup component add clippy
- uses: Swatinem/rust-cache@v2
- run: cargo clippy
- run: cargo clippy --workspace --all-features

test:
name: "Test"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
# > selecting a toolchain either by action or manual `rustup` calls should happen
# > before Swatinem/rust-cache, as the cache uses the current rustc version as its cache key
- run: rustup toolchain install stable --profile minimal
- uses: Swatinem/rust-cache@v2
- run: cargo test
- run: cargo test --workspace --all-features
14 changes: 7 additions & 7 deletions Changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,20 @@

## 0.3.0

* Update svg to 0.17.0
- Update svg to 0.17.0

## 0.2.0

* Show whether an active span is running on and blocking the main thread or whether it's running in a threadpool with
- Show whether an active span is running on and blocking the main thread or whether it's running in a threadpool with
`tokio::task::spawn_blocking`. `--color-top`/`color_top` gets split into two colors, color top main and color top
threadpool. The former is used when the task is running on the main thread, the latter is used when it's offloaded to
the threadpool.
* Colorblind friendly default colors (http://www.cookbook-r.com/Graphs/Colors_(ggplot2)/#a-colorblind-friendly-palette):
* color top blocking: #E69F0088
* color top threadpool: #56B4E988
* color bottom: #E69F0088
- Colorblind friendly default colors (http://www.cookbook-r.com/Graphs/Colors_(ggplot2)/#a-colorblind-friendly-palette):
- color top blocking: #E69F0088
- color top threadpool: #56B4E988
- color bottom: #E69F0088

## 0.1.2

* Add `--inline-field` / `inline_field` option: If the is only one field, display its value inline. Since the text is
- Add `--inline-field` / `inline_field` option: If the is only one field, display its value inline. Since the text is
not limited to its box, text can overlap and become unreadable.
4 changes: 2 additions & 2 deletions Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ cargo run --bin plot --features plot --features cli -- --multi-lane examples/cac

The `traces.ndjson` output file will look something like below, where each section where a span is active is one line.

```ndjson
````ndjson
[...]
{"id":6,"name":"read_cache","start":{"secs":0,"nanos":122457871},"end":{"secs":0,"nanos":122463135},"parents":[5],"fields":{"id":"2"}}
{"id":5,"name":"cached_network_request","start":{"secs":0,"nanos":122433854},"end":{"secs":0,"nanos":122499689},"parents":[],"fields":{"id":"2","api":"https://example.net/cached"}}
Expand All @@ -76,7 +76,7 @@ The `traces.ndjson` output file will look something like below, where each secti
{"id":2251799813685253,"name":"cached_network_request","start":{"secs":0,"nanos":126144140},"end":{"secs":0,"nanos":126213181},"parents":[],"fields":{"api":"https://example.net/cached","id":"3"}}
{"id":27021597764222977,"name":"make_network_request","start":{"secs":0,"nanos":128343009},"end":{"secs":0,"nanos":128383121},"parents":[13510798882111491],"fields":{"api":"https://example.net/cached","id":"0"}}```
[...]
```
````

Note that 0 is the time of the first span, not the start of the process.

Expand Down
1 change: 1 addition & 0 deletions src/bin/plot.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
python plot.py traces.ndjson
```
"""

import os
from argparse import ArgumentParser
from collections import defaultdict
Expand Down

0 comments on commit 6718905

Please sign in to comment.