Skip to content

Update lockfiles with xtask and when initiating a release (#126) #150

Update lockfiles with xtask and when initiating a release (#126)

Update lockfiles with xtask and when initiating a release (#126) #150

Workflow file for this run

name: checks
on:
push:
branches:
- master
merge_group:
pull_request:
branches:
- master
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.63.0
jobs:
check:
name: Compile on MSRV
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
with:
fetch-depth: 2
- name: Setup Rust
uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ env.MSRV }}
- name: Set up Rust cache
uses: Swatinem/rust-cache@v2
- name: Prepare MSRV lockfile
run: cp ci/Cargo.lock.msrv Cargo.lock
- name: Run cargo check
run: cargo +$MSRV check --all-targets --locked
fmt:
name: Check formatting
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
with:
fetch-depth: 2
- name: Setup 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@v3
with:
fetch-depth: 2
- name: Setup Rust
uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ env.MSRV }}
components: clippy
- name: Set up Rust cache
uses: Swatinem/rust-cache@v2
- name: Prepare MSRV lockfile
run: cp ci/Cargo.lock.msrv Cargo.lock
- name: Run clippy
run: cargo +$MSRV clippy --all-targets --all-features --locked -- -D warnings
unit-tests:
name: Run unit tests
strategy:
fail-fast: false
matrix:
os: [windows-latest, macOS-latest, ubuntu-latest]
rust: [stable, beta, 1.63.0]
runs-on: ${{ matrix.os }}
steps:
- name: Checkout code
uses: actions/checkout@v3
with:
fetch-depth: 2
- name: Setup Rust
uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ matrix.rust }}
- name: Set up Rust cache
uses: Swatinem/rust-cache@v2
- name: Install cargo-nextest
uses: taiki-e/install-action@nextest
- name: Prepare MSRV lockfile
run: cp ci/Cargo.lock.msrv Cargo.lock
if: matrix.rust == '1.63.0'
- name: Run unit tests
run: cargo +${{ matrix.rust }} nextest run --lib --all-features
integration-tests:
name: Run integration tests
strategy:
fail-fast: false
matrix:
neo4j: ["5.12", "5.11", "5.10", "5.9", "5.8", "5.7", "4.4", "4.3", "4.2", "4.1"]
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
with:
fetch-depth: 2
- name: Accept Neo4j Enterprise license
run: echo "neo4j:5-enterprise > lib/container-license-acceptance.txt"
- name: Setup Rust
uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ env.MSRV }}
- name: Set up Rust cache
uses: Swatinem/rust-cache@v2
- 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: env NEO4J_VERSION_TAG=${{ matrix.neo4j }} cargo +$MSRV nextest run --all-features --locked
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@v3
- name: Setup 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@v3
- name: Setup 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 }}