2020-07-02 15:01:45 +02:00
|
|
|
on:
|
|
|
|
push:
|
|
|
|
branches: [ master ]
|
|
|
|
pull_request:
|
2023-01-17 17:37:17 +01:00
|
|
|
branches: [ master ]
|
2023-02-13 08:55:16 +01:00
|
|
|
merge_group:
|
2019-11-27 15:30:33 +01:00
|
|
|
|
|
|
|
name: Continuous integration
|
|
|
|
|
2022-03-14 16:28:20 +01:00
|
|
|
env:
|
2022-07-03 12:35:56 +02:00
|
|
|
RUSTFLAGS: "--cfg CI_REDIS -Dwarnings"
|
2024-01-21 17:58:13 +01:00
|
|
|
RUSTDOCFLAGS: "--cfg docsrs -Dwarnings"
|
2022-07-03 12:35:56 +02:00
|
|
|
RUST_BACKTRACE: short
|
|
|
|
|
|
|
|
CARGO_INCREMENTAL: 0
|
|
|
|
CARGO_NET_RETRY: 10
|
|
|
|
RUSTUP_MAX_RETRIES: 10
|
|
|
|
|
|
|
|
# When updating this, also update:
|
2022-11-28 13:50:26 +01:00
|
|
|
# - crates/teloxide-core/src/codegen.rs
|
|
|
|
# - rust-toolchain.toml
|
2023-09-27 10:27:30 +02:00
|
|
|
rust_nightly: nightly-2023-09-27
|
2022-11-28 13:50:26 +01:00
|
|
|
# When updating this, also update:
|
|
|
|
# - **/README.md
|
|
|
|
# - **/src/lib.rs
|
2022-07-03 12:35:56 +02:00
|
|
|
# - down below in a matrix
|
2023-10-04 18:01:46 +02:00
|
|
|
# - `Cargo.toml`
|
|
|
|
# - **/CHANGELOG.md
|
|
|
|
rust_msrv: 1.68.0
|
2022-03-14 16:28:20 +01:00
|
|
|
|
2022-11-28 13:50:26 +01:00
|
|
|
CI: 1
|
|
|
|
|
2019-11-27 15:30:33 +01:00
|
|
|
jobs:
|
2022-07-03 12:35:56 +02:00
|
|
|
# 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
|
2023-10-05 18:14:18 +02:00
|
|
|
if: always()
|
2021-03-21 13:34:23 +01:00
|
|
|
|
2022-07-03 12:35:56 +02:00
|
|
|
needs:
|
|
|
|
- fmt
|
|
|
|
- test
|
|
|
|
- check-examples
|
|
|
|
- clippy
|
|
|
|
- doc
|
2021-03-21 13:34:23 +01:00
|
|
|
|
2022-07-03 12:35:56 +02:00
|
|
|
steps:
|
2023-10-05 18:14:18 +02:00
|
|
|
- name: Check whether the needed jobs succeeded or failed
|
|
|
|
uses: re-actors/alls-green@release/v1
|
|
|
|
with:
|
|
|
|
jobs: ${{ toJSON(needs) }}
|
2021-03-21 13:34:23 +01:00
|
|
|
|
2022-07-03 12:35:56 +02:00
|
|
|
fmt:
|
|
|
|
name: fmt
|
2021-03-21 13:34:23 +01:00
|
|
|
runs-on: ubuntu-latest
|
|
|
|
|
|
|
|
steps:
|
2022-07-03 12:35:56 +02:00
|
|
|
- name: Checkout
|
|
|
|
uses: actions/checkout@v3
|
2021-03-21 13:34:23 +01:00
|
|
|
|
2022-07-03 12:35:56 +02:00
|
|
|
- name: Install Rust ${{ env.rust_nightly }}
|
2023-05-26 08:23:52 +02:00
|
|
|
uses: dtolnay/rust-toolchain@master
|
2019-11-27 15:30:33 +01:00
|
|
|
with:
|
2022-07-03 12:35:56 +02:00
|
|
|
toolchain: ${{ env.rust_nightly }}
|
|
|
|
components: rustfmt
|
2021-03-21 13:34:23 +01:00
|
|
|
|
2022-07-03 12:35:56 +02:00
|
|
|
- name: Cache Dependencies
|
2023-05-26 08:23:52 +02:00
|
|
|
uses: Swatinem/rust-cache@v2
|
2022-07-03 12:35:56 +02:00
|
|
|
|
|
|
|
- name: Check formatting
|
2023-05-26 08:23:52 +02:00
|
|
|
run: |
|
|
|
|
cargo fmt --all -- --check
|
2020-08-12 22:53:58 +02:00
|
|
|
|
|
|
|
test:
|
2022-07-03 12:35:56 +02:00
|
|
|
name: Test
|
2020-07-02 14:48:37 +02:00
|
|
|
runs-on: ubuntu-latest
|
2020-08-12 22:53:58 +02:00
|
|
|
strategy:
|
|
|
|
matrix:
|
2023-05-26 08:23:52 +02:00
|
|
|
rust:
|
2020-08-12 22:53:58 +02:00
|
|
|
- stable
|
|
|
|
- beta
|
2022-03-25 10:19:57 +01:00
|
|
|
- nightly
|
2022-04-20 21:33:44 +02:00
|
|
|
- msrv
|
2023-05-26 08:23:52 +02:00
|
|
|
|
2020-08-12 22:53:58 +02:00
|
|
|
include:
|
|
|
|
- rust: stable
|
2022-03-25 10:19:57 +01:00
|
|
|
toolchain: stable
|
2021-03-21 13:34:23 +01:00
|
|
|
features: "--features full"
|
2020-08-12 22:53:58 +02:00
|
|
|
- rust: beta
|
2022-03-25 10:19:57 +01:00
|
|
|
toolchain: beta
|
2021-03-21 13:34:23 +01:00
|
|
|
features: "--features full"
|
2022-03-25 10:19:57 +01:00
|
|
|
- rust: nightly
|
2023-09-27 10:27:30 +02:00
|
|
|
toolchain: nightly-2023-09-27
|
2023-02-13 08:49:56 +01:00
|
|
|
features: "--features full nightly"
|
2022-04-20 21:33:44 +02:00
|
|
|
- rust: msrv
|
2023-10-04 18:01:46 +02:00
|
|
|
toolchain: 1.68.0
|
2022-04-21 10:52:01 +02:00
|
|
|
features: "--features full"
|
2020-08-12 22:53:58 +02:00
|
|
|
|
2023-05-26 08:23:52 +02:00
|
|
|
steps:
|
2022-07-03 12:35:56 +02:00
|
|
|
- name: Checkout
|
|
|
|
uses: actions/checkout@v3
|
|
|
|
|
|
|
|
- name: Install Rust ${{ matrix.toolchain }}
|
2023-05-26 08:23:52 +02:00
|
|
|
uses: dtolnay/rust-toolchain@master
|
2019-11-27 15:30:33 +01:00
|
|
|
with:
|
2022-03-25 10:19:57 +01:00
|
|
|
toolchain: ${{ matrix.toolchain }}
|
2022-07-03 12:35:56 +02:00
|
|
|
|
|
|
|
- name: Cache Dependencies
|
2023-05-26 08:23:52 +02:00
|
|
|
uses: Swatinem/rust-cache@v2
|
2022-07-03 12:35:56 +02:00
|
|
|
|
2022-07-04 17:34:11 +02:00
|
|
|
# NB. Don't test (build) examples so we can use non-msrv features in them (--tests/--doc)
|
2023-05-26 08:23:52 +02:00
|
|
|
- name: Compile
|
|
|
|
run: |
|
|
|
|
cargo +${{ matrix.toolchain }} test --tests --no-run --verbose ${{ matrix.features }}
|
2022-07-03 12:35:56 +02:00
|
|
|
|
2020-08-12 23:07:16 +02:00
|
|
|
- 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 &
|
2023-05-26 08:23:52 +02:00
|
|
|
|
|
|
|
- name: Test unit & integration tests
|
|
|
|
run: |
|
|
|
|
cargo +${{ matrix.toolchain }} test --tests --verbose ${{ matrix.features }}
|
|
|
|
|
2022-07-03 12:38:14 +02:00
|
|
|
- name: Test documentation tests
|
2022-07-19 16:12:45 +02:00
|
|
|
if: ${{ matrix.rust != 'msrv' }}
|
2023-05-26 08:23:52 +02:00
|
|
|
run: |
|
|
|
|
cargo +${{ matrix.toolchain }} test --doc --verbose ${{ matrix.features }}
|
2020-08-12 22:53:58 +02:00
|
|
|
|
2022-07-03 12:35:56 +02:00
|
|
|
check-examples:
|
2020-07-02 14:48:37 +02:00
|
|
|
runs-on: ubuntu-latest
|
2022-07-03 12:35:56 +02:00
|
|
|
|
2020-07-02 14:52:42 +02:00
|
|
|
steps:
|
2022-07-03 12:35:56 +02:00
|
|
|
- name: Checkout
|
|
|
|
uses: actions/checkout@v3
|
|
|
|
|
|
|
|
- name: Install Rust stable
|
2023-05-26 08:23:52 +02:00
|
|
|
uses: dtolnay/rust-toolchain@master
|
2020-03-27 13:54:06 +01:00
|
|
|
with:
|
2020-07-03 14:50:28 +02:00
|
|
|
toolchain: stable
|
2022-07-03 12:35:56 +02:00
|
|
|
|
|
|
|
- name: Cache Dependencies
|
2023-05-26 08:23:52 +02:00
|
|
|
uses: Swatinem/rust-cache@v2
|
2022-07-03 12:35:56 +02:00
|
|
|
|
|
|
|
- name: Check examples
|
2023-05-26 08:23:52 +02:00
|
|
|
run: |
|
2023-06-01 12:24:43 +02:00
|
|
|
cargo +stable check --examples --features full
|
2022-07-03 12:35:56 +02:00
|
|
|
|
2022-11-25 11:38:34 +01:00
|
|
|
# TODO: prolly move it to a separate step?
|
|
|
|
- name: Check with no default features
|
2023-05-26 08:23:52 +02:00
|
|
|
run: |
|
2023-06-01 12:24:43 +02:00
|
|
|
cargo +stable check --no-default-features
|
2022-11-25 11:38:34 +01:00
|
|
|
|
2022-07-03 12:35:56 +02:00
|
|
|
clippy:
|
|
|
|
name: Run linter
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
|
|
|
|
steps:
|
|
|
|
- name: Checkout
|
|
|
|
uses: actions/checkout@v3
|
|
|
|
|
|
|
|
- name: Install Rust ${{ env.rust_nightly }}
|
2023-05-26 08:23:52 +02:00
|
|
|
uses: dtolnay/rust-toolchain@master
|
2022-07-03 12:35:56 +02:00
|
|
|
with:
|
|
|
|
toolchain: ${{ env.rust_nightly }}
|
|
|
|
components: clippy
|
|
|
|
|
|
|
|
- name: Cache Dependencies
|
2023-05-26 08:23:52 +02:00
|
|
|
uses: Swatinem/rust-cache@v2
|
2022-07-03 12:35:56 +02:00
|
|
|
|
|
|
|
- name: clippy
|
2023-05-26 08:23:52 +02:00
|
|
|
run: |
|
|
|
|
cargo clippy --all-targets --features "full nightly"
|
2022-07-03 12:35:56 +02:00
|
|
|
|
|
|
|
doc:
|
|
|
|
name: check docs
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
|
|
|
|
steps:
|
|
|
|
- name: Checkout
|
|
|
|
uses: actions/checkout@v3
|
|
|
|
|
|
|
|
- name: Install Rust ${{ env.rust_nightly }}
|
2023-05-26 08:23:52 +02:00
|
|
|
uses: dtolnay/rust-toolchain@master
|
2022-07-03 12:35:56 +02:00
|
|
|
with:
|
|
|
|
toolchain: ${{ env.rust_nightly }}
|
|
|
|
|
|
|
|
- name: Cache Dependencies
|
2023-05-26 08:23:52 +02:00
|
|
|
uses: Swatinem/rust-cache@v2
|
2022-07-03 12:35:56 +02:00
|
|
|
|
|
|
|
- name: rustdoc
|
2023-05-26 08:23:52 +02:00
|
|
|
run: |
|
|
|
|
cargo docs # from .cargo/config.toml
|