Skip to content

Commit

Permalink
ci: add rust.yml workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
wqld authored Feb 3, 2024
1 parent 92bee18 commit 5a6ef93
Showing 1 changed file with 49 additions and 0 deletions.
49 changes: 49 additions & 0 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
name: Rust

on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]

env:
CARGO_TERM_COLOR: always

jobs:
changes:
runs-on: ubuntu-latest
outputs:
any_changed: ${{ steps.changed-files.outputs.any_changed }}

steps:
- uses: actions/checkout@v3
- name: Get changed files
id: changed-files
uses: tj-actions/changed-files@v42
with:
files_ignore: |
**.md
**.json
LICENSE
- name: List all changed files
env:
ALL_CHANGED_FILES: ${{ steps.changed-files.outputs.all_changed_files }}
run: |
for file in ${ALL_CHANGED_FILES}; do
echo "$file was changed"
done
check:
runs-on: ubuntu-latest
needs: [changes]
if: needs.changes.outputs.any_changed == 'true'

steps:
- uses: actions/checkout@v3
- name: Setup Rust toolchain and cache
uses: actions-rust-lang/setup-rust-toolchain@v1
with:
components: rustfmt, clippy
- run: cargo fmt --all -- --check
- run: cargo clippy --all --all-targets --all-features -- -D warnings
- run: cargo test --all --lib --bins --tests --examples --all-features

0 comments on commit 5a6ef93

Please sign in to comment.