-
-
Notifications
You must be signed in to change notification settings - Fork 133
135 lines (123 loc) · 3.93 KB
/
prtests.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
# SPDX-FileCopyrightText: 2023 Tazlin
#
# SPDX-License-Identifier: AGPL-3.0-or-later
name: AI-Horde PR tests
on:
pull_request_target:
branches:
- main
types:
- opened
- synchronize
paths:
- '**.py'
- '**.json'
- 'tox.ini'
- '.github/workflows/maintests.yml'
- '.github/workflows/prtests.yml'
- '.github/workflows/release.yml'
- '.pre-commit-config.yaml'
- 'bridgeData_template.yaml'
- 'requirements.txt'
- 'requirements.dev.txt'
- 'requirements.docs.txt'
jobs:
required-label-job:
runs-on: ubuntu-latest
permissions:
issues: write
pull-requests: write
steps:
- uses: mheap/github-action-required-labels@v5
with:
mode: exactly
count: 1
labels: "allow-ci"
runner-job:
runs-on: ubuntu-latest
# runs-on: self-hosted
needs: required-label-job
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
with:
ref: ${{ github.event.pull_request.head.sha }}
- 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
needs: required-label-job
steps:
- uses: actions/checkout@v3
with:
ref: ${{ github.event.pull_request.head.sha }}
- 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