Skip to content

Commit

Permalink
Add Rust CI
Browse files Browse the repository at this point in the history
  • Loading branch information
az-starkware committed Feb 19, 2024
0 parents commit 8df9200
Show file tree
Hide file tree
Showing 4 changed files with 99 additions and 0 deletions.
85 changes: 85 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
name: CI

on:
push:
branches:
- main
- main-v[0-9].**
tags:
- v[0-9].**

pull_request:
types:
- opened
- reopened
- synchronize
- auto_merge_enabled

merge_group:
types:
- checks_requested

jobs:
format:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: dtolnay/rust-toolchain@master
with:
components: rustfmt
toolchain: nightly-2024-01-04
- uses: Swatinem/rust-cache@v2
- run: scripts/rust_fmt.sh --check

clippy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: dtolnay/rust-toolchain@master
with:
components: clippy
toolchain: nightly-2024-01-04
- uses: Swatinem/rust-cache@v2
- run: scripts/clippy.sh

run-tests:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: dtolnay/rust-toolchain@master
with:
profile: minimal
toolchain: nightly-2024-01-04
- uses: Swatinem/rust-cache@v2
- run: cargo +nightly-2024-01-04 test --release

udeps:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: dtolnay/rust-toolchain@master
name: "Rust Toolchain Setup"
with:
toolchain: nightly-2024-01-04
- uses: Swatinem/rust-cache@v2
id: "cache-cargo"
- if: ${{ steps.cache-cargo.outputs.cache-hit != 'true' }}
name: "Download and run cargo-udeps"
run: |
wget -O - -c https://github.com/est31/cargo-udeps/releases/download/v0.1.35/cargo-udeps-v0.1.35-x86_64-unknown-linux-gnu.tar.gz | tar -xz
cargo-udeps-*/cargo-udeps udeps
env:
RUSTUP_TOOLCHAIN: nightly-2024-01-

all-tests:
runs-on: ubuntu-latest
needs:
- clippy
- format
- run-tests
- udeps
steps:
- name: Decide whether all the needed jobs succeeded or failed
uses: re-actors/[email protected]
with:
jobs: ${{ toJSON(needs) }}
7 changes: 7 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
*.egg-info
/data
/logs
build
dist
target
*/.vscode/*
4 changes: 4 additions & 0 deletions scripts/clippy.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/bash

cargo +nightly-2024-01-04 clippy "$@" --all-targets --all-features -- -D warnings -D future-incompatible \
-D nonstandard-style -D rust-2018-idioms -D unused
3 changes: 3 additions & 0 deletions scripts/rust_fmt.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/bin/bash

cargo +nightly-2024-01-04 fmt --all -- "$@"

0 comments on commit 8df9200

Please sign in to comment.