Update release and test CI #172
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Integration Tests | |
| on: | |
| pull_request: | |
| workflow_call: | |
| jobs: | |
| integration-test: | |
| name: Run Integration Tests | |
| runs-on: [ self-hosted, linux, x64, jammy, large ] | |
| steps: | |
| - uses: actions/checkout@v2 | |
| - name: Build aproxy Snap | |
| id: snapcraft-build | |
| uses: snapcore/action-build@v1 | |
| with: | |
| snapcraft-args: --build-for amd64 | |
| - name: Upload aproxy Snap | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: snap | |
| path: aproxy*.snap | |
| - name: Install aproxy Snap | |
| run: | | |
| sudo snap install --dangerous aproxy_*_amd64.snap | |
| - name: Show aproxy Configuration | |
| run: | | |
| sudo snap get aproxy | |
| - name: Configure aproxy | |
| run: | | |
| sudo nft -f - << EOF | |
| define default-ip = $(ip route get $(ip route show 0.0.0.0/0 | grep -oP 'via \K\S+') | grep -oP 'src \K\S+') | |
| define private-ips = { 10.0.0.0/8, 127.0.0.1/8, 172.16.0.0/12, 192.168.0.0/16 } | |
| define aproxy-port = $(sudo snap get aproxy listen | cut -d ":" -f 2) | |
| table ip aproxy | |
| flush table ip aproxy | |
| table ip aproxy { | |
| chain prerouting { | |
| type nat hook prerouting priority dstnat; policy accept; | |
| ip daddr != \$private-ips tcp dport { 80, 443, 11371, 4242 } counter dnat to \$default-ip:\$aproxy-port | |
| } | |
| chain output { | |
| type nat hook output priority -100; policy accept; | |
| ip daddr != \$private-ips tcp dport { 80, 443, 11371, 4242 } counter dnat to \$default-ip:\$aproxy-port | |
| } | |
| } | |
| EOF | |
| - name: Start tcpdump | |
| run: | | |
| sudo tcpdump -i any -s 65535 -w capture.pcap & | |
| echo $! > tcpdump.pid | |
| - name: Test HTTP | |
| run: | | |
| timeout 60 curl --noproxy "*" http://example.com -svS -o /dev/null | |
| - name: Test HTTPS | |
| run: | | |
| timeout 60 curl --noproxy "*" https://example.com -svS -o /dev/null | |
| - name: Test HKP | |
| run: | | |
| timeout 60 gpg -vvv --keyserver hkp://keyserver.ubuntu.com --recv-keys E1DE584A8CCA52DC29550F18ABAC58F075A17EFA | |
| - name: Test TCP4 | |
| run: | | |
| sudo apt install -y socat | |
| timeout 60 socat /dev/null TCP4:tcpbin.com:4242 | |
| - name: Test No SNI | |
| run: | | |
| HOST_IP=$(dig +short ubuntu.com | head -n1) | |
| timeout 60 curl "https://$HOST_IP:443" -v || : | |
| sudo snap logs aproxy.aproxy | grep -Fq host=$HOST_IP:443 | |
| - name: Test Access Logs | |
| run: | | |
| sudo snap logs aproxy.aproxy | grep -Fq "example.com:80" | |
| sudo snap logs aproxy.aproxy | grep -Fq "example.com:443" | |
| sudo snap logs aproxy.aproxy | grep -Fq "keyserver.ubuntu.com:11371" | |
| sudo snap logs aproxy.aproxy | grep -Eq "[0-9.]+:4242" | |
| - name: Show Access Logs | |
| if: failure() | |
| run: | | |
| sudo snap logs aproxy.aproxy -n=all | |
| - name: Stop tcpdump | |
| if: failure() | |
| run: | | |
| PID=$(cat tcpdump.pid) | |
| if [ -n "$PID" ]; then | |
| sudo kill -2 "$PID" || true | |
| fi | |
| sleep 1 | |
| - name: Upload tcpdump capture | |
| if: failure() | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: tcpdump | |
| path: capture.pcap |