|
4 | 4 | pull_request: |
5 | 5 | paths: |
6 | 6 | - "tesseract_core/**" |
7 | | - - "tests/**" |
| 7 | + - "tests/endtoend_tests/**" |
8 | 8 | - "demo/**" |
9 | 9 | - "examples/**" |
| 10 | + - ".github/workflows/run_e2e_tests.yml" |
| 11 | + - "production.uv.lock" |
10 | 12 |
|
11 | 13 | push: |
12 | 14 | branches: |
|
16 | 18 | - "tests/endtoend_tests/**" |
17 | 19 | - "demo/**" |
18 | 20 | - "examples/**" |
| 21 | + - ".github/workflows/run_e2e_tests.yml" |
19 | 22 | - "production.uv.lock" |
20 | | - - ".github/workflows/run_tests.yml" |
21 | 23 |
|
22 | 24 | concurrency: |
23 | 25 | group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} |
24 | 26 | cancel-in-progress: true |
25 | 27 |
|
26 | 28 | jobs: |
27 | | - tests-base: |
28 | | - strategy: |
29 | | - matrix: |
30 | | - os: [ubuntu-latest, windows-latest, macos-latest] |
31 | | - |
32 | | - # test with oldest and latest supported Python versions |
33 | | - # NOTE: If bumping the minimum Python version here, also do it in |
34 | | - # ruff.toml, setup.py and other CI files as well. |
35 | | - python-version: ["3.10", "3.12"] |
36 | | - runtime-deps: ["latest"] |
37 | | - |
38 | | - include: |
39 | | - - os: ubuntu-latest |
40 | | - python-version: "3.12" |
41 | | - runtime-deps: "oldest" |
42 | | - |
43 | | - fail-fast: false |
44 | | - |
45 | | - runs-on: ${{ matrix.os }} |
46 | | - |
47 | | - steps: |
48 | | - - name: Set up Git repository |
49 | | - uses: actions/checkout@v4 |
50 | | - |
51 | | - - name: Set up WSL (Windows) |
52 | | - uses: Vampire/setup-wsl@v5 |
53 | | - if: runner.os == 'Windows' |
54 | | - with: |
55 | | - distribution: Ubuntu-24.04 |
56 | | - |
57 | | - - name: Set up Python |
58 | | - if: runner.os != 'Windows' |
59 | | - uses: actions/setup-python@v5 |
60 | | - with: |
61 | | - python-version: ${{ matrix.python-version }} |
62 | | - |
63 | | - - name: Set up Python (Windows) |
64 | | - if: runner.os == 'Windows' |
65 | | - shell: wsl-bash {0} |
66 | | - run: | |
67 | | - python_version=${{ matrix.python-version }} |
68 | | - if [ $python_version == "3.12" ]; then |
69 | | - # Python 3.12 is the default `python3` in Ubuntu 24.04 |
70 | | - python_version="3" |
71 | | - fi |
72 | | -
|
73 | | - export DEBIAN_FRONTEND=noninteractive |
74 | | - sudo apt-get update |
75 | | - sudo apt-get install -y software-properties-common gnupg2 |
76 | | - sudo add-apt-repository ppa:deadsnakes/ppa |
77 | | - sudo apt-get install -y python3-pip python${python_version} python${python_version}-venv |
78 | | -
|
79 | | - python${python_version} -m venv ~/venv |
80 | | -
|
81 | | - export PATH="$HOME/venv/bin:$PATH" |
82 | | - python -m pip install --upgrade pip |
83 | | -
|
84 | | - - name: Set up uv |
85 | | - uses: astral-sh/setup-uv@v6 |
86 | | - with: |
87 | | - enable-cache: true |
88 | | - |
89 | | - - name: Restore UV environment |
90 | | - run: cp production.uv.lock uv.lock |
91 | | - |
92 | | - - name: Install package |
93 | | - if: runner.os != 'Windows' |
94 | | - run: | |
95 | | - uv sync --extra dev --frozen |
96 | | -
|
97 | | - if [ "${{ matrix.runtime-deps }}" == "oldest" ]; then |
98 | | - # replace >= with == in pyproject.toml to install oldest runtime deps |
99 | | - sed -i 's/>=/==/g' ./tesseract_core/runtime/meta/pyproject.toml |
100 | | - # roll back changes to requires-python |
101 | | - sed -i 's/requires-python\s*=\s*\"==/requires-python = \">=/g' ./tesseract_core/runtime/meta/pyproject.toml |
102 | | - uv pip install -e .[runtime] |
103 | | - fi |
104 | | -
|
105 | | - - name: Install package (Windows) |
106 | | - if: runner.os == 'Windows' |
107 | | - shell: wsl-bash {0} |
108 | | - run: | |
109 | | - export PATH="$HOME/venv/bin:$PATH" |
110 | | -
|
111 | | - pip install uv |
112 | | - uv sync --extra dev --frozen |
113 | | -
|
114 | | - if [ "${{ matrix.runtime-deps }}" == "oldest" ]; then |
115 | | - # replace >= with == in pyproject.toml to install oldest runtime deps |
116 | | - sed -i 's/>=/==/g' ./tesseract_core/runtime/meta/pyproject.toml |
117 | | - # roll back changes to requires-python |
118 | | - sed -i 's/requires-python\s*=\s*\"==/requires-python = \">=/g' ./tesseract_core/runtime/meta/pyproject.toml |
119 | | - uv pip install -e .[runtime] |
120 | | - fi |
121 | | -
|
122 | | - - name: Run test suite |
123 | | - if: runner.os != 'Windows' |
124 | | - run: | |
125 | | - uv run --no-sync pytest \ |
126 | | - --skip-endtoend \ |
127 | | - --cov-report=term-missing:skip-covered \ |
128 | | - --cov-report=xml:coverage.xml \ |
129 | | - --cov=tesseract_core |
130 | | -
|
131 | | - - name: Run test suite (Windows) |
132 | | - if: runner.os == 'Windows' |
133 | | - shell: wsl-bash {0} |
134 | | - run: | |
135 | | - export PATH="$HOME/venv/bin:$PATH" |
136 | | - uv run --no-sync pytest \ |
137 | | - --skip-endtoend \ |
138 | | - --cov-report=term-missing:skip-covered \ |
139 | | - --cov-report=xml:coverage.xml \ |
140 | | - --cov=tesseract_core |
141 | | -
|
142 | | - - name: Upload coverage reports to Codecov |
143 | | - uses: codecov/codecov-action@v5.4.3 |
144 | | - with: |
145 | | - token: ${{ secrets.CODECOV_TOKEN }} |
146 | | - slug: pasteurlabs/tesseract-core |
147 | | - files: coverage*.xml |
148 | | - fail_ci_if_error: true |
149 | | - |
150 | 29 | get-e2e-matrix: |
151 | 30 | runs-on: ubuntu-latest |
152 | 31 |
|
@@ -326,18 +205,13 @@ jobs: |
326 | 205 |
|
327 | 206 |
|
328 | 207 | all-ok: |
329 | | - needs: [tests-base, tests-e2e, tests-demos] |
| 208 | + needs: [tests-e2e, tests-demos] |
330 | 209 |
|
331 | 210 | runs-on: ubuntu-latest |
332 | 211 |
|
333 | 212 | steps: |
334 | 213 | - name: Check for errors |
335 | 214 | run: | |
336 | | - if [ "${{ needs.tests-base.result }}" != "success" ]; then |
337 | | - echo "Base tests failed" |
338 | | - exit 1 |
339 | | - fi |
340 | | -
|
341 | 215 | if [ "${{ needs.tests-e2e.result }}" != "success" ]; then |
342 | 216 | echo "E2E tests failed" |
343 | 217 | exit 1 |
|
0 commit comments