This repository has been archived by the owner on Jan 3, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
114 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,114 @@ | ||
# Based on https://github.com/bevyengine/bevy_github_ci_template/blob/68e3d4d606b0faa6c462fdfb2f570c9a139efc8d/.github/workflows/ci.yaml | ||
|
||
name: CI | ||
|
||
on: | ||
pull_request: | ||
branches: [main] | ||
|
||
env: | ||
CARGO_TERM_COLOR: always | ||
|
||
jobs: | ||
# Check which patterns changed | ||
changed_files: | ||
name: Test Suite | ||
runs-on: ubuntu-latest | ||
timeout-minutes: 30 | ||
outputs: | ||
all_changed_files: ${{ steps.changed-files.outputs.all_changed_files }} | ||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
- name: Get changed files | ||
id: changed-files | ||
uses: tj-actions/changed-files@v40 | ||
with: | ||
files: patterns/**.rs | ||
- name: Filter pattern names | ||
id: changed-patterns | ||
env: | ||
ALL_CHANGED_FILES: ${{ steps.changed-files.outputs.all_changed_files }} | ||
run: | | ||
PATTERNS=$( | ||
for file in "$ALL_CHANGED_FILES"; do | ||
echo "$file" | awk -F / '{print $2}' | ||
done | ||
) | ||
echo "all_changed_files=$PATTERNS" | sort -u >> "$GITHUB_OUTPUT" | ||
- name: Filter pattern names | ||
env: | ||
ALL_CHANGED_FILES: ${{ steps.changed-patterns.outputs.all_changed_files }} | ||
run: echo "$ALL_CHANGED_FILES" | ||
|
||
|
||
# Run cargo clippy -- -D warnings | ||
clippy_check: | ||
name: Clippy | ||
if: needs.changed_files.outputs.all_changed_files != '' | ||
runs-on: ubuntu-latest | ||
timeout-minutes: 30 | ||
steps: | ||
- name: Checkout sources | ||
uses: actions/checkout@v4 | ||
- name: Cache | ||
uses: actions/cache@v3 | ||
with: | ||
path: | | ||
~/.cargo/bin/ | ||
~/.cargo/registry/index/ | ||
~/.cargo/registry/cache/ | ||
~/.cargo/git/db/ | ||
target/ | ||
key: ${{ runner.os }}-cargo-clippy-${{ hashFiles('**/Cargo.toml') }} | ||
- name: Install stable toolchain | ||
uses: dtolnay/rust-toolchain@stable | ||
with: | ||
components: clippy | ||
- name: Install Dependencies | ||
run: sudo apt-get update; sudo apt-get install --no-install-recommends libasound2-dev libudev-dev | ||
- name: Run clippy | ||
run: cargo clippy -- -D warnings | ||
|
||
# Run cargo fmt --all -- --check | ||
format: | ||
name: Format | ||
if: needs.changed_files.outputs.all_changed_files != '' | ||
runs-on: ubuntu-latest | ||
timeout-minutes: 30 | ||
steps: | ||
- name: Checkout sources | ||
uses: actions/checkout@v4 | ||
- name: Install stable toolchain | ||
uses: dtolnay/rust-toolchain@stable | ||
with: | ||
components: rustfmt | ||
- name: Run cargo fmt | ||
run: cargo fmt --all -- --check | ||
|
||
# Run cargo test | ||
test: | ||
name: Test Suite | ||
if: needs.changed_files.outputs.all_changed_files != '' | ||
runs-on: ubuntu-latest | ||
timeout-minutes: 30 | ||
steps: | ||
- name: Checkout sources | ||
uses: actions/checkout@v4 | ||
- name: Cache | ||
uses: actions/cache@v3 | ||
with: | ||
path: | | ||
~/.cargo/bin/ | ||
~/.cargo/registry/index/ | ||
~/.cargo/registry/cache/ | ||
~/.cargo/git/db/ | ||
target/ | ||
key: ${{ runner.os }}-cargo-test-${{ hashFiles('**/Cargo.toml') }} | ||
- name: Install stable toolchain | ||
uses: dtolnay/rust-toolchain@stable | ||
- name: Install Dependencies | ||
run: sudo apt-get update; sudo apt-get install --no-install-recommends libasound2-dev libudev-dev | ||
- name: Run cargo test | ||
run: cargo test |