diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 000000000..4b25c1d82 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,125 @@ +name: CI + +on: [push, pull_request] + +env: + CARGO_TERM_COLOR: always + +jobs: + + test: + runs-on: ubuntu-latest + strategy: + matrix: + rust: [stable, nightly] + steps: + - name: Checkout repository + uses: actions/checkout@v2 + - name: Install Rust + uses: actions-rs/toolchain@v1 + with: + toolchain: ${{ matrix.rust }} + override: true + profile: minimal + - name: Build + run: | + cargo build --verbose + - name: Test Prequisites + run: | + pip3 install Flask && cd integration && python3 server.py & + wget https://snapshots.mitmproxy.org/5.2/mitmproxy-5.2-linux.tar.gz -O - | tar -xz && ./mitmdump -p 8888 --modify-header "/From-Proxy/Hello" & + - name: Run Tests + run: | + cargo test + - name: Run Integration Tests + run: | + export PATH="$PWD/target/debug:$PATH" + integration/integration.sh + + rustfmt: + runs-on: ubuntu-latest + steps: + - name: Checkout repository + uses: actions/checkout@v2 + - name: Install Rust + uses: actions-rs/toolchain@v1 + with: + toolchain: stable + override: true + profile: minimal + components: rustfmt + - name: Check formatting + run: | + cargo fmt --all -- --check + + clippy: + runs-on: ubuntu-latest + steps: + - name: Checkout repository + uses: actions/checkout@v2 + - name: Install Rust + uses: actions-rs/toolchain@v1 + with: + toolchain: stable + override: true + profile: minimal + components: clippy + - name: Run Clippy + run: | + cargo clippy -- -D warnings + + release-linux: + runs-on: ubuntu-latest + steps: + - name: Checkout repository + uses: actions/checkout@v2 + - name: Install Rust + uses: actions-rs/toolchain@v1 + with: + toolchain: stable + override: true + profile: minimal + - name: Check Rust Version + run: | + ci/check_version.sh + - name: set Version + run: | + echo VERSION=$(grep '^version' packages/hurl/Cargo.toml | cut -f2 -d'"') >> $GITHUB_ENV + - name: Build + run: | + ci/man.sh + ci/release.sh + ci/create_tarball.sh linux + ci/deb.sh + - name: Archive production artifacts + uses: actions/upload-artifact@v2 + with: + path: target/upload/* + + release-osx: + runs-on: macos-latest + steps: + - name: Checkout repository + uses: actions/checkout@v2 + - name: Install Rust + uses: actions-rs/toolchain@v1 + with: + toolchain: stable + override: true + profile: minimal + - name: Check Rust Version + run: | + ci/check_version.sh + - name: set Version + run: | + echo VERSION=$(grep '^version' packages/hurl/Cargo.toml | cut -f2 -d'"') >> $GITHUB_ENV + - name: Build + run: | + ci/man.sh + ci/release.sh + ci/create_tarball.sh osx + - name: Archive production artifacts + uses: actions/upload-artifact@v2 + with: + path: target/upload/* + diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml deleted file mode 100644 index 05ab05070..000000000 --- a/.github/workflows/rust.yml +++ /dev/null @@ -1,47 +0,0 @@ -name: CI - -on: [push, pull_request] - -env: - CARGO_TERM_COLOR: always - -jobs: - - build: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - - run: pip3 install Flask && cd integration && python3 server.py & - - run: wget https://snapshots.mitmproxy.org/5.2/mitmproxy-5.2-linux.tar.gz -O - | tar -xz && ./mitmdump -p 8888 --modify-header "/From-Proxy/Hello" & - - name: Run build - run: ./build.sh - - name: Run integration tests - run: export PATH="$PWD/target/debug:$PATH" && integration/integration.sh - - release-linux: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - - run: echo "mypath" - - run: echo VERSION=$(grep '^version' packages/hurl/Cargo.toml | cut -f2 -d'"') >> $GITHUB_ENV - - run: ci/man.sh - - run: ci/release.sh - - run: ci/create_tarball.sh linux - - run: ci/deb.sh - - name: Archive production artifacts - uses: actions/upload-artifact@v2 - with: - path: target/upload/* - - release-osx: - runs-on: macos-latest - steps: - - uses: actions/checkout@v2 - - run: echo VERSION=$(grep '^version' packages/hurl/Cargo.toml | cut -f2 -d'"') >> $GITHUB_ENV - - run: ci/man.sh - - run: ci/release.sh - - run: ci/create_tarball.sh osx - - name: Archive production artifacts - uses: actions/upload-artifact@v2 - with: - path: target/upload/* diff --git a/build.sh b/build.sh deleted file mode 100755 index 8e8527c19..000000000 --- a/build.sh +++ /dev/null @@ -1,19 +0,0 @@ -#!/bin/bash -set -e - -#cargo build --features "strict" -ci/check_version.sh - -cargo build -cargo test -cargo doc --document-private-items - - -cargo clippy -- -D warnings - -cargo fmt -- --check - -echo -echo "!!! Build successful !!!" - - diff --git a/packages/hurl_core/src/parser/parsers.rs b/packages/hurl_core/src/parser/parsers.rs index e7cc48eec..4fad391ce 100644 --- a/packages/hurl_core/src/parser/parsers.rs +++ b/packages/hurl_core/src/parser/parsers.rs @@ -271,7 +271,7 @@ fn status(reader: &mut Reader) -> ParseResult<'static, Status> { Ok(value) => StatusValue::Specific(value), Err(_) => { return Err(Error { - pos: start.clone(), + pos: start, recoverable: false, inner: ParseError::Status {}, }) diff --git a/packages/hurl_core/src/parser/string.rs b/packages/hurl_core/src/parser/string.rs index 14f78018e..69ee19a86 100644 --- a/packages/hurl_core/src/parser/string.rs +++ b/packages/hurl_core/src/parser/string.rs @@ -235,7 +235,7 @@ fn template_element_string( } else if bracket { bracket = false; value.push('{'); - encoded.push_str("{"); + encoded.push('{'); value.push(c); encoded.push_str(s.as_str()); } else { diff --git a/packages/hurl_core/src/parser/template.rs b/packages/hurl_core/src/parser/template.rs index 2c06d78f6..eb3a510c5 100644 --- a/packages/hurl_core/src/parser/template.rs +++ b/packages/hurl_core/src/parser/template.rs @@ -62,7 +62,7 @@ pub fn templatize(encoded_string: EncodedString) -> ParseResult<'static, Vec ParseResult<'static, Vec ParseResult<'static, Vec {} State::FirstOpenBracket {} => { value.push('{'); - encoded.push_str("{"); + encoded.push('{'); } State::Template {} | State::FirstCloseBracket {} => { return Err(error::Error {