hurl/.github/workflows/test.yml
2021-01-29 22:29:51 +01:00

140 lines
3.8 KiB
YAML

name: testing
on: [push, pull_request]
env:
CARGO_TERM_COLOR: always
RUST_BACKTRACE: 1
VCPKGRS_DYNAMIC: 1
jobs:
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
test-ubuntu:
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.py
test-osx:
runs-on: macos-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-osx.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.py
test-win64:
runs-on: windows-latest
strategy:
matrix:
rust: [stable, nightly]
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Install Rust
uses: actions-rs/toolchain@v1
with:
toolchain: stable
override: true
profile: minimal
- name: Install build and tests prequisites
run: |
# vcpkg build prequisites
(Get-Command vcpkg).Path
Expand-Archive -PassThru -Force -LiteralPath .\contrib\windows\vcpkg_installed.zip -DestinationPath C:\vcpkg\
Get-ChildItem C:\vcpkg\installed
vcpkg integrate install
# fix known win build bugs
(Get-Content .\packages\hurl\src\runner\hurl_file.rs).replace('```', '') | Set-Content .\packages\hurl\src\runner\hurl_file.rs
# install proxy and server
pip3 install Flask mitmproxy
- name: Run tests
run: |
cd .\integration
Start-Job -Name server -ScriptBlock { python server.py }
Start-Sleep 5
Start-Job -Name mitmdump -ScriptBlock { mitmdump --listen-port 8888 --modify-header "/From-Proxy/Hello" }
Start-Sleep 5
Get-Job -Name server
Get-Job -Name mitmdump
cd ..
cargo test --verbose
- name: Run integration tests
run: |
echo "coming soon ..."