Skip to content

Commit

Permalink
chore: add github actions
Browse files Browse the repository at this point in the history
Signed-off-by: Gaius <[email protected]>
  • Loading branch information
gaius-qi committed Jan 10, 2025
1 parent a2ebf2d commit e819553
Show file tree
Hide file tree
Showing 14 changed files with 306 additions and 5 deletions.
7 changes: 7 additions & 0 deletions .github/CODEOWNERS
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# A CODEOWNERS file uses a pattern that follows the same rules used in gitignore files.
# The pattern is followed by one or more GitHub usernames or team names using the
# standard @username or @org/team-name format. You can also refer to a user by an
# email address that has been added to their GitHub account, for example [email protected]

* @dragonflyoss/dragonfly2-reviewers
.github @dragonflyoss/dragonfly2-maintainers
24 changes: 24 additions & 0 deletions .github/ISSUE_TEMPLATE/bug-report.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
---
name: Bug Report
about: Report a bug for vortex
labels: bug
---

### Bug report:

<!-- Please describe what is actually happening -->

### Expected behavior:

<!-- Please describe what you expect to happen -->

### How to reproduce it:

<!-- How can a maintainer reproduce this issue (please be detailed) -->

### Environment:

- Vortex version:
- OS:
- Kernel (e.g. `uname -a`):
- Others:
4 changes: 4 additions & 0 deletions .github/ISSUE_TEMPLATE/custom.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
---
name: Custom issue template
about: Custom issue template for vortex
---
17 changes: 17 additions & 0 deletions .github/ISSUE_TEMPLATE/feature-request.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
---
name: Feature Request
about: Request a new feature for vortex
labels: enhancement
---

### Feature request:

<!-- Please describe the feature request and why you would like to have it -->

### Use case:

<!-- Please add a concrete use case to demonstrate how such a feature would add value for the user. -->

### UI Example:

<!-- If this is about a new command or command line options, please let us know how you would add it to UI (in the code block below). -->
18 changes: 18 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<!--- Provide a general summary of your changes in the Title above -->

## Description

<!--- Describe your changes in detail -->

## Related Issue

<!--- This project only accepts pull requests related to open issues -->
<!--- If suggesting a new feature or change, please discuss it in an issue first -->
<!--- If fixing a bug, there should be an issue describing it with steps to reproduce -->
<!--- Please link to the issue here: -->

## Motivation and Context

<!--- Why is this change required? What problem does it solve? -->

## Screenshots (if appropriate)
10 changes: 10 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
version: 2
updates:
- package-ecosystem: "cargo"
directory: "/"
schedule:
interval: "weekly"
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "weekly"
25 changes: 25 additions & 0 deletions .github/workflows/check-size.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: Check Size

on:
push:
branches: [main, release-*]
pull_request:
branches: [main, release-*]

jobs:
check_size:
name: Check Size
timeout-minutes: 10
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 1

- name: Check large files
uses: actionsdesk/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
filesizelimit: "524288"
63 changes: 63 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
name: CI

on:
push:
branches: [main, release-*]
paths-ignore: ['**.md', '**.png', '**.jpg', '**.svg', '**/docs/**']
pull_request:
branches: [main, release-*]
paths-ignore: ['**.md', '**.png', '**.jpg', '**.svg', '**/docs/**']
schedule:
- cron: '0 4 * * *'

jobs:
check:
name: Cargo check
timeout-minutes: 30
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Rust cache
uses: Swatinem/rust-cache@v2
with:
cache-on-failure: true

- name: Install Protoc
uses: arduino/setup-protoc@v2

- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable

- name: Set up Clang
uses: egor-tensin/setup-clang@v1
with:
version: latest
platform: x64

- name: Run cargo check
run: |
cargo check --all --all-targets
test:
name: Run tests
timeout-minutes: 30
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Rust cache
uses: Swatinem/rust-cache@v2
with:
cache-on-failure: true

- name: Install Protoc
uses: arduino/setup-protoc@v2

- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable

- name: Run tests
run: cargo test --all-features
53 changes: 53 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
name: Lint

on:
push:
branches: [main, release-*]
pull_request:
branches: [main, release-*]

jobs:
lint:
name: Lint
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Rust cache
uses: Swatinem/rust-cache@v2
with:
cache-on-failure: true

- name: Install Protoc
uses: arduino/setup-protoc@v2

- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
with:
components: rustfmt, clippy

- name: Set up Clang
uses: egor-tensin/setup-clang@v1
with:
version: latest
platform: x64

- name: Run cargo fmt
run: |
cargo fmt --all -- --check
- name: Run cargo clippy
run: |
cargo clippy --all --all-targets -- -D warnings
- name: Markdown lint
uses: docker://avtodev/markdown-lint:v1@sha256:6aeedc2f49138ce7a1cd0adffc1b1c0321b841dc2102408967d9301c031949ee
with:
config: '.markdownlint.yml'
args: '**/*.md'

- uses: crate-ci/typos@b74202f74b4346efdbce7801d187ec57b266bac8
with:
config: .typos.toml
47 changes: 47 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
name: Release

on:
push:
tags:
- v*

jobs:
release-github:
runs-on: ubuntu-latest
timeout-minutes: 360
needs: [build]
permissions:
contents: write
steps:
- name: Release
uses: ncipollo/release-action@v1
with:
generateReleaseNotes: true
allowUpdates: true
draft: true

publish-crates:
runs-on: ubuntu-latest
timeout-minutes: 360
steps:
- name: Free Disk Space (Ubuntu)
uses: jlumbroso/free-disk-space@main
with:
tool-cache: false
android: true
dotnet: true
haskell: true
large-packages: true
docker-images: true
swap-storage: true

- name: Checkout
uses: actions/checkout@v4

- name: Install Rust
uses: dtolnay/rust-toolchain@stable

- uses: katyo/publish-crates@v2
with:
registry-token: ${{ secrets.CARGO_REGISTRY_TOKEN }}
ignore-unpublished-changes: true
6 changes: 6 additions & 0 deletions .markdownlint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
MD010: false

MD013: false

MD046:
style: "fenced"
22 changes: 22 additions & 0 deletions .typos.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
[files]
extend-exclude = [
"Cargo.lock",
"*.svg"
]
ignore-hidden = true
ignore-files = true
ignore-dot = true
ignore-vcs = true
ignore-global = true
ignore-parent = true

[default]
binary = false
check-filename = true
check-file = true
unicode = true
ignore-hex = true
identifier-leading-digits = false
locale = "en"
extend-ignore-identifiers-re = []
extend-ignore-re = []
2 changes: 2 additions & 0 deletions rust-toolchain.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[toolchain]
channel = "1.82.0"
13 changes: 8 additions & 5 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,14 @@
///
/// Protocol Format:
///
/// +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-...-+-+-+-+-+-+-+-+
/// | | | | |
/// | Packet ID (8 bits) | Tag (7 bits) | Length (30 bits) | Value (up to 1 GiB) |
/// | | | | |
/// +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-...-+-+-+-+-+-+-+-+
/// ```text
/// -------------------------------------------------------------------------------------------------
/// | | | | |
/// | Packet Identifier (8 bits) | Tag (7 bits) | Length (30 bits) | Value (up to 1 GiB) |
/// | | | | |
/// -------------------------------------------------------------------------------------------------
/// ```
///
/// For more information, please refer to the [Vortex Protocol](https://github.com/dragonflyoss/vortex/blob/main/docs/README.md).
#[derive(Debug, Clone)]
pub struct Vortex {}

0 comments on commit e819553

Please sign in to comment.