Skip to content

Checker Python

Checker Python #4000

name: Checker Python
on:
push:
paths:
- 'src/**/*.py'
- 'data/**/*.py'
- '.github/workflows/checker-python.yml'
- 'requirements*'
- 'setup*'
- 'Taskfile*'
workflow_dispatch:
inputs:
max:
description: 'The maximum proxies to be checked.'
required: true
default: '100'
type: string
workflow_call:
inputs:
max:
description: 'The maximum proxies to be checked.'
required: true
default: '100'
type: string
secrets:
ACCESS_TOKEN:
required: true
schedule:
- cron: '0 */3 * * *' # Every 3 hours
concurrency:
group: python-proxy-checker
cancel-in-progress: false
jobs:
build:
if: contains(github.repository, 'php-proxy-hunter')
runs-on: windows-latest
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
steps:
- 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: Setup Python
uses: actions/setup-python@v6
with:
python-version: '3.11'
- 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: Get pip Cache Directory
id: pip-cache
run: echo "pip_cache_dir=$(pip cache dir)" >> $GITHUB_ENV
- name: Cache Dependencies and Outputs
uses: actions/cache@v4
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 }}-python-${{ hashFiles('.husky/hash.txt') }}
restore-keys: |
${{ runner.os }}-python-${{ hashFiles('.husky/hash.txt') }}
${{ runner.os }}-python-
${{ runner.os }}-
- name: Restore Non-cached Files
run: git restore *.txt
- 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
- name: Install Node.js Dependencies
shell: bash
run: task install-nodejs
- name: Install Python Dependencies (if cache missed)
if: steps.cache.outputs.cache-hit != 'true'
shell: bash
run: task install-python
- name: Initialize Project Scripts
id: php-github-actions-init
env:
GITHUB_OUTPUT: $GITHUB_OUTPUT
run: python3 github-actions-init.py
- name: Download Required Files
run: python3 src/geoPlugin.py
- name: Cleanup Project
run: python3 cleaner.py
- name: Fetch Proxies
run: python3 proxyFetcher.py
- name: Check Proxies
shell: bash
run: |
MAX_INPUT="${{ inputs.max || github.event.inputs.max || '100' }}"
echo "Checking max $MAX_INPUT proxies"
python3 proxyCheckerReal.py --max="$MAX_INPUT"
- name: Upload Proxies
run: python3 proxyWorking.py