-
Notifications
You must be signed in to change notification settings - Fork 191
164 lines (143 loc) · 5.31 KB
/
test.yaml
File metadata and controls
164 lines (143 loc) · 5.31 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
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
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
on:
workflow_call:
inputs:
working-directory:
required: true
type: string
description: "From which folder this pipeline executes"
upload_coverage:
description: 'Wheather to upload coverage report to codecov or not'
required: false
type: boolean
default: true
extra_poetry:
description: 'Extra poetry commands to run'
required: false
type: string
default: "--extras all --with test"
env:
POETRY_VERSION: "1.8.4"
jobs:
initial-job: # Run initial job to create model cache
defaults:
run:
working-directory: ${{ inputs.working-directory }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest] # macos-latest
python-version:
- "3.12"
coverage_tests: ["unit_test", "end_to_end"]
runs-on: ${{ matrix.os }}
name: Py${{ matrix.python-version }}-${{ matrix.os }}-${{ matrix.coverage_tests }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Free Disk Space
uses: "./.github/actions/disk_cleanup"
if: runner.os == 'Linux'
with:
tool-cache: false
android: true
dotnet: true
haskell: true
large-packages: true
docker-images: false
swap-storage: false
- name: Set up Python ${{ matrix.python-version }} + Poetry ${{ env.POETRY_VERSION }}
uses: "./.github/actions/poetry_setup"
with:
python-version: ${{ matrix.python-version }}
poetry-version: ${{ env.POETRY_VERSION }}
working-directory: ${{ inputs.working-directory }}
cache-key: ${{ inputs.working-directory }}-test-${{ matrix.coverage_tests }}
- name: Install dependencies from local
# only if source is local
shell: bash
run: poetry install ${{ inputs.extra_poetry }}
- name: Cache HuggingFace models
id: cache-models
uses: actions/cache@v4
with:
path: |
~/.cache/huggingface/hub
key: hf-models-${{ inputs.working-directory }}-test-${{ matrix.coverage_tests }}
- name: Run Pytest Coverage
if: ${{ inputs.working-directory == 'libs/infinity_emb' }}
run: |
poetry run coverage run -m --source ./infinity_emb pytest tests/${{ matrix.coverage_tests }}
poetry run coverage xml
env:
HF_TOKEN: ${{ secrets.HFTOKEN_NOPERMISSIONS }}
- name: Run Pytest Coverage w/o infinity
if: ${{ inputs.working-directory != 'libs/infinity_emb' }}
run:
make coverage
- name: Upload coverage Report to Codecov for python 3.11
if: ${{ matrix.python-version == '3.11' && inputs.upload_coverage == true && matrix.os == 'ubuntu-latest'}}
uses: codecov/codecov-action@v4
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
testing-job: # Run the other jobs to use cache from initial job
needs: initial-job
defaults:
run:
working-directory: ${{ inputs.working-directory }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest] # macos-latest
python-version:
- "3.9"
- "3.10"
- "3.11"
coverage_tests: ["unit_test", "end_to_end"]
runs-on: ${{ matrix.os }}
name: Py${{ matrix.python-version }}-${{ matrix.os }}-${{ matrix.coverage_tests }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Free Disk Space
uses: "./.github/actions/disk_cleanup"
if: runner.os == 'Linux'
with:
tool-cache: false
android: true
dotnet: true
haskell: true
large-packages: false
docker-images: false
swap-storage: false
- name: Set up Python ${{ matrix.python-version }} + Poetry ${{ env.POETRY_VERSION }}
uses: "./.github/actions/poetry_setup"
with:
python-version: ${{ matrix.python-version }}
poetry-version: ${{ env.POETRY_VERSION }}
working-directory: ${{ inputs.working-directory }}
cache-key: ${{ inputs.working-directory }}-test-${{ matrix.coverage_tests }}
- name: Install dependencies from local
# only if source is local
shell: bash
run: poetry install ${{ inputs.extra_poetry }}
- name: Cached HuggingFace models
id: cache-models
uses: actions/cache@v4
with:
path: |
~/.cache/huggingface/hub
key: hf-models-${{ inputs.working-directory }}-test-${{ matrix.coverage_tests }}
- name: Run Pytest Coverage
if: ${{ inputs.working-directory == 'libs/infinity_emb' }}
run: |
poetry run coverage run -m --source ./infinity_emb pytest tests/${{ matrix.coverage_tests }}
poetry run coverage xml
- name: Run Pytest Coverage w/o infinity
if: ${{ inputs.working-directory != 'libs/infinity_emb' }}
run:
make coverage
- name: Upload coverage Report to Codecov for python 3.11
if: ${{ matrix.python-version == '3.11' && inputs.upload_coverage == true && matrix.os == 'ubuntu-latest'}}
uses: codecov/codecov-action@v4
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}