2022-07-11 00:31:05 +02:00
|
|
|
name: CI
|
2022-07-11 16:14:17 +02:00
|
|
|
|
2022-07-10 17:19:26 +02:00
|
|
|
on:
|
2022-07-10 19:23:54 +02:00
|
|
|
push:
|
2022-07-11 16:14:17 +02:00
|
|
|
branches: [main, staging, trying]
|
|
|
|
pull_request:
|
|
|
|
branches: [main]
|
|
|
|
|
|
|
|
env:
|
|
|
|
CARGO_TERM_COLOR: always
|
|
|
|
|
2022-07-10 17:19:26 +02:00
|
|
|
jobs:
|
2022-07-11 02:07:48 +02:00
|
|
|
test:
|
2022-07-11 17:07:40 +02:00
|
|
|
runs-on: ubuntu-22.04
|
2022-07-11 16:14:17 +02:00
|
|
|
|
2022-07-11 02:07:48 +02:00
|
|
|
services:
|
|
|
|
# Needed for tests to pass
|
|
|
|
qbittorrent:
|
|
|
|
image: linuxserver/qbittorrent:4.4.3
|
|
|
|
ports:
|
|
|
|
- 8080:8080
|
2022-07-11 16:14:17 +02:00
|
|
|
|
2022-07-10 17:19:26 +02:00
|
|
|
steps:
|
2022-07-11 00:52:09 +02:00
|
|
|
- uses: actions/checkout@v3
|
2022-07-11 02:07:48 +02:00
|
|
|
|
|
|
|
- uses: actions/cache@v2
|
|
|
|
with:
|
|
|
|
path: ~/.cargo/registry
|
2022-08-13 20:15:51 +02:00
|
|
|
key: ${{ runner.os }}-cargo-test-${{ hashFiles('Cargo.toml') }}
|
2022-07-11 02:07:48 +02:00
|
|
|
|
2022-07-10 17:19:26 +02:00
|
|
|
- name: Install latest stable
|
|
|
|
uses: actions-rs/toolchain@v1
|
|
|
|
with:
|
|
|
|
toolchain: stable
|
2022-07-11 02:07:48 +02:00
|
|
|
profile: minimal
|
|
|
|
override: true
|
|
|
|
|
2022-07-11 16:14:17 +02:00
|
|
|
- name: Build
|
|
|
|
uses: actions-rs/cargo@v1
|
|
|
|
with:
|
|
|
|
command: build
|
|
|
|
args: --verbose
|
|
|
|
|
2022-07-11 02:07:48 +02:00
|
|
|
- name: Run tests
|
2022-07-10 17:19:26 +02:00
|
|
|
uses: actions-rs/cargo@v1
|
|
|
|
with:
|
2022-07-11 02:07:48 +02:00
|
|
|
command: test
|
2022-07-11 16:14:17 +02:00
|
|
|
args: --workspace --verbose
|
2022-07-10 17:27:31 +02:00
|
|
|
|
2022-07-11 02:07:48 +02:00
|
|
|
fmt:
|
2022-07-11 17:07:40 +02:00
|
|
|
runs-on: ubuntu-22.04
|
2022-07-11 16:14:17 +02:00
|
|
|
|
2022-07-11 02:07:48 +02:00
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v3
|
|
|
|
|
|
|
|
- name: Install latest stable
|
|
|
|
uses: actions-rs/toolchain@v1
|
|
|
|
with:
|
|
|
|
toolchain: stable
|
|
|
|
components: rustfmt
|
|
|
|
override: true
|
|
|
|
|
|
|
|
- name: Run cargo fmt
|
2022-07-10 17:27:31 +02:00
|
|
|
uses: actions-rs/cargo@v1
|
|
|
|
with:
|
2022-07-11 02:07:48 +02:00
|
|
|
command: fmt
|
|
|
|
args: --all -- --check
|
|
|
|
|
|
|
|
clippy:
|
2022-07-11 17:07:40 +02:00
|
|
|
runs-on: ubuntu-22.04
|
2022-07-11 16:14:17 +02:00
|
|
|
|
2022-07-10 17:35:18 +02:00
|
|
|
steps:
|
2022-07-11 00:52:09 +02:00
|
|
|
- uses: actions/checkout@v3
|
2022-07-11 02:07:48 +02:00
|
|
|
|
2022-07-11 02:16:38 +02:00
|
|
|
- uses: actions/cache@v2
|
|
|
|
with:
|
|
|
|
path: ~/.cargo/registry
|
2022-08-13 20:15:51 +02:00
|
|
|
key: ${{ runner.os }}-cargo-clippy-${{ hashFiles('Cargo.toml') }}
|
2022-07-11 02:16:38 +02:00
|
|
|
|
2022-07-10 17:35:18 +02:00
|
|
|
- name: Install latest stable
|
|
|
|
uses: actions-rs/toolchain@v1
|
|
|
|
with:
|
|
|
|
toolchain: stable
|
2022-07-11 02:07:48 +02:00
|
|
|
components: clippy
|
|
|
|
override: true
|
2022-07-10 17:27:31 +02:00
|
|
|
|
2022-07-11 02:07:48 +02:00
|
|
|
- name: Run cargo clippy
|
2022-07-10 17:27:31 +02:00
|
|
|
uses: actions-rs/cargo@v1
|
|
|
|
with:
|
2022-07-11 02:07:48 +02:00
|
|
|
command: clippy
|
|
|
|
args: -- -D warnings
|