From ffa417aef760ecbc06154e2a1462d058c29df7a8 Mon Sep 17 00:00:00 2001 From: Gero Gerke <11deutron11@gmail.com> Date: Fri, 21 Aug 2020 23:34:57 +0200 Subject: [PATCH] Switch to Github Actions (#65) * Start with CI * Fix clippy errors * change tested crates --- .github/workflows/rust.yml | 66 +++++++++++++++++++ .travis.yml | 63 ------------------ influxdb/src/error.rs | 1 - .../src/integrations/serde_integration.rs | 3 +- influxdb/tests/integration_tests.rs | 1 - 5 files changed, 67 insertions(+), 67 deletions(-) create mode 100644 .github/workflows/rust.yml delete mode 100644 .travis.yml diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml new file mode 100644 index 0000000..c8dbaa9 --- /dev/null +++ b/.github/workflows/rust.yml @@ -0,0 +1,66 @@ +name: Rust + +on: [push] + +jobs: + style: + name: Style Checks (stable/ubuntu-latest) + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@master + - uses: hecrj/setup-rust-action@v1 + with: + components: "rustfmt,clippy" + - uses: actions/checkout@v1 + - name: Check code formatting + run: cargo fmt --all -- --check + - name: Check Clippy lints + run: cargo clippy --all-targets --all-features -- -D warnings + + compile: + name: Compile (${{ matrix.rust_release }}/${{ matrix.os }}) + runs-on: ${{ matrix.os }} + strategy: + matrix: + rust_release: [nightly, stable] + os: [ubuntu-latest, windows-latest, macOS-latest] + + steps: + - uses: actions/checkout@master + - uses: hecrj/setup-rust-action@v1 + with: + rust-version: ${{ matrix.rust_release }} + - name: Build + run: cargo build --verbose + + integration_test: + name: Integration Tests (stable/ubuntu-latest) + runs-on: ubuntu-latest + needs: [style, compile] + services: + influxdb: + image: influxdb + ports: + - 8086:8086 + authed_influxdb: + image: influxdb + 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@v1 + - uses: actions-rs/toolchain@v1 + with: + toolchain: nightly + override: true + - uses: actions-rs/cargo@v1 + with: + command: test + args: --package influxdb --package influxdb_derive --all-features --no-fail-fast \ No newline at end of file diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 525b308..0000000 --- a/.travis.yml +++ /dev/null @@ -1,63 +0,0 @@ -language: rust - -sudo: required - -services: - - docker - -before_install: - - docker pull influxdb - - docker run -d -p 8086:8086 --name influxdb influxdb - - docker run -d -p 9086:8086 --name authed_influxdb -e INFLUXDB_HTTP_AUTH_ENABLED=true -e INFLUXDB_ADMIN_USER=admin -e INFLUXDB_ADMIN_PASSWORD=password -e INFLUXDB_USER=nopriv_user -e INFLUXDB_USER_PASSWORD=password influxdb - - docker ps - -branches: - only: - - master - -cache: - directories: - - /home/travis/.cargo - -before_cache: - - rm -rf /home/travis/.cargo/registry - -env: -os: - - linux -rust: - - stable - - beta - - nightly - - 1.39.0 - -matrix: - fast_finish: true - allow_failures: - include: - - rust: stable - env: NAME='linting' - before_script: - - rustup component add rustfmt - - rustup component add clippy - script: - - cargo fmt --all -- --check - - cargo clippy --all-targets --all-features -- -D warnings - - - rust: stable - env: NAME='readme-check' - before_script: - - bash auxiliary/update_cargo-readme.sh - script: - - bash auxiliary/check_readme_consistency.sh - -script: - - export RUST_BACKTRACE=1 - - cd influxdb - - cargo build - - cargo test --all --all-features - - cargo doc --no-deps - - cd ../influxdb_derive - - cargo build - - cargo test --all --all-features - - cargo doc --no-deps diff --git a/influxdb/src/error.rs b/influxdb/src/error.rs index 2f23b36..6a452d5 100644 --- a/influxdb/src/error.rs +++ b/influxdb/src/error.rs @@ -1,5 +1,4 @@ //! Errors that might happen in the crate -use reqwest; #[derive(Debug, Fail)] pub enum Error { diff --git a/influxdb/src/integrations/serde_integration.rs b/influxdb/src/integrations/serde_integration.rs index 1c941a1..e01b60a 100644 --- a/influxdb/src/integrations/serde_integration.rs +++ b/influxdb/src/integrations/serde_integration.rs @@ -49,7 +49,6 @@ use reqwest::{Client as ReqwestClient, StatusCode, Url}; use serde::{de::DeserializeOwned, Deserialize}; -use serde_json; use crate::{Client, Error, Query, ReadQuery}; @@ -110,7 +109,7 @@ impl Client { return Err(error); } }; - url.query_pairs_mut().append_pair("q", &read_query.clone()); + url.query_pairs_mut().append_pair("q", &read_query); if !read_query.contains("SELECT") && !read_query.contains("SHOW") { let error = Error::InvalidQueryError { diff --git a/influxdb/tests/integration_tests.rs b/influxdb/tests/integration_tests.rs index d69447e..20c0c8d 100644 --- a/influxdb/tests/integration_tests.rs +++ b/influxdb/tests/integration_tests.rs @@ -8,7 +8,6 @@ use utilities::{ use influxdb::InfluxDbWriteable; use influxdb::{Client, Error, Query, Timestamp}; -use tokio; /// INTEGRATION TEST ///