fix: add Rust/Cargo CI workflow for gitpulse project
This commit is contained in:
@@ -2,54 +2,68 @@ name: CI
|
|||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
branches: [main, master]
|
branches: [main]
|
||||||
pull_request:
|
pull_request:
|
||||||
branches: [main, master]
|
branches: [main]
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
test:
|
build:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
- name: Setup Rust
|
- name: Install Rust
|
||||||
uses: actions/setup-rust@v1
|
uses: actions-rs/toolchain@v1
|
||||||
with:
|
with:
|
||||||
rust-version: '1.70'
|
toolchain: stable
|
||||||
cache: true
|
profile: minimal
|
||||||
|
override: true
|
||||||
|
|
||||||
- name: Build
|
- name: Install dependencies
|
||||||
|
run: |
|
||||||
|
sudo apt-get update
|
||||||
|
sudo apt-get install -y libgit2-dev pkg-config
|
||||||
|
|
||||||
|
- name: Build project
|
||||||
run: cargo build --release
|
run: cargo build --release
|
||||||
|
|
||||||
- name: Run tests
|
- name: Run tests
|
||||||
run: cargo test
|
run: cargo test --all
|
||||||
|
|
||||||
- name: Check formatting
|
lint:
|
||||||
run: cargo fmt -- --check
|
|
||||||
|
|
||||||
- name: Clippy
|
|
||||||
run: cargo clippy --all-targets --all-features -- -D warnings
|
|
||||||
|
|
||||||
release:
|
|
||||||
needs: test
|
|
||||||
if: startsWith(github.ref, 'refs/tags/v')
|
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
- name: Setup Rust
|
- name: Install Rust
|
||||||
uses: actions/setup-rust@v1
|
uses: actions-rs/toolchain@v1
|
||||||
with:
|
with:
|
||||||
rust-version: '1.70'
|
toolchain: stable
|
||||||
cache: true
|
profile: minimal
|
||||||
|
override: true
|
||||||
|
|
||||||
- name: Build release
|
- name: Install dependencies
|
||||||
run: cargo build --release
|
run: |
|
||||||
|
sudo apt-get update
|
||||||
|
sudo apt-get install -y libgit2-dev pkg-config
|
||||||
|
|
||||||
- name: Create Release
|
- name: Run clippy
|
||||||
uses: https://gitea.com/actions/release-action@main
|
uses: actions-rs/cargo@v1
|
||||||
with:
|
with:
|
||||||
files: |
|
command: clippy
|
||||||
target/release/gitpulse
|
args: --all-features -- -D warnings
|
||||||
name: ${{ github.ref_name }}
|
|
||||||
body: "Release ${{ github.ref_name }}"
|
format:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: Install Rust
|
||||||
|
uses: actions-rs/toolchain@v1
|
||||||
|
with:
|
||||||
|
toolchain: stable
|
||||||
|
profile: minimal
|
||||||
|
override: true
|
||||||
|
|
||||||
|
- name: Check formatting
|
||||||
|
run: cargo fmt --all -- --check
|
||||||
|
|||||||
Reference in New Issue
Block a user