Skip to content

Test speed ups

Test speed ups #663

Workflow file for this run

name: test
on:
push:
branches: [main]
pull_request:
jobs:
pre-commit:
runs-on: ubuntu-latest
if: github.event_name == 'pull_request' # pre-commit-ci/lite-action only runs here
strategy:
matrix:
python-version: ["3.12"] # Our min and max supported Python versions
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- uses: pre-commit/[email protected]
- uses: pre-commit-ci/[email protected]
if: always()
lint:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.10"] # Our min supported Python version
steps:
- uses: actions/checkout@v4
- name: Set up uv
run: |-
curl -LsSf https://astral.sh/uv/install.sh | sh
uv python pin ${{ matrix.python-version }}
- run: uv sync --python-preference=only-managed
- run: uv run refurb paperqa tests
test:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.12"] # Our min and max supported Python versions
steps:
- uses: actions/checkout@v4
- name: Configure systemd-resolved for DNS caching
run: |
sudo -s <<EOF
# Check if systemd-resolved is running
systemctl status systemd-resolved
# If it's not running, start it
systemctl start systemd-resolved
systemctl enable systemd-resolved
# Configure systemd-resolved to use caching
cat > /etc/systemd/resolved.conf <<EOT
[Resolve]
DNS=8.8.8.8 8.8.4.4
FallbackDNS=1.1.1.1 9.9.9.9
Cache=yes
DNSStubListener=yes
EOT
# Restart systemd-resolved to apply changes
systemctl restart systemd-resolved
# Update /etc/resolv.conf to use systemd-resolved
ln -sf /run/systemd/resolve/resolv.conf /etc/resolv.conf
EOF
- name: Set up uv
run: |-
curl -LsSf https://astral.sh/uv/install.sh | sh
uv python pin ${{ matrix.python-version }}
- run: uv sync --python-preference=only-managed
- uses: google-github-actions/auth@v2
with:
credentials_json: ${{ secrets.GOOGLE_CREDENTIALS }}
- run: uv run pytest -n auto
env:
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }}
SEMANTIC_SCHOLAR_API_KEY: ${{ secrets.SEMANTIC_SCHOLAR_API_KEY }}
CROSSREF_API_KEY: ${{ secrets.CROSSREF_API_KEY }}