Skip to content

Commit 2bea0d5

Browse files
committed
ci: _
1 parent d0261d2 commit 2bea0d5

File tree

8 files changed

+326
-186
lines changed

8 files changed

+326
-186
lines changed

.github/workflows/ci.nix

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
{ pkgs, workflow-parts, ... }:
2+
let
3+
shared-base = import workflow-parts.shared.base { inherit pkgs; };
4+
shared-jobs = {
5+
tokei = import workflow-parts.shared.tokei { inherit pkgs; };
6+
};
7+
rust-base = import workflow-parts.rust.base { inherit pkgs; };
8+
rustc-versions = [ "nightly" "nightly-2024-10-10" ];
9+
rust-jobs-errors = {
10+
tests = import workflow-parts.rust.tests { inherit rustc-versions; };
11+
doc = import workflow-parts.rust.doc { inherit pkgs; };
12+
miri = import workflow-parts.rust.miri { inherit pkgs; };
13+
};
14+
rust-jobs-warn = {
15+
machete = import workflow-parts.rust.machete { inherit pkgs; };
16+
sort = import workflow-parts.rust.sort { inherit pkgs; };
17+
clippy = import workflow-parts.rust.clippy { inherit pkgs; };
18+
};
19+
base = {
20+
on = {
21+
push = { };
22+
pull_request = { };
23+
workflow_dispatch = { };
24+
};
25+
};
26+
in
27+
{
28+
errors = (pkgs.formats.yaml { }).generate "" (pkgs.lib.recursiveUpdate base {
29+
name = "Errors";
30+
inherit (shared-base) permissions;
31+
inherit (rust-base) env;
32+
jobs = pkgs.lib.recursiveUpdate rust-base.jobs rust-jobs-errors;
33+
});
34+
warnings = (pkgs.formats.yaml { }).generate "" (pkgs.lib.recursiveUpdate base {
35+
name = "Warnings";
36+
inherit (shared-base) permissions;
37+
jobs = pkgs.lib.recursiveUpdate shared-jobs rust-jobs-warn;
38+
});
39+
}

.github/workflows/ci.yml

Lines changed: 0 additions & 177 deletions
This file was deleted.

.github/workflows/errors.yml

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
env:
2+
CARGO_INCREMENTAL: '0'
3+
CARGO_NET_RETRY: '10'
4+
RUSTUP_MAX_RETRIES: '10'
5+
RUST_BACKTRACE: short
6+
jobs:
7+
doc:
8+
env:
9+
RUSTDOCFLAGS: -Dwarnings
10+
if: needs.pre_ci.outputs.continue
11+
name: Documentation
12+
needs: pre_ci
13+
runs-on: ubuntu-latest
14+
steps:
15+
- uses: actions/checkout@v4
16+
- uses: dtolnay/rust-toolchain@nightly
17+
- uses: dtolnay/install@cargo-docs-rs
18+
- run: cargo docs-rs
19+
timeout-minutes: 45
20+
miri:
21+
if: needs.pre_ci.outputs.continue
22+
name: Miri
23+
needs: pre_ci
24+
runs-on: ubuntu-latest
25+
steps:
26+
- uses: actions/checkout@v4
27+
- uses: dtolnay/rust-toolchain@miri
28+
- run: cargo miri setup
29+
- env:
30+
MIRIFLAGS: -Zmiri-strict-provenance
31+
run: cargo miri test
32+
timeout-minutes: 45
33+
pre_ci:
34+
uses: valeratrades/.github/.github/workflows/pre_ci.yml@master
35+
tests:
36+
if: needs.pre_ci.outputs.continue
37+
name: Rust ${{matrix.rust}}
38+
needs: pre_ci
39+
runs-on: ubuntu-latest
40+
steps:
41+
- uses: actions/checkout@v4
42+
- uses: dtolnay/rust-toolchain@master
43+
with:
44+
toolchain: ${{matrix.rust}}
45+
- if: github.ref == 'refs/heads/release'
46+
name: Set RUSTFLAGS for release branch
47+
run: echo "RUSTFLAGS=-Dwarnings" >> $GITHUB_ENV
48+
- if: matrix.rust == 'nightly'
49+
name: Enable type layout randomization
50+
run: echo RUSTFLAGS=${RUSTFLAGS}\ -Zrandomize-layout\ --cfg=exhaustive >> $GITHUB_ENV
51+
- run: cargo update
52+
- run: cargo check
53+
- run: cargo test
54+
strategy:
55+
fail-fast: false
56+
matrix:
57+
rust:
58+
- nightly
59+
- nightly-2024-10-10
60+
timeout-minutes: 45
61+
name: Errors
62+
'on':
63+
pull_request: {}
64+
push: {}
65+
workflow_dispatch: {}
66+
permissions:
67+
contents: read

.github/workflows/warnings.yml

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
jobs:
2+
clippy:
3+
if: github.event_name != 'pull_request'
4+
name: Clippy
5+
runs-on: ubuntu-latest
6+
steps:
7+
- uses: actions/checkout@v4
8+
- uses: dtolnay/rust-toolchain@clippy
9+
- run: cargo clippy --tests -- -Dwarnings
10+
timeout-minutes: 45
11+
machete:
12+
name: Unused Dependencies
13+
runs-on: ubuntu-latest
14+
steps:
15+
- name: Installation
16+
uses: taiki-e/install-action@v2
17+
with:
18+
tool: cargo-machete
19+
- name: Cargo Machete
20+
run: "\t\t\t\t\t\tcargo machete\n\t\t\t\t\t\texit_code=$?\n\t\t\t\t\t\tif [\
21+
\ $exit_code = 0 ]; then\n\t\t\t\t\t\t\techo \"Found unused dependencies\"\
22+
\n\t\t\t\t\t\t\texit $exit_code\n\t\t\t\t\t\tfi\n\t\t\t"
23+
sort:
24+
name: Cargo Sorted
25+
runs-on: ubuntu-latest
26+
steps:
27+
- uses: actions/checkout@v4
28+
- name: Installation
29+
uses: taiki-e/install-action@v2
30+
with:
31+
tool: cargo-sort
32+
- name: Check if Cargo.toml is sorted
33+
run: "cargo sort -wc\nexit_code=$?\nif [ $exit_code != 0 ]; then\n echo \"\
34+
Cargo.toml is not sorted. Run \\`cargo sort -w\\` to fix it.\"\n exit $exit_code\n\
35+
fi\n"
36+
tokei:
37+
name: Reasonable Amount of Comments
38+
runs-on: ubuntu-latest
39+
steps:
40+
- name: Checkout repository
41+
uses: actions/checkout@v4
42+
- name: Installation
43+
uses: taiki-e/install-action@v2
44+
with:
45+
tool: tokei
46+
- name: Generate Tokei output
47+
run: tokei -o json > tokei_output.json
48+
- name: Install jq
49+
run: sudo apt-get install -y jq
50+
- name: Check Rust comments
51+
run: "\t\t\t\t\t\tcomments=$(jq '.Rust.comments' tokei_output.json)\n\t\t\t\t\
52+
\t\tcode=$(jq '.Rust.code' tokei_output.json)\n\t\t\t\t\t\tif [ $((comments\
53+
\ * 10)) -ge $code ]; then\n\t\t\t\t\t\t\techo \"Number of comments should\
54+
\ be less than 10% of code\"\n\t\t\t\t\t\t\texit 1\n\t\t\t\t\t\telse\n\t\t\
55+
\t\t\t\t\techo \"Check passed: Number of comments is less than 10% of code\"\
56+
\n\t\t\t\t\t\tfi\n\t\t\t"
57+
name: Warnings
58+
'on':
59+
pull_request: {}
60+
push: {}
61+
workflow_dispatch: {}
62+
permissions:
63+
contents: read

.pre-commit-config.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/nix/store/kgi0468mzxv9pszs5xsp3irdphpfzg53-pre-commit-config.json

README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,10 @@
22
![Minimum Supported Rust Version](https://img.shields.io/badge/nightly-1.83+-ab6000.svg)
33
[<img alt="crates.io" src="https://img.shields.io/crates/v/v_exchanges.svg?color=fc8d62&logo=rust" height="20" style=flat-square>](https://crates.io/crates/v_exchanges)
44
[<img alt="docs.rs" src="https://img.shields.io/badge/docs.rs-66c2a5?style=for-the-badge&labelColor=555555&logo=docs.rs&style=flat-square" height="20">](https://docs.rs/v_exchanges)
5-
[<img alt="build status" src="https://img.shields.io/github/actions/workflow/status/valeratrades/v_exchanges/ci.yml?branch=master&style=for-the-badge&style=flat-square" height="20">](https://github.com/valeratrades/v_exchanges/actions?query=branch%3Amaster) <!--NB: Won't find it if repo is private-->
65
![Lines Of Code](https://img.shields.io/badge/LoC-2032-lightblue)
6+
<br>
7+
[<img alt="ci errors" src="https://img.shields.io/github/actions/workflow/status/valeratrades/v_exchanges/errors.yml?branch=master&style=for-the-badge&style=flat-square&label=errors&labelColor=420d09" height="20">](https://github.com/valeratrades/v_exchanges/actions?query=branch%3Amaster) <!--NB: Won't find it if repo is private-->
8+
[<img alt="ci warnings" src="https://img.shields.io/github/actions/workflow/status/valeratrades/v_exchanges/warnings.yml?branch=master&style=for-the-badge&style=flat-square&label=warnings&labelColor=d16002" height="20">](https://github.com/valeratrades/v_exchanges/actions?query=branch%3Amaster) <!--NB: Won't find it if repo is private-->
79

810
Trying to make a unified library for all crypto exchange interactions, instead of redefining the response structs again and again.
911

0 commit comments

Comments
 (0)