mirror of
https://github.com/ArchiveBox/ArchiveBox.git
synced 2026-04-06 07:47:53 +10:00
184 lines
5.6 KiB
YAML
184 lines
5.6 KiB
YAML
name: Parallel Tests
|
|
|
|
on:
|
|
pull_request:
|
|
branches: [dev, main, master]
|
|
push:
|
|
branches: [dev]
|
|
|
|
env:
|
|
PYTHONIOENCODING: utf-8
|
|
PYTHONLEGACYWINDOWSSTDIO: utf-8
|
|
USE_COLOR: False
|
|
UV_NO_SOURCES: "1"
|
|
|
|
jobs:
|
|
discover-tests:
|
|
name: Discover test files
|
|
runs-on: ubuntu-22.04
|
|
outputs:
|
|
test-files: ${{ steps.set-matrix.outputs.test-files }}
|
|
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
with:
|
|
submodules: true
|
|
fetch-depth: 1
|
|
|
|
- name: Discover test files
|
|
id: set-matrix
|
|
run: |
|
|
# Find all main test files
|
|
all_tests=$(find archivebox/tests -maxdepth 1 -name "test_*.py" -type f | sort)
|
|
|
|
# Create JSON array with test file info
|
|
json_array="["
|
|
first=true
|
|
for test_file in $all_tests; do
|
|
if [ "$first" = true ]; then
|
|
first=false
|
|
else
|
|
json_array+=","
|
|
fi
|
|
|
|
# Extract a display name for the test
|
|
name="main/$(basename $test_file .py | sed 's/^test_//')"
|
|
|
|
json_array+="{\"path\":\"$test_file\",\"name\":\"$name\"}"
|
|
done
|
|
json_array+="]"
|
|
|
|
echo "test-files=$json_array" >> $GITHUB_OUTPUT
|
|
echo "Found $(echo $all_tests | wc -w) test files"
|
|
echo "$json_array" | jq '.'
|
|
|
|
run-tests:
|
|
name: ${{ matrix.test.name }}
|
|
runs-on: ubuntu-22.04
|
|
needs: discover-tests
|
|
env:
|
|
PYTHONPATH: ${{ github.workspace }}/abx-pkg:${{ github.workspace }}/abx-plugins:${{ github.workspace }}/abx-dl
|
|
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
test: ${{ fromJson(needs.discover-tests.outputs.test-files) }}
|
|
python: ["3.13"]
|
|
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
with:
|
|
submodules: true
|
|
fetch-depth: 1
|
|
|
|
- name: Clone abx-pkg
|
|
run: git clone --depth=1 https://github.com/ArchiveBox/abx-pkg.git abx-pkg
|
|
|
|
- name: Clone abx-plugins
|
|
run: git clone --depth=1 https://github.com/ArchiveBox/abx-plugins.git abx-plugins
|
|
|
|
- name: Clone abx-dl
|
|
run: git clone --depth=1 https://github.com/ArchiveBox/abx-dl.git abx-dl
|
|
|
|
- name: Set up Python ${{ matrix.python }}
|
|
uses: actions/setup-python@v4
|
|
with:
|
|
python-version: ${{ matrix.python }}
|
|
architecture: x64
|
|
|
|
- name: Install uv
|
|
uses: astral-sh/setup-uv@v4
|
|
with:
|
|
version: "latest"
|
|
|
|
- name: Set up Node JS
|
|
uses: actions/setup-node@v4
|
|
with:
|
|
node-version: 22
|
|
|
|
- name: Cache uv
|
|
uses: actions/cache@v3
|
|
with:
|
|
path: ~/.cache/uv
|
|
key: ${{ runner.os }}-${{ matrix.python }}-uv-${{ hashFiles('pyproject.toml', 'uv.lock') }}
|
|
restore-keys: |
|
|
${{ runner.os }}-${{ matrix.python }}-uv-
|
|
|
|
- uses: awalsh128/cache-apt-pkgs-action@latest
|
|
with:
|
|
packages: git ripgrep build-essential python3-dev python3-setuptools libssl-dev libldap2-dev libsasl2-dev zlib1g-dev libatomic1 python3-minimal gnupg2 curl wget python3-ldap python3-msgpack python3-mutagen python3-regex python3-pycryptodome procps
|
|
version: 1.1
|
|
|
|
- name: Install dependencies with uv
|
|
run: |
|
|
uv sync --dev --all-extras --no-sources
|
|
uv pip install -e ./abx-pkg -e ./abx-plugins[dev] -e ./abx-dl
|
|
|
|
- name: Run test - ${{ matrix.test.name }}
|
|
run: |
|
|
mkdir -p tests/out
|
|
uv run --no-sync --no-sources pytest -xvs "${{ matrix.test.path }}" --basetemp=tests/out --ignore=archivebox/pkgs
|
|
|
|
plugin-tests:
|
|
name: Plugin tests
|
|
runs-on: ubuntu-22.04
|
|
env:
|
|
PYTHONPATH: ${{ github.workspace }}/abx-pkg:${{ github.workspace }}/abx-plugins:${{ github.workspace }}/abx-dl
|
|
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
with:
|
|
submodules: true
|
|
fetch-depth: 1
|
|
|
|
- name: Clone abx-pkg
|
|
run: git clone --depth=1 https://github.com/ArchiveBox/abx-pkg.git abx-pkg
|
|
|
|
- name: Clone abx-plugins
|
|
run: git clone --depth=1 https://github.com/ArchiveBox/abx-plugins.git abx-plugins
|
|
|
|
- name: Clone abx-dl
|
|
run: git clone --depth=1 https://github.com/ArchiveBox/abx-dl.git abx-dl
|
|
|
|
- name: Set up Python 3.13
|
|
uses: actions/setup-python@v4
|
|
with:
|
|
python-version: "3.13"
|
|
architecture: x64
|
|
|
|
- name: Install uv
|
|
uses: astral-sh/setup-uv@v4
|
|
with:
|
|
version: "latest"
|
|
|
|
- name: Set up Node JS
|
|
uses: actions/setup-node@v4
|
|
with:
|
|
node-version: 22
|
|
|
|
- name: Cache uv
|
|
uses: actions/cache@v3
|
|
with:
|
|
path: ~/.cache/uv
|
|
key: ${{ runner.os }}-3.13-uv-${{ hashFiles('pyproject.toml', 'uv.lock') }}
|
|
restore-keys: |
|
|
${{ runner.os }}-3.13-uv-
|
|
|
|
- uses: awalsh128/cache-apt-pkgs-action@latest
|
|
with:
|
|
packages: git ripgrep build-essential python3-dev python3-setuptools libssl-dev libldap2-dev libsasl2-dev zlib1g-dev libatomic1 python3-minimal gnupg2 curl wget python3-ldap python3-msgpack python3-mutagen python3-regex python3-pycryptodome procps
|
|
version: 1.1
|
|
|
|
- name: Install dependencies with uv
|
|
run: |
|
|
uv sync --dev --all-extras --no-sources
|
|
uv pip install -e ./abx-pkg -e ./abx-plugins[dev] -e ./abx-dl
|
|
|
|
- name: Run plugin tests
|
|
env:
|
|
ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }}
|
|
TWOCAPTCHA_API_KEY: ${{ secrets.TWOCAPTCHA_API_KEY }}
|
|
API_KEY_2CAPTCHA: ${{ secrets.TWOCAPTCHA_API_KEY }}
|
|
run: |
|
|
uv run --no-sync --no-sources bash ./bin/test_plugins.sh --no-coverage
|