-
Notifications
You must be signed in to change notification settings - Fork 119
63 lines (62 loc) · 2.33 KB
/
Copy path_unit-tests-python.yml
File metadata and controls
63 lines (62 loc) · 2.33 KB
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
# SPDX-License-Identifier: Apache-2.0
# Copyright 2022 The HuggingFace Authors.
name: Launch Python unit tests
on:
workflow_call:
inputs:
working-directory:
required: true
type: string
poetry-args:
required: false
type: string
default: ""
env:
# required to get access to use a cached poetry venv in "/home/runner/.cache/pypoetry/virtualenvs"
POETRY_VIRTUALENVS_IN_PROJECT: false
mongo-port: "27017"
mongo-version: "6.0.9"
python-version: "3.12.11"
poetry-version: "2.1.4"
replicaset: "rs0"
jobs:
unit-tests:
defaults:
run:
shell: bash
working-directory: ${{ inputs.working-directory }}
runs-on: "ubuntu-latest"
steps:
- uses: actions/checkout@v6
- name: Install poetry
run: pipx install poetry==${{ env.poetry-version }}
- name: Use Python
uses: actions/setup-python@v6
with:
python-version: ${{ env.python-version }}
- name: Install packages
run: sudo apt update; sudo apt install -y ffmpeg libavcodec-extra libsndfile1
- name: Install dependencies
# "poetry env use" is required: https://github.com/actions/setup-python/issues/374#issuecomment-1088938718
run: |
poetry env use "${{ env.python-version }}"
poetry install ${{ inputs.poetry-args }}
- name: Launch mongo
env:
MONGO_PORT: ${{ env.mongo-port }}
MONGO_REPLICASET: ${{ env.replicaset }}
run: docker compose -f docker-compose-mongo.yml up -d --wait --wait-timeout 20
working-directory: ./tools
- name: Run unit tests
env:
CACHE_MONGO_URL: mongodb://localhost:${{ env.mongo-port }}
QUEUE_MONGO_URL: mongodb://localhost:${{ env.mongo-port }}
DATABASE_MIGRATIONS_MONGO_URL: mongodb://localhost:${{ env.mongo-port }}
CI_SPAWNING_TOKEN: ${{ secrets.CI_SPAWNING_TOKEN }}
ASSETS_STORAGE_ROOT: /tmp/assets
CACHED_ASSETS_STORAGE_ROOT: /tmp/cached-assets
S3_ACCESS_KEY_ID: ${{ secrets.S3_ACCESS_KEY_ID }}
S3_SECRET_ACCESS_KEY: ${{ secrets.S3_SECRET_ACCESS_KEY }}
CLOUDFRONT_KEY_PAIR_ID: "K3814DK2QUJ71H"
CLOUDFRONT_PRIVATE_KEY: ${{ secrets.CLOUDFRONT_PRIVATE_KEY }}
run: poetry run python -m pytest -s -m "not real_dataset and not integration"