-
Notifications
You must be signed in to change notification settings - Fork 4
84 lines (74 loc) · 3.54 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
name: CI
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
schedule:
# Runs at 15:00 UTC on Fri
- cron: "0 15 * * 5"
env:
CARGO_TERM_COLOR: always
# Deny warns here as a catch-all and because some commands (e.g. cargo build) don't accept `--deny warnings`
# but also deny them on all individual cargo invocations where applicable because:
# 1) Some commands might not support rustflags (e.g. clippy didn't at first, cargo doc uses a different var, ...)
# 2) People (or me) might copy paste the commands into CI where this flag is missing without noticing.
RUSTFLAGS: --deny warnings
jobs:
test:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
steps:
- name: Install linux deps
if: ${{ matrix.os == 'ubuntu-latest' }}
run: |
sudo apt-get update
sudo apt-get install --no-install-recommends -y pkg-config libx11-dev libxi-dev libgl1-mesa-dev libasound2-dev
- run: rustup target add wasm32-unknown-unknown
- uses: actions/checkout@v3
- uses: Swatinem/rust-cache@b8a6852b4f997182bdea832df3f9e153038b5191
- name: Print versions
run: rustc --version && cargo --version
- name: Build native
run: cargo build --verbose
- name: Run tests
run: cargo test --verbose --all-features
# Test WASM only on ubuntu - the result should be the same on any OS and ubuntu is the fastest.
- name: Build web
if: ${{ matrix.os == 'ubuntu-latest' }}
run: cargo build --verbose --target wasm32-unknown-unknown
format:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- run: cargo fmt --version
- run: cargo fmt -- --check
clippy:
runs-on: ubuntu-latest
steps:
- run: |
sudo apt-get update
sudo apt-get install --no-install-recommends -y pkg-config libx11-dev libxi-dev libgl1-mesa-dev libasound2-dev
- uses: actions/checkout@v3
- uses: Swatinem/rust-cache@b8a6852b4f997182bdea832df3f9e153038b5191
- run: cargo clippy --version
# Use --all-targets to also check tests.
# Note that --all-features doesn't check all code when something is *disabled* by a feature.
- run: cargo clippy --all-targets --all-features -- --deny warnings
# No fixmes allowed - they're to be fixed before committing
# or at least before merging to master so they can be used
# during development for things that must not be forgotten
# and grep's output is not littered with other people's fixmes.
#
# Grep returns success when found and failure when not found, `!` inverts success/failure.
# The `[F]` is the usual trick to avoid matching this line itself
# without excluding this whole file so it's still checked.
- run: '! ( grep --recursive --exclude-dir=target [F]IXME . && echo "The lines above this message must be fixed (or marked as todo/later in uppercase, not fixme)" )'
# Similar as above - cvars like d_dbg* should not be committed to master
# so they're available to be used by other devs.
- run: '! ( grep --recursive --exclude-dir=target --exclude=debug.rs cvars\.d_dbg . && echo "The d_dbg* cvars should not be used in committed code. Maybe you forgot to remove debug code?" )'
# All paths should be lowercase of we might have issues
# when switching between case-sensitive and case-insensitive filesystems.
- run: '! ( find data | grep [A-Z] && echo "Asset names/paths must be all lowercase" )'