Merge pull request #110 from Orange-OpenSource/feature/github-actions-split

Split Github action Build Job
This commit is contained in:
Fabrice Reix 2020-12-13 15:02:47 +01:00 committed by GitHub
commit 467dc277f8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 130 additions and 71 deletions

125
.github/workflows/ci.yml vendored Normal file
View File

@ -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/*

View File

@ -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/*

View File

@ -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 !!!"

View File

@ -271,7 +271,7 @@ fn status(reader: &mut Reader) -> ParseResult<'static, Status> {
Ok(value) => StatusValue::Specific(value), Ok(value) => StatusValue::Specific(value),
Err(_) => { Err(_) => {
return Err(Error { return Err(Error {
pos: start.clone(), pos: start,
recoverable: false, recoverable: false,
inner: ParseError::Status {}, inner: ParseError::Status {},
}) })

View File

@ -235,7 +235,7 @@ fn template_element_string(
} else if bracket { } else if bracket {
bracket = false; bracket = false;
value.push('{'); value.push('{');
encoded.push_str("{"); encoded.push('{');
value.push(c); value.push(c);
encoded.push_str(s.as_str()); encoded.push_str(s.as_str());
} else { } else {

View File

@ -62,7 +62,7 @@ pub fn templatize(encoded_string: EncodedString) -> ParseResult<'static, Vec<Tem
state = State::Template {}; state = State::Template {};
} else { } else {
value.push('{'); value.push('{');
encoded.push_str("{"); encoded.push('{');
value.push(c); value.push(c);
encoded.push_str(&s.clone()); encoded.push_str(&s.clone());
@ -98,7 +98,7 @@ pub fn templatize(encoded_string: EncodedString) -> ParseResult<'static, Vec<Tem
} else { } else {
value.push('}'); value.push('}');
value.push(c); value.push(c);
encoded.push_str("}"); encoded.push('}');
encoded.push_str(&s.clone()); encoded.push_str(&s.clone());
} }
} }
@ -109,7 +109,7 @@ pub fn templatize(encoded_string: EncodedString) -> ParseResult<'static, Vec<Tem
State::String {} => {} State::String {} => {}
State::FirstOpenBracket {} => { State::FirstOpenBracket {} => {
value.push('{'); value.push('{');
encoded.push_str("{"); encoded.push('{');
} }
State::Template {} | State::FirstCloseBracket {} => { State::Template {} | State::FirstCloseBracket {} => {
return Err(error::Error { return Err(error::Error {