Skip to content

Commit

Permalink
Intro hello fs in rust
Browse files Browse the repository at this point in the history
  • Loading branch information
Wh1isper committed Aug 27, 2023
1 parent 3d0cca6 commit 03dd43e
Show file tree
Hide file tree
Showing 9 changed files with 930 additions and 0 deletions.
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"
54 changes: 54 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
on: [push, pull_request]

name: Continuous integration

jobs:
check:
name: Check
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- 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@v2
- 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@v2
- 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@v2
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
override: true
- run: rustup component add clippy
- run: cargo clippy -- -D warnings
104 changes: 104 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
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@v2

- 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
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

0 comments on commit 03dd43e

Please sign in to comment.