diff --git a/.github/actions/setup-warp/action.yml b/.github/actions/setup-warp/action.yml new file mode 100644 index 0000000..ebb0337 --- /dev/null +++ b/.github/actions/setup-warp/action.yml @@ -0,0 +1,23 @@ +name: 'Setup WARP' +description: 'Install and configure Cloudflare WARP on GitHub Actions runners' +author: 'ipspot@openscilab.com' + +runs: + using: "composite" + steps: + - name: Install and configure WARP + shell: bash + run: | + echo "WARP mode: client warp+doh." + sudo apt-get -y update + curl -fsSL https://pkg.cloudflareclient.com/pubkey.gpg | sudo gpg --yes --dearmor --output /usr/share/keyrings/cloudflare-warp-archive-keyring.gpg + echo "deb [arch=amd64 signed-by=/usr/share/keyrings/cloudflare-warp-archive-keyring.gpg] https://pkg.cloudflareclient.com/ $(lsb_release -cs) main" | sudo tee /etc/apt/sources.list.d/cloudflare-client.list + sudo apt-get update + sudo apt-get install -y cloudflare-warp + sudo warp-cli --accept-tos registration new + sudo warp-cli --accept-tos connect + + # Test IPv6 connectivity + sleep 1 + echo "Testing IPv6 connectivity..." + sudo curl -s6 --retry 3 -A Mozilla https://api64.ipify.org || echo "IPv6 not available" diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index ed24b05..51e0fc5 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -29,6 +29,10 @@ jobs: python-version: [3.7, 3.8, 3.9, 3.10.5, 3.11.0, 3.12.0, 3.13.0] steps: - uses: actions/checkout@v2 + # Setup WARP (Ubuntu only) + - name: Setup WARP + if: matrix.os == 'ubuntu-22.04' + uses: ./.github/actions/setup-warp - name: Set up Python ${{ matrix.python-version }} uses: actions/setup-python@v2 with: @@ -58,7 +62,14 @@ jobs: pip install --upgrade --upgrade-strategy=only-if-needed -r test-requirements.txt - name: Test with pytest run: | - python -m pytest . --cov=ipspot --cov-report=term + OS="${{ matrix.os }}" + TEST_OS="${{ env.TEST_OS }}" + if [[ "$OS" == "$TEST_OS" ]]; then + python -m pytest . --cov=ipspot --cov-report=term + else + python -m pytest . --cov=ipspot --cov-report=term --ignore=tests/test_ipv6.py + fi + shell: bash - name: Upload coverage to Codecov uses: codecov/codecov-action@v4 with: diff --git a/CHANGELOG.md b/CHANGELOG.md index 0c1409b..42bc856 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,8 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. ## [Unreleased] ### Added +- `Setup WARP` step in `test.yml` +- `setup-warp` action - Support [ipwho.is](https://ipwho.is/) - Support [ipquery.io](http://api.ipquery.io/?format=json) - Support [wtfismyip.com](https://wtfismyip.com/json) diff --git a/tests/test_ipv4.py b/tests/test_ipv4.py index 1dfd433..9f88fb9 100644 --- a/tests/test_ipv4.py +++ b/tests/test_ipv4.py @@ -174,7 +174,7 @@ def test_public_ipv4_my_ip_io_net_error(): def test_public_ipv4_ifconfig_co_success(): - result = get_public_ipv4(api=IPv4API.IFCONFIG_CO, geo=True) + result = get_public_ipv4(api=IPv4API.IFCONFIG_CO, geo=True, timeout=20) assert result["status"] assert is_ipv4(result["data"]["ip"]) assert set(result["data"].keys()) == DATA_ITEMS