|
| 1 | +# Copied from https://github.com/rerun-io/rerun_template |
| 2 | +on: |
| 3 | + push: |
| 4 | + branches: |
| 5 | + - "main" |
| 6 | + pull_request: |
| 7 | + types: [ opened, synchronize ] |
| 8 | + |
| 9 | +name: Rust |
| 10 | + |
| 11 | +env: |
| 12 | + RUSTFLAGS: -D warnings |
| 13 | + RUSTDOCFLAGS: -D warnings |
| 14 | + |
| 15 | +jobs: |
| 16 | + rust-check: |
| 17 | + name: Rust |
| 18 | + runs-on: ubuntu-latest |
| 19 | + steps: |
| 20 | + - uses: actions/checkout@v4 |
| 21 | + |
| 22 | + - uses: actions-rs/toolchain@v1 |
| 23 | + with: |
| 24 | + profile: default |
| 25 | + toolchain: 1.76.0 |
| 26 | + override: true |
| 27 | + |
| 28 | + - name: Install packages (Linux) |
| 29 | + if: runner.os == 'Linux' && false # TODO: enable if eframe is part of the project, otherwise remove |
| 30 | + |
| 31 | + with: |
| 32 | + # some deps used by eframe, if that is part of the project |
| 33 | + packages: libxcb-render0-dev libxcb-shape0-dev libxcb-xfixes0-dev libxkbcommon-dev libssl-dev # libgtk-3-dev is used by rfd |
| 34 | + version: 1.0 |
| 35 | + execute_install_scripts: true |
| 36 | + |
| 37 | + - name: Set up cargo cache |
| 38 | + uses: Swatinem/rust-cache@v2 |
| 39 | + |
| 40 | + - name: Rustfmt |
| 41 | + uses: actions-rs/cargo@v1 |
| 42 | + with: |
| 43 | + command: fmt |
| 44 | + args: --all -- --check |
| 45 | + |
| 46 | + - name: check --all-features |
| 47 | + uses: actions-rs/cargo@v1 |
| 48 | + with: |
| 49 | + command: check |
| 50 | + args: --all-features --all-targets |
| 51 | + |
| 52 | + - name: check default features |
| 53 | + uses: actions-rs/cargo@v1 |
| 54 | + with: |
| 55 | + command: check |
| 56 | + args: --all-targets |
| 57 | + |
| 58 | + - name: check --no-default-features |
| 59 | + uses: actions-rs/cargo@v1 |
| 60 | + with: |
| 61 | + command: check |
| 62 | + args: --no-default-features --lib --all-targets |
| 63 | + |
| 64 | + - name: Test doc-tests |
| 65 | + uses: actions-rs/cargo@v1 |
| 66 | + with: |
| 67 | + command: test |
| 68 | + args: --doc --all-features |
| 69 | + |
| 70 | + - name: cargo doc --lib |
| 71 | + uses: actions-rs/cargo@v1 |
| 72 | + with: |
| 73 | + command: doc |
| 74 | + args: --lib --no-deps --all-features |
| 75 | + |
| 76 | + - name: cargo doc --document-private-items |
| 77 | + uses: actions-rs/cargo@v1 |
| 78 | + with: |
| 79 | + command: doc |
| 80 | + args: --document-private-items --no-deps --all-features |
| 81 | + |
| 82 | + - name: Build tests |
| 83 | + uses: actions-rs/cargo@v1 |
| 84 | + with: |
| 85 | + command: test |
| 86 | + args: --all-features --no-run |
| 87 | + |
| 88 | + - name: Run test |
| 89 | + uses: actions-rs/cargo@v1 |
| 90 | + with: |
| 91 | + command: test |
| 92 | + args: --all-features |
| 93 | + |
| 94 | + - name: Clippy |
| 95 | + uses: actions-rs/cargo@v1 |
| 96 | + with: |
| 97 | + command: clippy |
| 98 | + args: --all-targets --all-features -- -D warnings |
| 99 | + |
| 100 | + # --------------------------------------------------------------------------- |
| 101 | + |
| 102 | + check_wasm: |
| 103 | + name: Check wasm32 |
| 104 | + runs-on: ubuntu-latest |
| 105 | + steps: |
| 106 | + - uses: actions/checkout@v4 |
| 107 | + - uses: actions-rs/toolchain@v1 |
| 108 | + with: |
| 109 | + profile: minimal |
| 110 | + toolchain: 1.76.0 |
| 111 | + target: wasm32-unknown-unknown |
| 112 | + override: true |
| 113 | + components: clippy |
| 114 | + |
| 115 | + - name: Set up cargo cache |
| 116 | + uses: Swatinem/rust-cache@v2 |
| 117 | + |
| 118 | + - name: Check wasm32 |
| 119 | + uses: actions-rs/cargo@v1 |
| 120 | + with: |
| 121 | + command: check |
| 122 | + args: --target wasm32-unknown-unknown --lib |
| 123 | + |
| 124 | + - name: Clippy wasm32 |
| 125 | + env: |
| 126 | + CLIPPY_CONF_DIR: "scripts/clippy_wasm" # Use scripts/clippy_wasm/clippy.toml |
| 127 | + run: cargo clippy --target wasm32-unknown-unknown --lib -- -D warnings |
| 128 | + |
| 129 | + # --------------------------------------------------------------------------- |
| 130 | + |
| 131 | + cargo-deny: |
| 132 | + name: Check Rust dependencies (cargo-deny) |
| 133 | + runs-on: ubuntu-latest |
| 134 | + steps: |
| 135 | + - uses: actions/checkout@v3 |
| 136 | + - uses: EmbarkStudios/cargo-deny-action@v1 |
| 137 | + with: |
| 138 | + rust-version: "1.76.0" |
| 139 | + log-level: warn |
| 140 | + command: check |
0 commit comments