Skip to content

Commit

Permalink
chore: add license checker (#14)
Browse files Browse the repository at this point in the history
* chore: add license checker

Signed-off-by: MrCroxx <[email protected]>

* fix license checker config

Signed-off-by: MrCroxx <[email protected]>

---------

Signed-off-by: MrCroxx <[email protected]>
  • Loading branch information
MrCroxx authored May 26, 2023
1 parent 4d3a8e5 commit 5c09e60
Show file tree
Hide file tree
Showing 5 changed files with 75 additions and 1 deletion.
19 changes: 19 additions & 0 deletions .github/workflows/license_check.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
name: License Checker

on:
push:
branches:
- main
- "forks/*"
pull_request:
branches:
- main
- "v*.*.*-rc"
jobs:
license-header-check:
runs-on: ubuntu-latest
name: license-header-check
steps:
- uses: actions/checkout@v3
- name: Check License Header
uses: apache/skywalking-eyes/header@df70871af1a8109c9a5b1dc824faaf65246c5236
9 changes: 9 additions & 0 deletions .licenserc.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
header:
license:
spdx-id: Apache-2.0
copyright-owner: MrCroxx

paths:
- "**/*.rs"

comment: on-failure
14 changes: 14 additions & 0 deletions foyer-bench/src/analyze.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,17 @@
// Copyright 2023 MrCroxx
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

// Copyright 2023 RisingWave Labs
//
// Licensed under the Apache License, Version 2.0 (the "License");
Expand Down
14 changes: 14 additions & 0 deletions foyer-bench/src/rate.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,17 @@
// Copyright 2023 MrCroxx
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

// Copyright 2023 RisingWave Labs
//
// Licensed under the Apache License, Version 2.0 (the "License");
Expand Down
20 changes: 19 additions & 1 deletion foyer-bench/src/utils.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,17 @@
// Copyright 2023 MrCroxx
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

// Copyright 2023 RisingWave Labs
//
// Licensed under the Apache License, Version 2.0 (the "License");
Expand All @@ -17,8 +31,8 @@ use std::path::{Path, PathBuf};
use itertools::Itertools;
use nix::fcntl::readlink;
use nix::sys::stat::stat;
use nix::sys::statfs::{statfs, BTRFS_SUPER_MAGIC, EXT4_SUPER_MAGIC, TMPFS_MAGIC, XFS_SUPER_MAGIC};

#[allow(unused)]
#[derive(PartialEq, Clone, Copy, Debug)]
pub enum FsType {
Xfs,
Expand All @@ -28,9 +42,13 @@ pub enum FsType {
Others,
}

#[allow(unused)]
pub fn detect_fs_type(path: impl AsRef<Path>) -> FsType {
#[cfg(target_os = "linux")]
{
use nix::sys::statfs::{
statfs, BTRFS_SUPER_MAGIC, EXT4_SUPER_MAGIC, TMPFS_MAGIC, XFS_SUPER_MAGIC,
};
let fs_stat = statfs(path.as_ref()).unwrap();
match fs_stat.filesystem_type() {
XFS_SUPER_MAGIC => FsType::Xfs,
Expand Down

0 comments on commit 5c09e60

Please sign in to comment.