Skip to content

Add v2 query params #251

Add v2 query params

Add v2 query params #251

Workflow file for this run

name: Rust
on:
push:
branches:
- main
pull_request:
jobs:
# this checks that the readme created from rustdoc is up to date
readmecheck:
name: README Format Check
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: docker://ghcr.io/msrd0/cargo-doc2readme:nightly
with:
entrypoint: cargo
args: doc2readme -p influxdb --expand-macros --check
# this checks that there are no clippy lints
clippy:
name: Style Check (clippy)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@1.75.0
with:
components: clippy
- name: Check Clippy lints (reqwest)
run: cargo clippy --manifest-path influxdb/Cargo.toml --all-targets --no-default-features --features serde,derive,reqwest-client-rustls -- -D warnings
- name: Check Clippy lints (surf)
run: cargo clippy --manifest-path influxdb/Cargo.toml --all-targets --no-default-features --features serde,derive,hyper-client -- -D warnings
# this checks that the code is formatted with rustfmt
rustfmt:
name: Style Checks (rustfmt)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@nightly
with:
components: rustfmt
- name: Check code formatting
run: cargo fmt --all -- --check
# this tests that all unit and doc tests are successful
unit_tests:
name: Unit and Doc Tests (Rust ${{matrix.rust.name}} on ${{matrix.os}})
runs-on: ${{matrix.os}}
continue-on-error: ${{matrix.rust.nightly}}
strategy:
fail-fast: false
matrix:
rust:
- name: MSRV
toolchain: "1.65"
nightly: false
- name: Stable
toolchain: stable
nightly: false
- name: Beta
toolchain: beta
nightly: false
- name: Nightly
toolchain: nightly
nightly: true
os: [ubuntu-latest, windows-latest, macOS-latest]
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{matrix.rust.toolchain}}
id: rust-toolchain
- uses: actions/cache@v4
with:
path: |
~/.cargo/git
~/.cargo/registry
target
key: "${{runner.os}} Rust ${{steps.rust-toolchain.outputs.cachekey}}"
- run: cargo test --lib
- run: cargo test --doc
# this tests that all integration tests are successful
integration_tests:
name: Integration Tests (Rust ${{matrix.rust.name}} with ${{matrix.http-backend}})
runs-on: ubuntu-latest
continue-on-error: ${{matrix.rust.nightly}}
strategy:
fail-fast: false
matrix:
rust:
- name: Stable
toolchain: stable
nightly: false
http-backend:
- curl-client
- h1-client
- h1-client-rustls
- hyper-client
- reqwest-client-rustls
- reqwest-client-native-tls
- reqwest-client-native-tls-vendored
services:
influxdb:
image: influxdb:1.8
ports:
- 8086:8086
authed_influxdb:
image: influxdb:1.8
ports:
- 9086:8086
env:
INFLUXDB_HTTP_AUTH_ENABLED: true
INFLUXDB_ADMIN_USER: admin
INFLUXDB_ADMIN_PASSWORD: password
INFLUXDB_USER: nopriv_user
INFLUXDB_USER_PASSWORD: password
influxdbv2:
image: influxdb:2.6
ports:
- 2086:8086
env:
DOCKER_INFLUXDB_INIT_MODE: setup
DOCKER_INFLUXDB_INIT_USERNAME: admin
DOCKER_INFLUXDB_INIT_PASSWORD: password
DOCKER_INFLUXDB_INIT_ORG: testing
DOCKER_INFLUXDB_INIT_BUCKET: mydb
DOCKER_INFLUXDB_INIT_ADMIN_TOKEN: admintoken
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{matrix.rust.toolchain}}
id: rust-toolchain
- uses: actions/cache@v4
with:
path: |
~/.cargo/git
~/.cargo/registry
target
key: "${{runner.os}} Rust ${{steps.rust-toolchain.outputs.cachekey}}"
- name: Run tests
run: |
for test in integration_tests{,_v2}
do
cargo test -p influxdb --no-default-features --features 'serde derive ${{matrix.http-backend}}' --no-fail-fast --test $test
done
# this uses cargo-tarpaulin to inspect the code coverage
coverage:
name: Code Coverage (stable/ubuntu-latest)
runs-on: ubuntu-latest
services:
influxdb:
image: influxdb:1.8
ports:
- 8086:8086
authed_influxdb:
image: influxdb:1.8
ports:
- 9086:8086
env:
INFLUXDB_HTTP_AUTH_ENABLED: true
INFLUXDB_ADMIN_USER: admin
INFLUXDB_ADMIN_PASSWORD: password
INFLUXDB_USER: nopriv_user
INFLUXDB_USER_PASSWORD: password
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
id: rust-toolchain
- name: Get Tarpaulin Version
id: tarpaulin-version
run: echo "version=$(wget -qO- 'https://crates.io/api/v1/crates/cargo-tarpaulin' | jq -r '.crate.max_stable_version')" >>$GITHUB_OUTPUT
- uses: actions/cache@v4
with:
path: |
~/.cargo/bin/cargo-tarpaulin
~/.cargo/git
~/.cargo/registry
target
key: "${{runner.os}} Rust ${{steps.rust-version.outputs.version}} tarpaulin ${{steps.tarpaulin-version.outputs.version}}"
- name: Install Tarpaulin
run: |
ls -lh ~/.cargo/bin
test -e ~/.cargo/bin/cargo-tarpaulin || cargo install cargo-tarpaulin --version ${{steps.tarpaulin-version.outputs.version}}
- name: Run Tarpaulin coverage tests
run: |
cargo tarpaulin -v \
--target-dir target/tarpaulin \
--workspace \
--features serde,derive \
--exclude-files 'derive/*' \
--exclude-files 'target/*' \
--ignore-panics --ignore-tests \
--out Html --out Json
env:
RUST_BACKTRACE: 1
RUST_LOG: info
- uses: actions/upload-artifact@v4
with:
name: tarpaulin-report
path: |
tarpaulin-report.json
tarpaulin-report.html
# this uploads the code coverage to github pages
pages:
runs-on: ubuntu-latest
needs:
- coverage
if: github.ref == 'refs/heads/main'
steps:
- uses: actions/checkout@v4
with:
ref: gh-pages
- uses: actions/download-artifact@v4
with:
name: tarpaulin-report
- run: |
coverage=$(jq '.files | { covered: map(.covered) | add, coverable: map(.coverable) | add } | .covered / .coverable * 10000 | round | . / 100' tarpaulin-report.json)
color=$([[ $coverage < 80 ]] && printf yellow || printf brightgreen)
wget -qO coverage.svg "https://img.shields.io/badge/coverage-$coverage%25-$color"
git add coverage.svg tarpaulin-report.html
git status
- uses: stefanzweifel/git-auto-commit-action@v5
with:
commit_message: "GitHub Pages for ${{ github.sha }}"