1
0
mirror of https://github.com/LibreTranslate/LibreTranslate.git synced 2024-12-18 08:27:03 +02:00
LibreTranslate/.github/workflows/run-tests.yml

59 lines
1.5 KiB
YAML
Raw Normal View History

2021-02-09 16:21:53 +02:00
name: Run tests
# Run test at each push to main, if changes to package or tests files
on:
workflow_dispatch:
2022-04-02 21:02:17 +02:00
pull_request:
branches: [ main ]
2021-02-09 16:21:53 +02:00
push:
branches: [ main ]
paths:
2022-04-06 14:13:31 +02:00
- '*.py'
2021-02-09 16:21:53 +02:00
- 'requirements.txt'
- 'app/**'
- 'tests/**'
- '.github/workflows/run-tests.yml'
jobs:
2022-04-06 14:10:41 +02:00
tests_python:
2021-02-09 16:21:53 +02:00
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [3.7, 3.8, 3.9]
2021-02-09 16:21:53 +02:00
steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
2021-02-09 16:25:05 +02:00
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install pytest flake8
pip install .
2021-02-09 16:21:53 +02:00
- name: Check code style with flake8 (lint)
run: |
2022-04-06 14:10:41 +02:00
# warnings if there are Python syntax errors or undefined names
2021-02-09 16:21:53 +02:00
# (remove --exit-zero to fail when syntax error)
flake8 . --count --exit-zero --select=E9,F63,F7,F82 --show-source --statistics
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
- name: Test with pytest
2022-04-03 11:13:15 +02:00
run: pytest -v
2021-02-09 16:21:53 +02:00
2022-04-06 14:10:41 +02:00
test_docker_build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Docker build
2022-04-06 14:14:59 +02:00
run: docker build -t libretranslate .
2022-04-06 14:21:41 +02:00
- name: Docker build with some models
run: docker build -t libretranslate --build-args models=en,es .