Skip to content

Commit f7295ca

Browse files
committed
chore(gh): add tor setup to GitHub action
1 parent 7538b70 commit f7295ca

File tree

2 files changed

+24
-0
lines changed

2 files changed

+24
-0
lines changed

.github/data/torrc

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
CookieAuthentication 0
2+
SocksPort 9050
3+
ControlPort 9051

.github/workflows/php_ci.yml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,5 +34,26 @@ jobs:
3434
- name: Run PHPStan
3535
run: php vendor/bin/phpstan --memory-limit=-1
3636

37+
- name: Install Tor
38+
run: sudo apt-get update && sudo apt-get install -y tor
39+
40+
- name: Setup Tor with custom config file
41+
run: |
42+
sudo cp .github/data/torrc /etc/tor/torrc
43+
sudo systemctl restart tor
44+
45+
- name: Wait for Tor to build a circuit
46+
run: |
47+
for i in {1..10}; do
48+
if curl --socks5-hostname localhost:9050 --silent --fail http://check.torproject.org/; then
49+
echo "Tor circuit is ready"
50+
exit 0
51+
fi
52+
echo "Waiting for Tor to build a circuit..."
53+
sleep 5
54+
done
55+
echo "Tor failed to build a circuit in time"
56+
exit 1
57+
3758
- name: Run PHPUnit
3859
run: php vendor/bin/phpunit tests

0 commit comments

Comments
 (0)