Retry on certain query failures for managed transactions (#190) #328
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: checks | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
branches: | |
- main | |
release: | |
types: [published] | |
merge_group: | |
workflow_dispatch: | |
inputs: | |
crate: | |
description: Which crate to publish | |
required: true | |
type: choice | |
options: | |
- neo4rs | |
- neo4rs-macros | |
env: | |
RUST_LOG: debug | |
CARGO_TERM_COLOR: always | |
MSRV: 1.75.0 | |
HACK: hack --package neo4rs --each-feature --exclude-features unstable-serde-packstream-format,unstable-bolt-protocol-impl-v2,unstable-streaming-summary | |
jobs: | |
check: | |
name: Compile on MSRV | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 2 | |
- name: Set up Rust | |
uses: dtolnay/rust-toolchain@master | |
with: | |
toolchain: ${{ env.MSRV }} | |
- name: Set up Rust cache | |
uses: Swatinem/rust-cache@v2 | |
- name: Install cargo-hack | |
uses: taiki-e/install-action@cargo-hack | |
- name: Prepare MSRV lockfile | |
run: cp ci/Cargo.lock.msrv Cargo.lock | |
- name: Run cargo check | |
run: cargo +$MSRV --locked ${{ env.HACK }} check | |
fmt: | |
name: Check formatting | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 2 | |
- name: Set up Rust | |
uses: dtolnay/rust-toolchain@master | |
with: | |
toolchain: stable | |
components: rustfmt | |
- name: Set up Rust cache | |
uses: Swatinem/rust-cache@v2 | |
- name: Run cargo fmt | |
run: cargo +stable fmt --all -- --check | |
clippy: | |
name: Check clippy | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 2 | |
- name: Set up Rust | |
uses: dtolnay/rust-toolchain@master | |
with: | |
toolchain: ${{ env.MSRV }} | |
components: clippy | |
- name: Set up Rust cache | |
uses: Swatinem/rust-cache@v2 | |
- name: Install cargo-hack | |
uses: taiki-e/install-action@cargo-hack | |
- name: Prepare MSRV lockfile | |
run: cp ci/Cargo.lock.msrv Cargo.lock | |
- name: Run clippy | |
run: cargo +$MSRV --locked ${{ env.HACK }} clippy -- -D warnings | |
unit-tests: | |
name: Run unit tests | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [windows-latest, macOS-latest, ubuntu-latest] | |
runs-on: ${{ matrix.os }} | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 2 | |
- name: Set up Rust | |
uses: dtolnay/rust-toolchain@master | |
with: | |
toolchain: stable | |
- name: Set up Rust cache | |
uses: Swatinem/rust-cache@v2 | |
- name: Install cargo-hack | |
uses: taiki-e/install-action@cargo-hack | |
- name: Install cargo-nextest | |
uses: taiki-e/install-action@nextest | |
- name: Run unit tests | |
run: cargo ${{ env.HACK }} nextest run --lib | |
integration-tests: | |
name: Run integration tests | |
strategy: | |
fail-fast: false | |
matrix: | |
neo4j: ["5", "4.4"] | |
runs-on: ubuntu-latest | |
services: | |
neo4j: | |
image: neo4j:${{ matrix.neo4j }}-enterprise | |
env: | |
NEO4J_ACCEPT_LICENSE_AGREEMENT: yes | |
NEO4J_AUTH: neo4j/integrationtest | |
ports: | |
- "7687:7687" | |
env: | |
NEO4J_TEST_URI: bolt://localhost:7687 | |
NEO4J_TEST_USER: neo4j | |
NEO4J_TEST_PASS: integrationtest | |
NEO4J_VERSION_TAG: ${{ matrix.neo4j }} | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 2 | |
- name: Set up Rust | |
uses: dtolnay/rust-toolchain@master | |
with: | |
toolchain: ${{ env.MSRV }} | |
- name: Set up Rust cache | |
uses: Swatinem/rust-cache@v2 | |
- name: Install cargo-hack | |
uses: taiki-e/install-action@cargo-hack | |
- name: Install cargo-nextest | |
uses: taiki-e/install-action@nextest | |
- name: Prepare MSRV lockfile | |
run: cp ci/Cargo.lock.msrv Cargo.lock | |
- name: Run integration tests | |
run: cargo +$MSRV --locked ${{ env.HACK }} nextest run -E 'kind(test)' | |
msrv: | |
name: Validate MSRV and minimal dependency versions | |
strategy: | |
fail-fast: false | |
matrix: | |
include: | |
- file: Cargo.lock.msrv | |
name: MSRV | |
- file: Cargo.lock.min | |
name: minimal dependency versions | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Set up Rust | |
uses: dtolnay/rust-toolchain@master | |
with: | |
toolchain: ${{ env.MSRV }} | |
- name: Prepare ${{ matrix.name }} lockfile | |
run: cp ci/${{ matrix.file }} Cargo.lock | |
- name: Set up Rust cache | |
uses: Swatinem/rust-cache@v2 | |
- name: Install cargo-nextest | |
uses: taiki-e/install-action@nextest | |
- name: Run ${{ matrix.name }} unit tests | |
run: cargo +$MSRV nextest run --lib --all-features --locked | |
release: | |
name: Release | |
needs: [check, fmt, clippy, unit-tests, integration-tests, msrv] | |
if: startsWith(github.ref, 'refs/tags/') | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Set up Rust | |
if: startsWith(github.ref, 'refs/tags/') | |
uses: dtolnay/rust-toolchain@master | |
with: | |
toolchain: stable | |
- name: Set up Rust cache | |
if: startsWith(github.ref, 'refs/tags/') | |
uses: Swatinem/rust-cache@v2 | |
- name: Publish release | |
if: startsWith(github.ref, 'refs/tags/') | |
env: | |
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }} | |
run: cargo publish -p ${{ inputs.crate || 'neo4rs' }} |