Skip to content

Commit

Permalink
👷 Add CI
Browse files Browse the repository at this point in the history
  • Loading branch information
ChanTsune committed Jan 25, 2024
1 parent 3040397 commit 68b35a3
Show file tree
Hide file tree
Showing 6 changed files with 150 additions and 0 deletions.
30 changes: 30 additions & 0 deletions .github/actions/setup-rust/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: 'Setup Rust'
description: 'Setup Rust by rustup'

inputs:
channel:
description: 'Rust release channel[stable|beta|nightly]'
default: stable
required: false
target:
description: 'Rust build target'
default: ''
required: false

runs:
using: 'composite'
steps:
- name: Install Rust toolchain
shell: bash
run: |
rustup update --no-self-update ${{ inputs.channel }}
rustup default ${{ inputs.channel }}
- name: Echo rust version
shell: bash
run: |
rustc --version
- if: ${{ inputs.target != '' }}
name: Install Rust target
shell: bash
run: |
rustup target add ${{ inputs.target }}
15 changes: 15 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# To get started with Dependabot version updates, you'll need to specify which
# package ecosystems to update and where the package manifests are located.
# Please see the documentation for all configuration options:
# https://help.github.com/github/administering-a-repository/configuration-options-for-dependency-updates

version: 2
updates:
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "daily"
- package-ecosystem: "cargo"
directory: "/"
schedule:
interval: "daily"
26 changes: 26 additions & 0 deletions .github/workflows/bench.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: rust-bench
on:
push:
branches: ["main"]
pull_request:
branches: ["*"]

jobs:
rust-bench:
name: Run rust-bench
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- name: Checkout code
uses: actions/checkout@v4
- uses: ./.github/actions/setup-rust
with:
channel: nightly
- name: Install dependencies
run: |
apt update
apt install -y fuse3 libfuse3-dev
- name: Run rust-bench
run: |
cargo bench --locked --all-features
14 changes: 14 additions & 0 deletions .github/workflows/format.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
name: format
on:
pull_request:
push:
jobs:
rust_check_format:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/setup-rust
- name: run check format
run: cargo fmt --check
env:
RUST_BACKTRACE: 1
43 changes: 43 additions & 0 deletions .github/workflows/rust-clippy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# This workflow uses actions that are not certified by GitHub.
# They are provided by a third-party and are governed by
# separate terms of service, privacy policy, and support
# documentation.
# rust-clippy is a tool that runs a bunch of lints to catch common
# mistakes in your Rust code and help improve your Rust code.
# More details at https://github.com/rust-lang/rust-clippy
# and https://rust-lang.github.io/rust-clippy/

name: rust-clippy analyze
on:
push:
branches: ["main"]
pull_request:
branches: ["main"]
schedule:
- cron: '29 14 * * 0'
jobs:
rust-clippy-analyze:
name: Run rust-clippy analyzing
runs-on: ubuntu-latest
permissions:
contents: read
security-events: write
steps:
- name: Checkout code
uses: actions/checkout@v4
- uses: ./.github/actions/setup-rust
- name: Install dependencies
run: |
apt update
apt install -y fuse3 libfuse3-dev
- name: Install required cargo
run: cargo install clippy-sarif sarif-fmt
- name: Run rust-clippy
run: |
cargo clippy --locked --all-features --message-format=json | clippy-sarif | tee rust-clippy-results.sarif | sarif-fmt
continue-on-error: true
- name: Upload analysis results to GitHub
uses: github/codeql-action/upload-sarif@v3
with:
sarif_file: rust-clippy-results.sarif
wait-for-processing: true
22 changes: 22 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: test
on:
pull_request:
push:
jobs:
rust_doc_test:
strategy:
matrix:
os:
- ubuntu-latest
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/setup-rust
- name: Install dependencies
run: |
apt update
apt install -y fuse3 libfuse3-dev
- name: Run test
run: cargo test --locked --release
env:
RUST_BACKTRACE: 1

0 comments on commit 68b35a3

Please sign in to comment.