Skip to content

Checker PHP

Checker PHP #4077

Workflow file for this run

name: Checker PHP
on:
push:
paths:
- 'artisan/**/*.php'
- 'data/**/*.php'
- 'src/PhpProxyHunter/**/*.php'
- '.github/workflows/checker-php.yml'
- 'composer.json'
- 'setup*'
- 'Taskfile*'
schedule:
- cron: '0 */3 * * *' # Every 3 hours
workflow_dispatch:
inputs:
max:
description: 'Maximum proxies to be checked.'
required: true
default: '100'
type: string
workflow_call:
inputs:
max:
description: 'Maximum proxies to be checked.'
required: true
default: '100'
type: string
secrets:
ACCESS_TOKEN:
required: true
concurrency:
group: php-proxy-checker
cancel-in-progress: false
jobs:
build:
if: contains(github.repository, 'php-proxy-hunter')
runs-on: windows-latest
permissions: read-all
env:
PIP_CACHE_DIR: ${{ github.workspace }}/project/tmp/pip
NUITKA_CACHE_DIR: ${{ github.workspace }}/project/tmp/nuitka-cache
NODE_OPTIONS: --max_old_space_size=4096
YARN_ENABLE_IMMUTABLE_INSTALLS: false
ACCESS_TOKEN: ${{ secrets.ACCESS_TOKEN || secrets.GITHUB_TOKEN }}
GH_TOKEN: ${{ secrets.ACCESS_TOKEN || secrets.GITHUB_TOKEN }}
YARN_CHECKSUM_BEHAVIOR: update
defaults:
run:
shell: bash
steps:
# Set timezone
- name: Set Timezone
uses: szenius/[email protected]
with:
timezoneLinux: Asia/Jakarta
# Checkout project and data repositories
- name: Checkout Main Repository
uses: actions/checkout@v5
with:
repository: dimaslanjaka/php-proxy-hunter
ref: master
token: ${{ secrets.ACCESS_TOKEN || secrets.GITHUB_TOKEN }}
lfs: true
- name: Checkout Data Repository
uses: actions/checkout@v5
with:
repository: dimaslanjaka/data
path: public
token: ${{ secrets.ACCESS_TOKEN || secrets.GITHUB_TOKEN }}
lfs: true
- name: Setup Node.js
uses: actions/setup-node@v5
with:
node-version: 22.x
cache: 'yarn'
cache-dependency-path: 'package.json'
- name: Enable Corepack
run: corepack enable
- name: Update Git Submodules and Install Global Node Tools
run: |
echo "Initializing submodules..."
git submodule update --init --recursive
npm install -g rimraf binary-collections@https://raw.githubusercontent.com/dimaslanjaka/bin/master/releases/bin.tgz
npx rimraf .git/modules
npx submodule-install
- name: Setup Python
uses: actions/setup-python@v6
with:
python-version: 3.11
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: 7.4
extensions: mbstring, intl, pecl_http, curl, pdo_mysql, pdo_sqlite, dom, zip, fileinfo, json, redis
ini-values: post_max_size=256M, max_execution_time=180
tools: php-cs-fixer, phpunit, composer:v2
coverage: none
env:
fail-fast: true
# Cache dependencies and outputs
- name: Cache Dependencies and Outputs
uses: actions/cache@v4
id: cache
with:
path: |
~/.cache/pip
**/dist/**
**/tmp/**
src/*.sqlite*
src/*.mmdb
**/node_modules/**
.yarn/caches/
.yarn/*.gz
./venv/
${{ env.PIP_CACHE_DIR }}
${{ env.NUITKA_CACHE_DIR }}
*.lock
*.txt
package-lock.json
assets/proxies/
vendor/
${{ env.USERPROFILE }}\AppData\Local\Nuitka\Nuitka\Cache
$HOME/AppData/Local/Nuitka/Nuitka/Cache
config/
.cache/
working.json
key: ${{ runner.os }}-php-${{ hashFiles('.husky/hash.txt') }}
restore-keys: |
${{ runner.os }}-php-${{ hashFiles('.husky/hash.txt') }}
${{ runner.os }}-php-
${{ runner.os }}-nuitka-
${{ runner.os }}-python-
${{ runner.os }}-
# Install required tools
- name: Install Required Tools
run: |
npm install -g @go-task/cli
python3 -m ensurepip --upgrade
python3 -m pip install --upgrade pip setuptools wheel
python3 -m pip install requests
# Install Python dependencies
- name: Install Python Dependencies
if: steps.cache.outputs.cache-hit != 'true'
run: task install-python
# Install NodeJS dependencies
- name: Install Node.js Dependencies
shell: bash
run: task install-nodejs
# Install PHP dependencies
- name: Install PHP Dependencies
if: steps.cache.outputs.cache-hit != 'true'
shell: bash
env:
COMPOSER_AUTH: '{"github-oauth": {"github.com": "${{ secrets.ACCESS_TOKEN || secrets.GITHUB_TOKEN }}"}}'
run: |
node scripts/composer-installer.js
php bin/composer.phar config --global github-oauth.github.com "${{ secrets.ACCESS_TOKEN || secrets.GITHUB_TOKEN }}"
# If vendor folder is missing or empty, remove composer.lock and re-install
if [ ! -d vendor ] || [ -z "$(ls -A vendor 2>/dev/null)" ]; then
rm -f composer.lock
php bin/composer.phar install --prefer-dist --no-progress --no-interaction --optimize-autoloader;
elif [ ! -f composer.lock ]; then
php bin/composer.phar install --prefer-dist --no-progress --no-interaction --optimize-autoloader;
fi
# Initialize scripts
- name: Initialize Project Scripts
env:
GITHUB_OUTPUT: $GITHUB_OUTPUT
run: |
python github-actions-init.py
php github-actions-init.php
# Download & process data
- name: Download Required Files
run: python3 src/geoPlugin.py
- name: Cleanup Project
run: php artisan/cleaner.php
- name: Fetch Proxies
run: php artisan/proxyFetcher.php
- name: Index Proxies
run: php artisan/proxyCollector.php
- name: Check Proxies
run: php proxyCheckerParallel.php
- name: Upload Proxies
run: python3 proxyWorking.py