Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rust fuse for duefuse #1

Open
wants to merge 7 commits into
base: main
Choose a base branch
from
Open
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
23 changes: 23 additions & 0 deletions .cargo/config.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
[target.aarch64-unknown-linux-gnu]
rustflags = ["-C", "target-feature=+crt-static"]
linker = "aarch64-linux-gnu-gcc"

[target.mips-unknown-linux-gnu]
rustflags = ["-C", "target-feature=+crt-static"]
linker = "mips-linux-gnu-gcc"

[target.mipsel-unknown-linux-gnu]
rustflags = ["-C", "target-feature=+crt-static"]
linker = "mipsel-linux-gnu-gcc"

[target.mips64-unknown-linux-gnuabi64]
rustflags = ["-C", "target-feature=+crt-static"]
linker = "mips64-linux-gnuabi64-gcc"

[target.mips64el-unknown-linux-gnuabi64]
rustflags = ["-C", "target-feature=+crt-static"]
linker = "mips64el-linux-gnuabi64-gcc"

[target.riscv64gc-unknown-linux-gnu]
rustflags = ["-C", "target-feature=+crt-static"]
linker = "riscv64-linux-gnu-gcc"
74 changes: 74 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
on: [push, pull_request]

name: Continuous integration

jobs:
check:
name: Check
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
# Install fuse
- name: Install fuse
run: |
sudo apt-get update
sudo apt-get install -y fuse3 libfuse3-dev
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
override: true
- run: cargo check

test:
name: Test Suite
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
# Install fuse
- name: Install fuse
run: |
sudo apt-get update
sudo apt-get install -y fuse3 libfuse3-dev
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
override: true
- run: cargo test

fmt:
name: Rustfmt
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
# Install fuse
- name: Install fuse
run: |
sudo apt-get update
sudo apt-get install -y fuse3 libfuse3-dev
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
override: true
- run: rustup component add rustfmt
- run: cargo fmt --all -- --check

clippy:
name: Clippy
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
# Install fuse
- name: Install fuse
run: |
sudo apt-get update
sudo apt-get install -y fuse3 libfuse3-dev
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
override: true
- run: rustup component add clippy
- run: cargo clippy -- -D warnings
11 changes: 10 additions & 1 deletion .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,14 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v3
# Install fuse
- name: Install fuse
run: |
sudo apt-get update
sudo apt-get install -y fuse3 libfuse3-dev
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
override: true
- uses: pre-commit/[email protected]
109 changes: 109 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
name: release
on:
release:
types: [published]
permissions:
contents: write
jobs:
deploy:
name: deploy
runs-on: ${{ matrix.os }}
strategy:
matrix:
build: [linux,aarch64-linux,mips-linux,mipsel-linux,mips64-linux,mips64el-linux,riscv64,macos,macos-arm64,windows]
include:
- build: linux
os: ubuntu-latest
rust: nightly
target: x86_64-unknown-linux-musl
linker: musl-tools
- build: aarch64-linux
os: ubuntu-latest
rust: nightly
target: aarch64-unknown-linux-gnu
linker: gcc-aarch64-linux-gnu
- build: mips-linux
os: ubuntu-latest
rust: stable
target: mips-unknown-linux-gnu
linker: gcc-mips-linux-gnu
- build: mipsel-linux
os: ubuntu-latest
rust: stable
target: mipsel-unknown-linux-gnu
linker: gcc-mipsel-linux-gnu
- build: mips64-linux
os: ubuntu-latest
rust: stable
target: mips64-unknown-linux-gnuabi64
linker: gcc-mips64-linux-gnuabi64
- build: mips64el-linux
os: ubuntu-latest
rust: stable
target: mips64el-unknown-linux-gnuabi64
linker: gcc-mips64el-linux-gnuabi64
- build: riscv64
os: ubuntu-latest
rust: stable
target: riscv64gc-unknown-linux-gnu
linker: gcc-riscv64-linux-gnu
- build: macos
os: macos-latest
rust: nightly
target: x86_64-apple-darwin
- build: macos-arm64
os: macos-latest
rust: nightly
target: aarch64-apple-darwin
- build: windows
os: windows-2019
rust: nightly-x86_64-msvc
target: x86_64-pc-windows-msvc
fail-fast: false

steps:
- name: Checkout repository
uses: actions/checkout@v3

# Install fuse
- name: Install fuse
run: |
sudo apt-get update
sudo apt-get install -y fuse3 libfuse3-dev
- name: Install linker
if: matrix.build == 'linux' || matrix.build == 'aarch64-linux' || matrix.build == 'mips-linux' || matrix.build == 'mipsel-linux' ||matrix.build == 'mips64el-linux' || matrix.build == 'mips64-linux' || matrix.build == 'riscv64'
run: sudo apt-get update && sudo apt-get install ${{ matrix.linker }} -y

- name: Install Rust
uses: actions-rs/toolchain@v1
with:
toolchain: ${{ matrix.rust }}
profile: minimal
override: true
target: ${{ matrix.target }}
- name: Build binary
run: cargo build --verbose --release --target ${{ matrix.target }}
env:
RUST_BACKTRACE: 1

- name: Strip binary (linux and macos)
if: matrix.build == 'linux' || matrix.build == 'macos'
run: strip "target/${{ matrix.target }}/release/wakeonlan"

- name: rename binary
shell: bash
run: |
mkdir -p binary
if [ "${{ matrix.build }}" = "windows" ]; then
cp "./target/${{ matrix.target }}/release/wakeonlan.exe" ./binary/wakeonlan-${{ matrix.target }}.exe
else
cp "./target/${{ matrix.target }}/release/wakeonlan" ./binary/wakeonlan-${{ matrix.target }}
fi
- name: Upload binary
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: ./binary/wakeonlan*
file_glob: true
tag: ${{ github.ref }}
overwrite: true
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
mountpoint/

### JetBrains template
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio, WebStorm and Rider
# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839
Expand Down
12 changes: 12 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,15 @@ repos:
- id: debug-statements
- id: forbid-new-submodules
- id: trailing-whitespace

- repo: https://github.com/doublify/pre-commit-rust
rev: master
hooks:
- id: fmt
- id: cargo-check

ci:
skip:
# Cargo not available on CI
- "fmt"
- "cargo-check"
49 changes: 49 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
{
// 使用 IntelliSense 了解相关属性。
// 悬停以查看现有属性的描述。
// 欲了解更多信息,请访问: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"type": "lldb",
"request": "launch",
"name": "Debug executable 'duefuse'",
"cargo": {
"args": [
"build",
"--bin=duefuse",
"--package=duefuse"
],
"filter": {
"name": "duefuse",
"kind": "bin"
}
},
"args": [
"mountpoint",
"--auto_unmount",
"true"
],
"cwd": "${workspaceFolder}",
},
{
"type": "lldb",
"request": "launch",
"name": "Debug unit tests in executable 'duefuse'",
"cargo": {
"args": [
"test",
"--no-run",
"--bin=duefuse",
"--package=duefuse"
],
"filter": {
"name": "duefuse",
"kind": "bin"
}
},
"args": [],
"cwd": "${workspaceFolder}"
}
]
}
File renamed without changes.
Loading
Loading