[DRAFT] Rework flush #3734
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: ci | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} | |
cancel-in-progress: true | |
env: | |
RUSTFLAGS: "-D warnings" | |
defaults: | |
run: | |
shell: bash | |
jobs: | |
test_matrix: | |
name: test (${{ matrix.os }}, nats-${{ matrix.nats_server }}) | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [ubuntu-latest, macos-latest, windows-latest] | |
nats_server: [main, dev] | |
include: | |
- nats_server: dev | |
features: server_2_10 | |
steps: | |
- name: Check out repository | |
uses: actions/checkout@v3 | |
- name: Cache rust | |
uses: actions/cache@v3 | |
env: | |
cache-name: cache-rust | |
with: | |
path: | | |
~/.cargo/bin/ | |
~/.cargo/registry/index/ | |
~/.cargo/registry/cache/ | |
~/.cargo/git/db/ | |
target/ | |
key: ${{ runner.os }}-cargo-build-${{ hashFiles('**/Cargo.toml') }} | |
- name: Cache go | |
uses: actions/cache@v3 | |
with: | |
path: | | |
~/go/pkg/mod # Module download cache | |
~/.cache/go-build # Build cache (Linux) | |
~/Library/Caches/go-build # Build cache (Mac) | |
'%LocalAppData%\go-build' # Build cache (Windows) | |
key: ${{ runner.os }}-go-${{ env.cache-name }} | |
restore-keys: | | |
${{ runner.os }}-go- | |
- name: Setup Rust | |
run: | | |
rustup install stable | |
- name: Set up Go | |
uses: actions/setup-go@v2 | |
with: | |
go-version: '1.19' | |
- name: Install nats-server | |
run: go install github.com/nats-io/nats-server/v2@${{ matrix.nats_server }} | |
- name: Setup deno for service tests | |
if: ${{ matrix.os }} != windows-latest | |
uses: "denoland/setup-deno@v1" | |
with: | |
deno-version: v1.x | |
- name: Run tests | |
env: | |
RUST_BACKTRACE: 1 | |
run: | | |
nats-server --jetstream --port=4222 & | |
cargo test --features=${{ matrix.features }} --features slow_tests -- --nocapture | |
check_format: | |
name: check (format) | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check out repository | |
uses: actions/checkout@v3 | |
- name: Set up Rust | |
run: | | |
rustup install nightly | |
rustup default nightly | |
rustup component add rustfmt | |
- name: Run the check | |
run: cargo fmt -- --check | |
check_lint: | |
name: check (lint) | |
runs-on: ubuntu-latest | |
steps: | |
- name: Cache rust | |
uses: actions/cache@v3 | |
env: | |
cache-name: cache-rust | |
with: | |
path: target | |
key: ${{ runner.os }}-${{ env.cache-name }} | |
restore-keys: | | |
${{ runner.os }}- | |
- name: Check out repository | |
uses: actions/checkout@v3 | |
- name: Set up rust | |
run: | | |
rustup install stable | |
- name: Check lint | |
run: cargo clippy --benches --tests --examples --all-features -- --deny clippy::all | |
check_docs: | |
name: check (docs) | |
runs-on: ubuntu-latest | |
steps: | |
- name: Cache rust | |
uses: actions/cache@v3 | |
env: | |
cache-name: cache-rust | |
with: | |
path: target | |
key: ${{ runner.os }}-${{ env.cache-name }} | |
restore-keys: | | |
${{ runner.os }}- | |
- name: Check out repository | |
uses: actions/checkout@v3 | |
- name: Set up rust | |
run: | | |
rustup install stable | |
rustup component add clippy | |
- name: Check lint | |
run: cargo doc | |
check_licenses: | |
name: check (licenses) | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check out repository | |
uses: actions/checkout@v3 | |
- name: Run cargo deny | |
uses: EmbarkStudios/cargo-deny-action@v1 | |
with: | |
command: check | |
command-arguments: licenses | |
check_msrv: | |
name: check (msrv) | |
runs-on: ubuntu-latest | |
steps: | |
- name: Cache rust | |
uses: actions/cache@v3 | |
env: | |
cache-name: cache-rust | |
with: | |
path: target | |
key: ${{ runner.os }}-${{ env.cache-name }} | |
restore-keys: | | |
${{ runner.os }}- | |
- name: Check out repository | |
uses: actions/checkout@v3 | |
- name: Check minimum supported rust Version | |
run: | | |
set -eo pipefail | |
echo "msrv check" | |
rustup install 1.67.0 | |
cargo +1.67.0 check | |
check_examples: | |
name: check (examples) | |
runs-on: ubuntu-latest | |
steps: | |
- name: Cache rust | |
uses: actions/cache@v3 | |
env: | |
cache-name: cache-rust | |
with: | |
path: target | |
key: ${{ runner.os }}-${{ env.cache-name }} | |
restore-keys: | | |
${{ runner.os }}- | |
- name: Check out repository | |
uses: actions/checkout@v3 | |
- name: Set up go | |
uses: actions/setup-go@v2 | |
with: | |
go-version: '1.19' | |
- name: Set up rust | |
run: | | |
rustup install stable | |
- name: Install nats-server | |
run: go install github.com/nats-io/nats-server/v2@dev | |
- name: Check examples | |
env: | |
RUST_LOG: trace | |
run: cargo check --examples | |
check_spelling: | |
name: check (spelling) | |
runs-on: ubuntu-latest | |
steps: | |
- name: Cache rust | |
uses: actions/cache@v3 | |
env: | |
cache-name: cache-rust | |
with: | |
path: target | |
key: ${{ runner.os }}-${{ env.cache-name }} | |
restore-keys: | | |
${{ runner.os }}- | |
- name: Check out repository | |
uses: actions/checkout@v3 | |
- name: Set up rust | |
run: | | |
rustup install nightly | |
- name: Install llvm-config | |
run: sudo apt-get install -y libclang-dev | |
- name: Install cargo spellcheck | |
run: cargo install cargo-spellcheck | |
- name: Check spelling | |
run: cargo spellcheck --code 1 |