Skip to content

chore: release (#505) #868

chore: release (#505)

chore: release (#505) #868

Workflow file for this run

name: CI
on:
push:
branches: [main]
paths-ignore:
- "**.md"
- "docs/**"
- ".github/*.md"
- "LICENSE*"
- ".gitignore"
- ".env.example"
pull_request:
branches: [main]
paths-ignore:
- "**.md"
- "docs/**"
- ".github/*.md"
- "LICENSE*"
- ".gitignore"
- ".env.example"
env:
CARGO_TERM_COLOR: always
RUST_BACKTRACE: short
CARGO_INCREMENTAL: 1
RUSTFLAGS: "-C debuginfo=0"
CARGO_NET_RETRY: 10
# Cancel previous runs of the same workflow
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.ref }}
cancel-in-progress: true
jobs:
# Quick checks run first and fail fast
quick-checks:
name: Quick Checks
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- name: Install Rust
uses: dtolnay/rust-toolchain@7b1c307e0dcbda6122208f10795a713336a9b35a # stable
with:
toolchain: stable
components: rustfmt, clippy
- name: Cache cargo registry and build
uses: Swatinem/rust-cache@9d47c6ad4b02e050fd481d890b2ea34778fd09d6 # v2.7.8
with:
prefix-key: "v1-rust"
shared-key: "quick"
- name: Check formatting
run: cargo fmt --all -- --check
- name: Run clippy
run: cargo clippy --all-targets --all-features -- -D warnings
# Unit tests for each package in parallel
test-unit:
name: Unit Tests - ${{ matrix.package }}
needs: quick-checks
runs-on: ubuntu-latest
strategy:
fail-fast: true
matrix:
package: [redis-cloud, redis-enterprise, redisctl]
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- name: Install Rust
uses: dtolnay/rust-toolchain@7b1c307e0dcbda6122208f10795a713336a9b35a # stable
with:
toolchain: stable
- name: Cache cargo registry and build
uses: Swatinem/rust-cache@9d47c6ad4b02e050fd481d890b2ea34778fd09d6 # v2.7.8
with:
prefix-key: "v1-rust"
shared-key: "test-${{ matrix.package }}"
- name: Run unit tests
run: cargo test --package ${{ matrix.package }} --lib --all-features
# Integration tests
test-integration:
name: Integration Tests
needs: quick-checks
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- name: Install Rust
uses: dtolnay/rust-toolchain@7b1c307e0dcbda6122208f10795a713336a9b35a # stable
with:
toolchain: stable
- name: Cache cargo registry and build
uses: Swatinem/rust-cache@9d47c6ad4b02e050fd481d890b2ea34778fd09d6 # v2.7.8
with:
prefix-key: "v1-rust"
shared-key: "integration"
- name: Run integration tests
run: cargo test --workspace --test '*' --all-features
# Platform builds - only required for main branch and releases
build-platforms:
name: Build - ${{ matrix.os }}
needs: [test-unit, test-integration]
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-latest
required: true
- os: macos-latest
required: false
- os: windows-latest
required: false
continue-on-error: ${{ !matrix.required }}
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- name: Install Rust
uses: dtolnay/rust-toolchain@7b1c307e0dcbda6122208f10795a713336a9b35a # stable
with:
toolchain: stable
- name: Cache cargo registry and build
uses: Swatinem/rust-cache@9d47c6ad4b02e050fd481d890b2ea34778fd09d6 # v2.7.8
with:
prefix-key: "v1-rust"
shared-key: "build"
- name: Build binary
run: cargo build --release --bin redisctl
# Only run full tests on Linux (fastest platform)
- name: Run all tests
if: matrix.os == 'ubuntu-latest'
run: cargo test --workspace --all-features
# Code coverage - only on main branch
coverage:
name: Code Coverage
needs: [test-unit, test-integration]
if: github.ref == 'refs/heads/main'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- name: Install Rust
uses: dtolnay/rust-toolchain@7b1c307e0dcbda6122208f10795a713336a9b35a # stable
with:
toolchain: stable
- name: Cache cargo registry and build
uses: Swatinem/rust-cache@9d47c6ad4b02e050fd481d890b2ea34778fd09d6 # v2.7.8
with:
prefix-key: "v1-rust"
shared-key: "coverage"
- name: Install tarpaulin
uses: taiki-e/install-action@v2
with:
tool: [email protected]
- name: Generate coverage
run: cargo tarpaulin --workspace --all-features --out xml --timeout 300
- name: Upload coverage to Codecov
uses: codecov/codecov-action@1e68e06f1dbfde0e4cefc87efeba9e4643565303 # v5.1.1
with:
files: ./cobertura.xml
fail_ci_if_error: false
# Final status check - ensures all required jobs passed
ci-status:
name: CI Status
runs-on: ubuntu-latest
needs: [quick-checks, test-unit, test-integration, build-platforms]
if: always()
steps:
- name: Check CI status
run: |
if [[ "${{ needs.quick-checks.result }}" != "success" ]]; then
echo "Quick checks failed"
exit 1
fi
if [[ "${{ needs.test-unit.result }}" != "success" ]]; then
echo "Unit tests failed"
exit 1
fi
if [[ "${{ needs.test-integration.result }}" != "success" ]]; then
echo "Integration tests failed"
exit 1
fi
# Build platforms can have failures for non-Linux
echo "CI passed!"