ci/cd Install firefox from apt instead of snap + fix antibot core tests for linux

This commit is contained in:
Théophile Diot 2023-09-19 09:45:17 +02:00
parent 480c680f19
commit a0516f773f
No known key found for this signature in database
GPG Key ID: 248FEA4BAE400D06
2 changed files with 15 additions and 7 deletions

View File

@ -24,6 +24,12 @@ jobs:
cache: "pip"
- name: Install Firefox and dependencies
run: |
sudo add-apt-repository -y ppa:mozillateam/ppa
echo '
Package: *
Pin: release o=LP-PPA-mozillateam
Pin-Priority: 1001
' | sudo tee /etc/apt/preferences.d/mozilla-firefox
sudo apt update
sudo apt install -y firefox nodejs curl grep zip wget
- name: Download geckodriver
@ -70,7 +76,7 @@ jobs:
echo "SERVER_NAME=www.example.com" | sudo tee -a /etc/bunkerweb/variables.env
echo "HTTP_PORT=80" | sudo tee -a /etc/bunkerweb/variables.env
echo "HTTPS_PORT=443" | sudo tee -a /etc/bunkerweb/variables.env
echo "DNS_RESOLVERS=9.9.9.9 8.8.8.8 8.8.4.4" | sudo tee -a /etc/bunkerweb/variables.env
echo 'DNS_RESOLVERS="9.9.9.9 8.8.8.8 8.8.4.4"' | sudo tee -a /etc/bunkerweb/variables.env
echo "USE_BUNKERNET=no" | sudo tee -a /etc/bunkerweb/variables.env
echo "USE_BLACKLIST=no" | sudo tee -a /etc/bunkerweb/variables.env
sudo chown nginx:nginx /etc/bunkerweb/variables.env

View File

@ -36,10 +36,10 @@ cleanup_stack () {
if [[ $end -eq 1 || $exit_code = 1 ]] || [[ $end -eq 0 && $exit_code = 0 ]] && [ $manual = 0 ] ; then
if [ "$integration" == "docker" ] ; then
find . -type f -name 'docker-compose.*' -exec sed -i 's@USE_ANTIBOT: ".*"$@USE_ANTIBOT: "no"@' {} \;
find . -type f -name 'docker-compose.*' -exec sed -i 's@ANTIBOT_URI: "/custom"@ANTIBOT_URI: "/challenge"@' {} \;
find . -type f -name 'docker-compose.*' -exec sed -i 's@ANTIBOT_URI: ".*"@ANTIBOT_URI: "/challenge"@' {} \;
else
sed -i 's@USE_ANTIBOT: ".*"$@USE_ANTIBOT: "no"@' /etc/bunkerweb/variables.env
sed -i 's@ANTIBOT_URI: "/custom"@ANTIBOT_URI: "/challenge"@' /etc/bunkerweb/variables.env
sed -i 's@USE_ANTIBOT=.*$@USE_ANTIBOT=no@' /etc/bunkerweb/variables.env
sed -i 's@ANTIBOT_URI=.*@ANTIBOT_URI=/challenge@' /etc/bunkerweb/variables.env
fi
if [[ $end -eq 1 && $exit_code = 0 ]] ; then
return
@ -72,16 +72,16 @@ do
elif [ "$test" = "endpoint" ] ; then
echo "🤖 Running tests where antibot is on a different endpoint ..."
if [ "$integration" == "docker" ] ; then
find . -type f -name 'docker-compose.*' -exec sed -i 's@ANTIBOT_URI: "/challenge"@ANTIBOT_URI: "/custom"@' {} \;
find . -type f -name 'docker-compose.*' -exec sed -i 's@ANTIBOT_URI: ".*"@ANTIBOT_URI: "/custom"@' {} \;
else
sed -i 's@ANTIBOT_URI: "/challenge"@ANTIBOT_URI: "/custom"@' /etc/bunkerweb/variables.env
sed -i 's@ANTIBOT_URI=.*@ANTIBOT_URI=/custom@' /etc/bunkerweb/variables.env
fi
elif [ "$test" != "deactivated" ] ; then
echo "🤖 Running tests with antibot \"$test\" ..."
if [ "$integration" == "docker" ] ; then
find . -type f -name 'docker-compose.*' -exec sed -i 's@USE_ANTIBOT: ".*"$@USE_ANTIBOT: "'"${test}"'"@' {} \;
else
sed -i 's@USE_ANTIBOT: ".*"$@USE_ANTIBOT: "'"${test}"'"@' /etc/bunkerweb/variables.env
sed -i 's@USE_ANTIBOT=.*$@USE_ANTIBOT='"${test}"'@' /etc/bunkerweb/variables.env
fi
fi
@ -156,7 +156,9 @@ do
if [ "$integration" == "docker" ] ; then
docker compose -f docker-compose.test.yml up --abort-on-container-exit --exit-code-from tests
else
set -a
source /etc/bunkerweb/variables.env
set +a
python3 main.py
fi