| 1 | on: |
| 2 | push: |
| 3 | branches: [master] |
| 4 | pull_request: |
| 5 | paths: |
| 6 | - "src/**" |
| 7 | - "build.rs" |
| 8 | - "Cargo.toml" |
| 9 | - "Cargo.lock" |
| 10 | - ".forgejo/workflows/rust.yml" |
| 11 | |
| 12 | name: rust |
| 13 | jobs: |
| 14 | fmt: |
| 15 | runs-on: docker |
| 16 | container: ubuntu:latest |
| 17 | name: format |
| 18 | steps: |
| 19 | - name: Init |
| 20 | run: | |
| 21 | apt-get -qq update |
| 22 | apt-get -qqy install curl nodejs build-essential |
| 23 | curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | RUSTUP_COMPONENTS=rustfmt,cargo sh -s -- -y -q --profile default |
| 24 | export PATH=~/.cargo/bin:$PATH |
| 25 | - uses: actions/checkout@v6 |
| 26 | - name: Run rustfmt |
| 27 | run: | |
| 28 | . ~/.cargo/env |
| 29 | cargo fmt --check |
| 30 | test: |
| 31 | runs-on: docker |
| 32 | container: ubuntu:latest |
| 33 | name: test |
| 34 | steps: |
| 35 | - name: Init |
| 36 | run: | |
| 37 | apt-get -qq update |
| 38 | apt-get -qqy install curl nodejs build-essential |
| 39 | curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | RUSTUP_COMPONENTS=rustc,cargo,clippy sh -s -- -y -q --profile default |
| 40 | - uses: actions/checkout@v6 |
| 41 | - name: Run tests |
| 42 | run: | |
| 43 | . ~/.cargo/env |
| 44 | cargo test |
| 45 | cargo clippy --tests -- -Dwarnings |