54 lines
1.6 KiB
YAML
54 lines
1.6 KiB
YAML
name: AI Service CI/CD
|
|
|
|
on:
|
|
push:
|
|
branches: [production]
|
|
paths:
|
|
- '**'
|
|
- '.gitea/workflows/ai.yml'
|
|
|
|
pull_request:
|
|
branches: [production]
|
|
paths:
|
|
- '**'
|
|
- '.gitea/workflows/ai.yml'
|
|
|
|
jobs:
|
|
test:
|
|
name: Lint & Test
|
|
runs-on: self-hosted
|
|
|
|
steps:
|
|
- name: Setup Ubuntu apt mirrors
|
|
run: |
|
|
tee /etc/apt/sources.list > /dev/null <<'EOF'
|
|
deb [trusted=yes] https://mirror2.chabokan.net/ubuntu jammy main restricted universe multiverse
|
|
deb [trusted=yes] https://mirror2.chabokan.net/ubuntu jammy-updates main restricted universe multiverse
|
|
deb [trusted=yes] https://mirror2.chabokan.net/ubuntu jammy-security main restricted universe multiverse
|
|
EOF
|
|
apt-get update
|
|
|
|
- name: Install Python
|
|
run: |
|
|
apt-get install -y python3 python3-pip python3-venv git
|
|
|
|
- name: Setup Python pip mirrors
|
|
run: |
|
|
pip3 config --user set global.index-url https://package-mirror.liara.ir/repository/pypi/simple
|
|
pip3 config --user set global.extra-index-url https://mirror.cdn.ir/repository/pypi/simple
|
|
pip3 config --user set global.trusted-host "package-mirror.liara.ir mirror.cdn.ir mirror2.chabokan.net"
|
|
|
|
- name: Install dependencies
|
|
run: |
|
|
python3 -m pip install --upgrade pip
|
|
pip3 install -r requirements.txt
|
|
pip3 install pytest flake8
|
|
|
|
- name: Run lint
|
|
run: |
|
|
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
|
|
|
|
- name: Run tests
|
|
run: |
|
|
pytest -q
|