Skip to content
This repository has been archived by the owner on Jun 28, 2022. It is now read-only.

Github CI lint and and tests #46

Merged
merged 2 commits into from
Apr 12, 2022
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
15 changes: 15 additions & 0 deletions .github/actions/cache/action.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
name: '[rust] Checkout and cache'
description: '[rust] Checkout cache'

runs:
using: composite
steps:
- name: ⚡ Cache
uses: actions/cache@v2
with:
path: |
~/.cargo/registry/
~/.cargo/git/db/
~/.cargo/bin/
target/
key: v2-${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.toml') }}
35 changes: 35 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: Lint
on: [push]
env:
CARGO_TERM_COLOR: always

jobs:
rustfmt:
runs-on: ubuntu-latest
steps:
- name: Checkout sources
uses: actions/checkout@v2
- name: Cache
uses: ./.github/actions/cache
- name: Install latest nightly toolchain and rustfmt
run: rustup update nightly && rustup default nightly && rustup component add rustfmt
- run: cargo fmt --all -- --check
clippy:
runs-on: ubuntu-latest
steps:
- name: Checkout sources
uses: actions/checkout@v2
- name: Cache
uses: ./.github/actions/cache
- name: Install latest nightly toolchain and clippy
run: rustup update nightly && rustup default nightly && rustup component add clippy
- run: cargo clippy --all-targets --all-features -- -D warnings
licensecheck:
runs-on: ubuntu-latest
steps:
- name: Checkout sources
uses: actions/checkout@v2
- name: Install licensecheck
run: sudo apt-get install -y licensecheck
- name: Check licenses
run: '! find . -name "*.rs" -o -name "*.c" -o -name "*.sh" | xargs licensecheck -c ".*" | grep -v "Apache License 2.0"'
16 changes: 16 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
name: Test
on: [push]
env:
CARGO_TERM_COLOR: always

jobs:
test:
name: cargo test --workspace
runs-on: ubuntu-latest
steps:
- name: Checkout sources
uses: actions/checkout@v2
- name: Cache
uses: ./.github/actions/cache
- run: cargo build --workspace --verbose
- run: cargo test --workspace --verbose
Comment on lines +7 to +16
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can I convince you to also build the examples/ffi? We've had issues with them bitrotting in the past so it'd be great to have them running in CI :)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, we should definitely add that build to the CI. But it seems I need to basically build the end artifact to make cmake happy.

I have another proposal in progress, which builds the world using bazel its not handling the example yet.
But once it does - it would just be this invocation in the CI for build checking everything:

bazel build //...

Bazel or no bazel, we'll definitely need to check this in CI at some point. So I can take a note, to return to it, if we decide bazel sucks too much :)

3 changes: 3 additions & 0 deletions ddprof-exporter/src/connector.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// Unless explicitly stated otherwise all files in this repository are licensed under the Apache License Version 2.0.
// This product includes software developed at Datadog (https://www.datadoghq.com/). Copyright 2021-Present Datadog, Inc.

use std::error::Error;
use std::future::Future;
use std::pin::Pin;
Expand Down
3 changes: 3 additions & 0 deletions ddprof-exporter/src/errors.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// Unless explicitly stated otherwise all files in this repository are licensed under the Apache License Version 2.0.
// This product includes software developed at Datadog (https://www.datadoghq.com/). Copyright 2021-Present Datadog, Inc.

use std::error;
use std::fmt;

Expand Down
3 changes: 3 additions & 0 deletions ddprof-ffi/src/vec.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// Unless explicitly stated otherwise all files in this repository are licensed under the Apache License Version 2.0.
// This product includes software developed at Datadog (https://www.datadoghq.com/). Copyright 2021-Present Datadog, Inc.

extern crate alloc;

use crate::Slice;
Expand Down