init github-ci tests (#4) #3
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: Test | |
| on: | |
| push: | |
| branches: [latest, main] | |
| paths: | |
| - '**.go' | |
| - 'go.mod' | |
| - '.github/workflows/test.yml' | |
| pull_request: | |
| branches: [latest, main] | |
| paths: | |
| - '**.go' | |
| - 'go.mod' | |
| - '.github/workflows/test.yml' | |
| jobs: | |
| test: | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 3 | |
| steps: | |
| - uses: actions/checkout@v5 | |
| - uses: actions/setup-go@v6 | |
| with: | |
| go-version: '1.25.2' | |
| - name: Installing dependencies | |
| run: sudo apt install curl | |
| - name: Building proxy-forwarder | |
| run: bash scripts/build.sh | |
| - name: Build squid-container | |
| run: docker build -f test/Dockerfile -t squid test/ | |
| - name: Starting squid | |
| run: | | |
| docker run -d --volume /tmp/squid/:/var/log/squid/ squid | |
| # wait for init to finish | |
| sleep 5 | |
| - name: Configuring NAT | |
| run: | | |
| sudo nft list ruleset | |
| sudo nft 'add chain inet filter output_dnat { type nat hook output priority -100; }' | |
| sudo nft 'add rule inet filter output_dnat meta l4proto tcp ip daddr 1.1.1.1 dnat to 127.0.0.1:4128' | |
| sudo nft 'add rule inet filter output_dnat meta l4proto tcp ip6 daddr 2606:4700:4700::1111 dnat to [::1]:4129' | |
| - name: Run tests | |
| run: | | |
| sudo build/proxy-forwarder-linux-amd64 -P 4128 -F http://127.0.0.1:3128 > /tmp/fwd1.log & | |
| sudo build/proxy-forwarder-linux-amd64 -P 4129 -F http://[::1]:3128 > /tmp/fwd2.log & | |
| sudo bash scripts/test.sh |