ci: fix reuse: #89
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# SPDX-FileCopyrightText: 2023 Tazlin | ||
# | ||
# SPDX-License-Identifier: AGPL-3.0-or-later | ||
name: AI-Horde main tests | ||
on: | ||
push: | ||
branches: | ||
- main | ||
paths: | ||
- '**.py' | ||
- '**.json' | ||
- 'tox.ini' | ||
- '.github/workflows/maintests.yml' | ||
- '.github/workflows/prtests.yml' | ||
- '.github/workflows/release.yml' | ||
jobs: | ||
runner-job: | ||
runs-on: ubuntu-latest | ||
# runs-on: self-hosted | ||
env: | ||
POSTGRES_URL: "localhost:5432/postgres" | ||
PGUSER: "postgres" | ||
PGPASSWORD: "postgres" | ||
REDIS_IP: "localhost" | ||
REDIS_SERVERS: '["localhost"]' | ||
USE_SQLITE: 0 | ||
ADMINS: '["test_user#1"]' | ||
R2_TRANSIENT_ACCOUNT: ${{ secrets.R2_TRANSIENT_ACCOUNT }} | ||
R2_PERMANENT_ACCOUNT: ${{ secrets.R2_PERMANENT_ACCOUNT }} | ||
SHARED_AWS_ACCESS_ID: ${{ secrets.SHARED_AWS_ACCESS_ID }} | ||
SHARED_AWS_ACCESS_KEY: ${{ secrets.SHARED_AWS_ACCESS_KEY }} | ||
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} | ||
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | ||
KUDOS_TRUST_THRESHOLD: 100 | ||
AI_HORDE_DEV_URL: "http://localhost:7001/api/" # For horde_sdk tests | ||
services: | ||
redis: | ||
image: redis | ||
options: >- | ||
--health-cmd "redis-cli ping" | ||
--health-interval 10s | ||
--health-timeout 5s | ||
--health-retries 5 | ||
ports: | ||
- 6379:6379 | ||
ai-horde-postgres: | ||
image: ghcr.io/haidra-org/ai-horde-postgres:latest | ||
env: | ||
POSTGRES_USER: postgres | ||
POSTGRES_PASSWORD: postgres | ||
POSTGRES_DB: postgres | ||
POSTGRES_HOST_AUTH_METHOD: trust | ||
ports: | ||
- 5432:5432 | ||
options: >- | ||
--health-cmd pg_isready | ||
--health-interval 10s | ||
--health-timeout 5s | ||
--health-retries 5 | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: actions/setup-python@v4 | ||
with: | ||
python-version: '3.10' | ||
# cache: 'pip' | ||
- run: python -m pip install --upgrade pip wheel setuptools | ||
- name: Install and run tests | ||
run: | | ||
python -m pip install -r requirements.txt -r requirements.dev.txt | ||
python server.py -vvvvi --horde stable & | ||
sleep 5 | ||
curl -X POST --data-raw 'username=test_user' http://localhost:7001/register | grep -Po '<p style="background-color:darkorange;">\K.*(?=<\/p>)' > tests/apikey.txt | ||
export AI_HORDE_DEV_APIKEY=$(cat tests/apikey.txt) | ||
pytest tests/ -s | ||
python -m pip download --no-deps --no-binary :all: horde_sdk | ||
tar -xvf horde_sdk-*.tar.gz | ||
cd horde_sdk**/ | ||
pytest tests/ --ignore-glob=*api_calls.py --ignore-glob=*test_model_meta.py -s | ||
lint-check-job: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: actions/setup-python@v4 | ||
with: | ||
python-version: '3.10' | ||
# cache: 'pip' | ||
- run: python -m pip install --upgrade pip wheel setuptools | ||
- name: Install and run lint/format checkers | ||
run: | | ||
python -m pip install -r requirements.dev.txt | ||
black --check . | ||
ruff . | ||
reuse-lint-job: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: REUSE Compliance Check | ||
uses: fsfe/reuse-action@v4 |