2021-02-09 15:21:53 +01:00
|
|
|
name: Run tests
|
|
|
|
# Run test at each push to main, if changes to package or tests files
|
|
|
|
on:
|
|
|
|
workflow_dispatch:
|
2023-07-10 08:11:51 +02:00
|
|
|
workflow_call:
|
2022-04-02 21:02:17 +02:00
|
|
|
pull_request:
|
|
|
|
branches: [ main ]
|
2021-02-09 15:21:53 +01:00
|
|
|
push:
|
|
|
|
branches: [ main ]
|
|
|
|
paths:
|
2022-04-06 14:13:31 +02:00
|
|
|
- '*.py'
|
2021-02-09 15:21:53 +01:00
|
|
|
- 'requirements.txt'
|
2022-12-30 00:44:53 +01:00
|
|
|
- 'libretranslate/**'
|
2021-02-09 15:21:53 +01:00
|
|
|
- '.github/workflows/run-tests.yml'
|
|
|
|
|
|
|
|
jobs:
|
|
|
|
|
2022-04-06 14:10:41 +02:00
|
|
|
tests_python:
|
2021-02-09 15:21:53 +01:00
|
|
|
runs-on: ubuntu-latest
|
|
|
|
strategy:
|
|
|
|
matrix:
|
2023-01-12 14:44:46 +01:00
|
|
|
python-version: ['3.8', '3.9', '3.10']
|
2021-02-09 15:21:53 +01:00
|
|
|
|
|
|
|
steps:
|
2023-07-09 11:43:58 +02:00
|
|
|
- uses: actions/checkout@v3
|
2021-02-09 15:21:53 +01:00
|
|
|
- name: Set up Python ${{ matrix.python-version }}
|
2023-07-09 11:43:58 +02:00
|
|
|
uses: actions/setup-python@v4
|
2021-02-09 15:21:53 +01:00
|
|
|
with:
|
|
|
|
python-version: ${{ matrix.python-version }}
|
|
|
|
|
2021-02-09 15:25:05 +01:00
|
|
|
- name: Install dependencies
|
|
|
|
run: |
|
2023-07-10 08:11:51 +02:00
|
|
|
pipx install hatch
|
|
|
|
hatch run locales
|
2021-02-09 15:21:53 +01:00
|
|
|
|
|
|
|
- name: Test with pytest
|
2023-07-10 08:11:51 +02:00
|
|
|
run: hatch run test
|
2021-02-09 15:21:53 +01:00
|
|
|
|
2022-04-06 14:10:41 +02:00
|
|
|
|
|
|
|
test_docker_build:
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
|
|
|
|
steps:
|
2023-07-09 11:43:58 +02:00
|
|
|
- uses: actions/checkout@v3
|
2022-04-06 14:10:41 +02:00
|
|
|
- name: Docker build
|
2023-01-13 16:24:56 +01:00
|
|
|
run: docker build -f docker/Dockerfile -t libretranslate .
|
2022-04-06 14:21:41 +02:00
|
|
|
|
|
|
|
- name: Docker build with some models
|
2023-01-13 16:24:56 +01:00
|
|
|
run: docker build -f docker/Dockerfile -t libretranslate --build-arg models=en,es .
|