hurl/.github/workflows/test.yml

205 lines
6.2 KiB
YAML
Raw Normal View History

2021-02-01 19:05:50 +03:00
name: test
2021-01-30 00:29:51 +03:00
on: [push, pull_request]
env:
CARGO_TERM_COLOR: always
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: Environment
2021-02-01 23:57:36 +03:00
run: |
uname -a
cargo --version
2021-01-30 00:29:51 +03:00
- name: Build
run: |
cargo build --verbose
- name: Test Prequisites
run: |
2021-07-02 20:27:36 +03:00
sudo apt install libxml2-utils
pip3 install Flask
cd integration
python3 server.py >server.log 2>&1 &
python3 ssl/server.py >server-ssl.log 2>&1 &
2021-01-30 00:29:51 +03:00
wget https://snapshots.mitmproxy.org/5.2/mitmproxy-5.2-linux.tar.gz -O - | tar -xz && ./mitmdump -p 8888 --modify-header "/From-Proxy/Hello" &
2021-02-23 19:37:41 +03:00
- name: Run Tests units
2021-01-30 00:29:51 +03:00
run: |
cargo test --features strict
2021-01-30 00:29:51 +03:00
- name: Run Integration Tests
run: |
export PATH="$PWD/target/debug:$PATH"
2021-02-03 22:31:09 +03:00
cd integration
./integration.py
./test_curl_commands.sh tests/*.curl
2021-07-02 20:27:36 +03:00
xmllint --noout tests/*.html
2021-02-03 22:31:09 +03:00
- name: Archive production artifacts
uses: actions/upload-artifact@v2
if: ${{ always() }}
with:
name: tests-ubuntu-${{ matrix.rust }}-artifacts
path: |
integration/server.log
integration/server-ssl.log
2021-01-30 00:29:51 +03:00
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: Environment
2021-02-01 23:57:36 +03:00
run: |
uname -a
cargo --version
2021-01-30 00:29:51 +03:00
- name: Build
run: |
cargo build --verbose
- name: Test Prequisites
run: |
pip3 install Flask
cd integration
python3 server.py >server.log 2>&1 &
python3 ssl/server.py >server-ssl.log 2>&1 &
2021-01-30 00:29:51 +03:00
wget https://snapshots.mitmproxy.org/5.2/mitmproxy-5.2-osx.tar.gz -O - | tar -xz && ./mitmdump -p 8888 --modify-header "/From-Proxy/Hello" &
2021-02-23 19:37:41 +03:00
- name: Run Tests units
2021-01-30 00:29:51 +03:00
run: |
cargo test
- name: Run Integration Tests
run: |
export PATH="$PWD/target/debug:$PATH"
2021-02-03 22:31:09 +03:00
cd integration
./integration.py
- name: Archive production artifacts
uses: actions/upload-artifact@v2
if: ${{ always() }}
with:
name: tests-osx-${{ matrix.rust }}-artifacts
path: |
integration/server.log
integration/server-ssl.log
2021-02-23 19:37:41 +03:00
test-win64:
runs-on: windows-latest
strategy:
matrix:
rust: [stable, nightly]
env:
VCPKGRS_DYNAMIC: 1
steps:
- name: Set git to use LF
run: |
git config --global core.autocrlf false
git config --global core.eol lf
- name: Checkout repository
uses: actions/checkout@v2
- name: Install Rust
uses: actions-rs/toolchain@v1
with:
toolchain: stable
override: true
profile: minimal
- name: Environment
run: |
$Properties = 'Caption', 'CSName', 'Version', 'BuildType', 'OSArchitecture'
Get-CimInstance Win32_OperatingSystem | Select-Object $Properties | Format-Table -AutoSize
cargo --version
$PsVersionTable
- name: Install build and tests prequisites
run: |
# vcpkg build prequisites
(Get-Command vcpkg).Path
Expand-Archive -PassThru -Force -LiteralPath .\ci\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 units
run: |
cd .\integration
Start-Job -Name mitmdump -ScriptBlock { mitmdump --listen-port 8888 --modify-header "/From-Proxy/Hello" }
Start-Job -Name server -ScriptBlock { python server.py > server.log }
Start-Job -Name server -ScriptBlock { python ssl/server.py > server-ssl.log }
Get-Job -Name server
Get-Job -Name mitmdump
Start-Sleep 5
cd ..
2021-02-23 20:53:29 +03:00
cargo test --verbose
2021-02-23 19:37:41 +03:00
- name: Run Integration tests
run: |
cargo build --release --verbose
$execdir=[System.Environment]::SystemDirectory
Get-ChildItem -Path ".\target\release" -Recurse -Include *.dll -File | Copy-Item -Destination "${execdir}"
Get-ChildItem -Path ".\target\release" -Recurse -Include hurl*.exe -File | Copy-Item -Destination "${execdir}"
cd .\integration
Start-Job -Name mitmdump -ScriptBlock { mitmdump --listen-port 8888 --modify-header "/From-Proxy/Hello" }
Start-Job -Name server -ScriptBlock { python server.py > server.log }
Start-Job -Name server -ScriptBlock { python ssl/server.py > server-ssl.log }
Get-Job -Name server
Get-Job -Name mitmdump
Start-Sleep 5
hurlfmt --no-format tests\assert_base64.hurl
python integration.py
- name: Archive production artifacts
uses: actions/upload-artifact@v2
if: ${{ always() }}
with:
name: tests-win64-${{ matrix.rust }}-artifacts
path: |
integration/server.log
integration/server-ssl.log