diff --git a/.github/workflows/format.yml b/.github/workflows/format-build.yml similarity index 97% rename from .github/workflows/format.yml rename to .github/workflows/format-build.yml index 0bc915d..3079be2 100644 --- a/.github/workflows/format.yml +++ b/.github/workflows/format-build.yml @@ -1,6 +1,6 @@ on: [push, pull_request] -name: Code Formatting +name: Build and Formatting Tests jobs: check: diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml new file mode 100644 index 0000000..6a8b370 --- /dev/null +++ b/.github/workflows/tests.yml @@ -0,0 +1,27 @@ +on: + pull_request_review: + types: [submitted] + push: + workflow_dispatch: + +name: Integration Tests + +jobs: + proxy_tests: + name: Proxy Tests + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - uses: actions-rs/toolchain@v1 + with: + profile: minimal + toolchain: stable + override: true + - uses: actions-rs/cargo@v1 + with: + command: test + args: --no-run + - env: + SOCKS5_SERVER: ${{ secrets.SOCKS5_SERVER }} + HTTP_SERVER: ${{ secrets.HTTP_SERVER }} + run: sudo -E find -wholename './target/debug/deps/proxy-*' -executable -exec "{}" \; diff --git a/Cargo.toml b/Cargo.toml index 2053e90..f499840 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -20,4 +20,3 @@ nix = { version = "0.26", features = ["process", "signal"] } prctl = "1.0" reqwest = { version = "0.11", features = ["blocking", "json"] } serial_test = "1.0" -test-with = "0.9" diff --git a/tests/proxy.rs b/tests/proxy.rs index ba2ab96..e04865d 100644 --- a/tests/proxy.rs +++ b/tests/proxy.rs @@ -148,15 +148,21 @@ mod tests { } } + fn require_var(var: &str) { + env::var(var).expect(format!("{var} environment variable required").as_str()); + } + #[serial] - #[test_with::env(SOCKS5_SERVER)] + #[test] fn test_socks5() { + require_var("SOCKS5_SERVER"); run_test(|test| test.proxy.proxy_type == ProxyType::Socks5) } #[serial] - #[test_with::env(HTTP_SERVER)] + #[test] fn test_http() { + require_var("HTTP_SERVER"); run_test(|test| test.proxy.proxy_type == ProxyType::Http) } }