teloxide/.github/workflows/ci.yml

209 lines
4.7 KiB
YAML
Raw Normal View History

on:
push:
branches: [ master ]
pull_request:
2020-08-17 17:30:19 +02:00
branches: [ master, dev ]
2019-11-27 15:30:33 +01:00
name: Continuous integration
env:
RUSTFLAGS: "--cfg CI_REDIS -Dwarnings"
RUSTDOCFLAGS: -Dwarnings
RUST_BACKTRACE: short
CARGO_INCREMENTAL: 0
CARGO_NET_RETRY: 10
RUSTUP_MAX_RETRIES: 10
rust_nightly: nightly-2022-09-01
# When updating this, also update:
# - README.md
# - src/lib.rs
# - down below in a matrix
rust_msrv: 1.64.0
2019-11-27 15:30:33 +01:00
jobs:
# Depends on all action that are required for a "successful" CI run.
ci-pass:
name: CI succeeded
2019-11-27 15:30:33 +01:00
runs-on: ubuntu-latest
needs:
- fmt
- test
- check-examples
- clippy
- doc
steps:
- run: exit 0
fmt:
name: fmt
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Install Rust ${{ env.rust_nightly }}
uses: actions-rs/toolchain@v1
2019-11-27 15:30:33 +01:00
with:
2020-07-03 14:50:28 +02:00
profile: minimal
toolchain: ${{ env.rust_nightly }}
2020-07-03 14:50:28 +02:00
override: true
components: rustfmt
- name: Cache Dependencies
uses: Swatinem/rust-cache@v1
- name: Check formatting
uses: actions-rs/cargo@v1
with:
command: fmt
args: --all -- --check
test:
name: Test
2020-07-02 14:48:37 +02:00
runs-on: ubuntu-latest
strategy:
matrix:
rust:
- stable
- beta
2022-03-25 10:19:57 +01:00
- nightly
2022-04-20 21:33:44 +02:00
- msrv
include:
- rust: stable
2022-03-25 10:19:57 +01:00
toolchain: stable
features: "--features full"
- rust: beta
2022-03-25 10:19:57 +01:00
toolchain: beta
features: "--features full"
2022-03-25 10:19:57 +01:00
- rust: nightly
toolchain: nightly-2022-09-01
features: "--all-features"
2022-04-20 21:33:44 +02:00
- rust: msrv
toolchain: 1.64.0
2022-04-21 10:52:01 +02:00
features: "--features full"
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Install Rust ${{ matrix.toolchain }}
uses: actions-rs/toolchain@v1
2019-11-27 15:30:33 +01:00
with:
2020-07-03 14:50:28 +02:00
profile: minimal
2022-03-25 10:19:57 +01:00
toolchain: ${{ matrix.toolchain }}
2020-07-03 14:50:28 +02:00
override: true
- name: Cache Dependencies
uses: Swatinem/rust-cache@v1
# NB. Don't test (build) examples so we can use non-msrv features in them (--tests/--doc)
- name: Compile
uses: actions-rs/cargo@v1
with:
command: test
args: --tests --no-run --verbose ${{ matrix.features }}
- name: Setup redis
run: |
sudo apt install redis-server
redis-server --port 7777 > /dev/null &
redis-server --port 7778 > /dev/null &
redis-server --port 7779 > /dev/null &
- name: Test unit & integration tests
uses: actions-rs/cargo@v1
with:
command: test
args: --tests --verbose ${{ matrix.features }}
- name: Test documentation tests
if: ${{ matrix.rust != 'msrv' }}
uses: actions-rs/cargo@v1
with:
command: test
args: --doc --verbose ${{ matrix.features }}
check-examples:
2020-07-02 14:48:37 +02:00
runs-on: ubuntu-latest
2020-07-02 14:52:42 +02:00
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Install Rust stable
uses: actions-rs/toolchain@v1
2020-03-27 13:54:06 +01:00
with:
2020-07-03 14:50:28 +02:00
profile: minimal
toolchain: stable
override: true
- name: Cache Dependencies
uses: Swatinem/rust-cache@v1
- name: Check examples
uses: actions-rs/cargo@v1
with:
command: check
args: --examples --features full
2022-11-25 11:38:34 +01:00
# TODO: prolly move it to a separate step?
- name: Check with no default features
uses: actions-rs/cargo@v1
with:
command: check
args: --no-default-features
clippy:
name: Run linter
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Install Rust ${{ env.rust_nightly }}
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: ${{ env.rust_nightly }}
override: true
components: clippy
- name: Cache Dependencies
uses: Swatinem/rust-cache@v1
- name: clippy
uses: actions-rs/cargo@v1
with:
command: clippy
args: --all-targets --all-features
doc:
name: check docs
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Install Rust ${{ env.rust_nightly }}
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: ${{ env.rust_nightly }}
override: true
- name: Cache Dependencies
uses: Swatinem/rust-cache@v1
- name: rustdoc
uses: actions-rs/cargo@v1
with:
command: docs # from .cargo/config.toml