Skip to content

Commit 520e66d

Browse files
authored
Merge pull request #1 from Daemon-Computer/ci
ci
2 parents e43191f + 203e1b9 commit 520e66d

1 file changed

Lines changed: 91 additions & 0 deletions

File tree

.github/workflows/ci.yml

Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
name: CI
2+
on:
3+
push:
4+
branches: [ main ]
5+
pull_request:
6+
branches: [ main ]
7+
8+
concurrency:
9+
group: ${{ github.workflow }}-${{ github.ref || github.run_id }}
10+
cancel-in-progress: true
11+
12+
env:
13+
# Reduce compile time and cache size.
14+
RUSTFLAGS: -Dwarnings -Zshare-generics=y -Zthreads=0
15+
RUSTDOCFLAGS: -Dwarnings -Zshare-generics=y -Zthreads=0
16+
# Use the same Rust toolchain across jobs so they can share a cache.
17+
toolchain: nightly-2025-04-03
18+
19+
jobs:
20+
# Check formatting.
21+
format:
22+
name: Format
23+
runs-on: ubuntu-latest
24+
timeout-minutes: 10
25+
steps:
26+
- name: Checkout repository
27+
uses: actions/checkout@v4
28+
29+
- name: Install Rust toolchain
30+
uses: dtolnay/rust-toolchain@master
31+
with:
32+
toolchain: ${{ env.toolchain }}
33+
components: rustfmt
34+
35+
- name: Check formatting
36+
run: cargo fmt --all -- --check
37+
38+
# Run Clippy lints.
39+
clippy-lints:
40+
name: Clippy lints
41+
runs-on: ubuntu-latest
42+
timeout-minutes: 20
43+
steps:
44+
- name: Checkout repository
45+
uses: actions/checkout@v4
46+
47+
- name: Install Rust toolchain
48+
uses: dtolnay/rust-toolchain@master
49+
with:
50+
toolchain: ${{ env.toolchain }}
51+
components: clippy
52+
53+
- name: Restore Rust cache
54+
id: cache
55+
uses: Swatinem/rust-cache@v2
56+
with:
57+
shared-key: ci
58+
save-if: ${{ github.ref == 'refs/heads/main' }}
59+
60+
- name: Install build dependencies
61+
if: steps.cache.outputs.cache-hit != 'true'
62+
run: sudo apt-get update; sudo apt-get install --no-install-recommends libasound2-dev libudev-dev libwayland-dev
63+
64+
- name: Run Clippy lints
65+
run: cargo clippy --locked --all-targets --all-features
66+
67+
# Run Bevy lints.
68+
bevy-lints:
69+
name: Bevy lints
70+
runs-on: ubuntu-latest
71+
timeout-minutes: 20
72+
steps:
73+
- name: Checkout repository
74+
uses: actions/checkout@v4
75+
76+
- name: Install Rust toolchain (plus bevy_lint)
77+
uses: TheBevyFlock/bevy_cli/bevy_lint@lint-v0.3.0
78+
79+
- name: Restore Rust cache
80+
id: cache
81+
uses: Swatinem/rust-cache@v2
82+
with:
83+
shared-key: ci
84+
save-if: false
85+
86+
- name: Install build dependencies
87+
if: steps.cache.outputs.cache-hit != 'true'
88+
run: sudo apt-get update; sudo apt-get install --no-install-recommends libasound2-dev libudev-dev libwayland-dev
89+
90+
- name: Run Bevy lints
91+
run: bevy_lint --locked --all-targets --all-features

0 commit comments

Comments
 (0)