|
| 1 | +name: Rust CI |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: |
| 6 | + - main |
| 7 | + paths: |
| 8 | + - "**" |
| 9 | + pull_request: |
| 10 | + types: [opened, synchronize, reopened, ready_for_review] |
| 11 | + branches: |
| 12 | + - main |
| 13 | + paths: |
| 14 | + - "**" |
| 15 | + |
| 16 | +concurrency: |
| 17 | + group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} |
| 18 | + cancel-in-progress: true |
| 19 | + |
| 20 | +jobs: |
| 21 | + check: |
| 22 | + if: github.event.pull_request.draft == false |
| 23 | + name: Check |
| 24 | + runs-on: ubuntu-latest |
| 25 | + steps: |
| 26 | + - uses: actions/checkout@v4 |
| 27 | + - uses: awalsh128/cache-apt-pkgs-action@latest |
| 28 | + with: |
| 29 | + packages: libwebkit2gtk-4.1-dev libgtk-3-dev libayatana-appindicator3-dev libxdo-dev |
| 30 | + version: 1.0 |
| 31 | + - uses: dtolnay/rust-toolchain@stable |
| 32 | + - uses: Swatinem/rust-cache@v2 |
| 33 | + with: |
| 34 | + cache-all-crates: "true" |
| 35 | + cache-on-failure: "false" |
| 36 | + - name: Check |
| 37 | + run: cargo check --workspace --all-features |
| 38 | + |
| 39 | + test: |
| 40 | + if: github.event.pull_request.draft == false |
| 41 | + name: Test Suite |
| 42 | + runs-on: ubuntu-24.04 |
| 43 | + steps: |
| 44 | + - uses: actions/checkout@v4 |
| 45 | + - name: Free Disk Space |
| 46 | + uses: ./.github/actions/free-disk-space |
| 47 | + - uses: awalsh128/cache-apt-pkgs-action@latest |
| 48 | + with: |
| 49 | + packages: libwebkit2gtk-4.1-dev libgtk-3-dev libayatana-appindicator3-dev libxdo-dev |
| 50 | + version: 1.0 |
| 51 | + - uses: dtolnay/rust-toolchain@stable |
| 52 | + with: |
| 53 | + components: rustfmt, clippy |
| 54 | + - uses: Swatinem/rust-cache@v2 |
| 55 | + with: |
| 56 | + cache-all-crates: "true" |
| 57 | + - uses: browser-actions/setup-firefox@latest |
| 58 | + - name: Test |
| 59 | + run: cargo test --workspace |
| 60 | + |
| 61 | + fmt: |
| 62 | + if: github.event.pull_request.draft == false |
| 63 | + name: Rustfmt |
| 64 | + runs-on: ubuntu-24.04 |
| 65 | + steps: |
| 66 | + - uses: actions/checkout@v4 |
| 67 | + - uses: dtolnay/rust-toolchain@stable |
| 68 | + with: |
| 69 | + components: rustfmt |
| 70 | + - uses: Swatinem/rust-cache@v2 |
| 71 | + with: |
| 72 | + cache-all-crates: "true" |
| 73 | + - name: Format |
| 74 | + run: cargo fmt --all -- --check |
| 75 | + |
| 76 | + docs: |
| 77 | + if: github.event.pull_request.draft == false |
| 78 | + name: Docs |
| 79 | + runs-on: ubuntu-24.04 |
| 80 | + steps: |
| 81 | + - uses: actions/checkout@v4 |
| 82 | + - uses: awalsh128/cache-apt-pkgs-action@latest |
| 83 | + with: |
| 84 | + packages: libwebkit2gtk-4.1-dev libgtk-3-dev libayatana-appindicator3-dev libxdo-dev |
| 85 | + version: 1.0 |
| 86 | + - uses: dtolnay/rust-toolchain@nightly |
| 87 | + - uses: Swatinem/rust-cache@v2 |
| 88 | + with: |
| 89 | + cache-all-crates: "true" |
| 90 | + - name: Docs |
| 91 | + run: cargo doc --workspace --no-deps --all-features --document-private-items |
| 92 | + env: |
| 93 | + RUSTDOCFLAGS: -Dwarnings --document-private-items |
| 94 | + |
| 95 | + clippy: |
| 96 | + if: github.event.pull_request.draft == false |
| 97 | + name: Clippy |
| 98 | + runs-on: ubuntu-24.04 |
| 99 | + steps: |
| 100 | + - uses: actions/checkout@v4 |
| 101 | + - uses: awalsh128/cache-apt-pkgs-action@latest |
| 102 | + with: |
| 103 | + packages: libwebkit2gtk-4.1-dev libgtk-3-dev libayatana-appindicator3-dev libxdo-dev |
| 104 | + version: 1.0 |
| 105 | + - uses: dtolnay/rust-toolchain@stable |
| 106 | + with: |
| 107 | + components: rustfmt, clippy |
| 108 | + - uses: Swatinem/rust-cache@v2 |
| 109 | + with: |
| 110 | + cache-all-crates: "true" |
| 111 | + - name: Clippy |
| 112 | + run: cargo clippy --workspace --examples --tests --all-features --all-targets -- -D warnings |
| 113 | + |
| 114 | + web-demo: |
| 115 | + if: github.event.pull_request.draft == false |
| 116 | + name: Web Demo |
| 117 | + runs-on: ubuntu-latest |
| 118 | + env: |
| 119 | + CARGO_INCREMENTAL: 1 |
| 120 | + steps: |
| 121 | + - uses: actions/checkout@v4 |
| 122 | + - uses: awalsh128/cache-apt-pkgs-action@latest |
| 123 | + with: |
| 124 | + packages: libwebkit2gtk-4.1-dev libgtk-3-dev libayatana-appindicator3-dev libxdo-dev |
| 125 | + version: 1.0 |
| 126 | + - uses: dtolnay/rust-toolchain@stable |
| 127 | + with: |
| 128 | + targets: x86_64-unknown-linux-gnu,wasm32-unknown-unknown |
| 129 | + - uses: Swatinem/rust-cache@v2 |
| 130 | + with: |
| 131 | + cache-all-crates: "true" |
| 132 | + cache-on-failure: "false" |
| 133 | + cache-directories: "target/dx" |
| 134 | + - uses: cargo-bins/cargo-binstall@main |
| 135 | + - name: Install Dioxus CLI |
| 136 | + run: cargo binstall dioxus-cli -y --force --version 0.7.7 |
| 137 | + - name: Build web demo |
| 138 | + run: cd demo && dx build --web --release --no-default-features --features web --debug-symbols false --base-path "${{ github.event.repository.name }}" |
0 commit comments