-
Notifications
You must be signed in to change notification settings - Fork 11
114 lines (97 loc) · 2.96 KB
/
ci.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
name: CI
on:
pull_request:
env:
RUST_BACKTRACE: 1
jobs:
ci-pass:
name: CI is green
runs-on: ubuntu-latest
needs:
- style
- test
steps:
- run: exit 0
style:
name: Check Style
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Install bevy deps
run: |
set -euxo pipefail
sudo apt update && sudo apt upgrade && sudo apt install -y lld g++ pkg-config libx11-dev libasound2-dev libudev-dev
- name: Cache deps
uses: actions/cache@v3
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
- name: Install rust
uses: dtolnay/rust-toolchain@nightly
with:
components: rustfmt
- name: Check code formatting/style # Do this first to fail fast. Doesn't require compiling the project
run: cargo fmt --all -- --check
- name: Check that the game compiles and is minimally sensible rust (no warnings)
run: cargo rustc --all-features -- -D warnings
- name: Check that the game compiles and is minimally sensible rust (no warnings) with just the arcade feature
run: cargo rustc --features arcade -- -D warnings
test:
name: ${{ matrix.name }}
needs: [style]
runs-on: ${{ matrix.os || 'ubuntu-latest' }}
strategy:
matrix:
name:
- linux / nightly
- macOS / nightly
- windows / nightly
include:
- name: linux / nightly
rust: nightly
os: ubuntu-latest
- name: macOS / nightly
os: macOS-latest
rust: nightly
- name: windows / nightly
os: windows-latest
rust: nightly
target: x86_64-pc-windows-msvc
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Install bevy deps
if: matrix.os == 'ubuntu-latest'
run: |
set -euxo pipefail
sudo apt update && sudo apt upgrade && sudo apt install -y lld g++ pkg-config libx11-dev libasound2-dev libudev-dev
shell: bash
- name: Cache deps
uses: actions/cache@v3
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
- name: Install rust
uses: dtolnay/rust-toolchain@nightly
with:
toolchain: ${{ matrix.rust || 'stable' }}
targets: ${{ matrix.target }}
- name: Create Cargo.lock
run: cargo update
- name: Run tests
run: |
set -euxo pipefail
cargo check --tests
cargo test --all-features --workspace
shell: bash