Skip to content

Commit 1ffca8e

Browse files
committed
Simplify warehouses end-to-end tests.
1 parent 9e9514b commit 1ffca8e

4 files changed

Lines changed: 37 additions & 19 deletions

File tree

.github/actions/run-pytest-with-uv/action.yml

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@ inputs:
55
compose-file-path:
66
description: If supplied, brings up the services defined in the given docker compose file.
77
default: ""
8-
install-cmd:
9-
description: The uv command to install the project
10-
default: "uv sync --locked --all-extras --dev"
8+
pyproject-directory:
9+
description: Path to the directory containing pyproject.toml
10+
required: true
1111
pytest-file-or-dir:
1212
description: Path to a file or directory for pytest execution
1313
required: true
@@ -19,9 +19,6 @@ inputs:
1919
uv-version:
2020
description: The version of uv to install e.g., `0.5.0` Defaults to the version in pyproject.toml or 'latest'.
2121
default: "latest"
22-
working-directory:
23-
description: Working directory while running pytest
24-
required: true
2522

2623
runs:
2724
using: composite
@@ -44,13 +41,13 @@ runs:
4441

4542
- name: Install the project
4643
shell: bash -l {0}
47-
run: ${{ inputs.install-cmd }}
48-
working-directory: ${{ inputs.working-directory }}
44+
run: uv sync --locked --all-extras --dev
45+
working-directory: ${{ inputs.pyproject-directory }}
4946

5047
- name: Run tests
5148
shell: bash -l {0}
5249
run: uv run pytest --durations-min=0.5 --exitfirst "${{ inputs.pytest-file-or-dir }}" --cache-clear
53-
working-directory: ${{ inputs.working-directory }}
50+
working-directory: ${{ inputs.pyproject-directory }}
5451

5552
- name: Dump Docker Compose logs on failure
5653
if: failure() && inputs.compose-file-path != ''

.github/workflows/elt-common_e2e_tests.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,12 +41,11 @@ jobs:
4141
uses: ./.github/actions/run-pytest-with-uv
4242
with:
4343
compose-file-path: infra/local/docker-compose.yml
44+
pyproject-directory: elt-common
4445
pytest-file-or-dir: tests/e2e_tests
4546
uv-cache-dependency-glob: elt-common/pyproject.toml
46-
working-directory: elt-common
4747

4848
- name: Remove adp-router from /etc/hosts
49-
if: always()
5049
shell: bash -l {0}
5150
run: |
5251
sudo sed -i -e '/adp-router/d' /etc/hosts

.github/workflows/elt-common_unit_tests.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,6 @@ jobs:
2828
- name: Run unit tests
2929
uses: ./.github/actions/run-pytest-with-uv
3030
with:
31+
pyproject-directory: elt-common
3132
pytest-file-or-dir: tests/unit_tests
3233
uv-cache-dependency-glob: elt-common/pyproject.toml
33-
working-directory: elt-common

.github/workflows/warehouses_e2e_tests.yml

Lines changed: 29 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,10 @@ concurrency:
1818
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.run_id }}
1919
cancel-in-progress: true
2020

21+
env:
22+
PYTHON_VERSION: 3.13
23+
UV_VERSION: latest
24+
2125
jobs:
2226
test:
2327
name: warehouses end-to-end tests
@@ -27,19 +31,37 @@ jobs:
2731
- name: Checkout
2832
uses: actions/checkout@v6
2933

34+
- name: Bring up Docker Compose services
35+
uses: hoverkraft-tech/compose-action@v2.3.0
36+
with:
37+
compose-file: infra/local/docker-compose.yml
38+
up-flags: --quiet-pull --wait --wait-timeout 300
39+
down-flags: --volumes --remove-orphans
40+
3041
- name: Add adp-router to /etc/hosts
3142
shell: bash -l {0}
3243
run: |
3344
echo "127.0.0.1 adp-router" | sudo tee -a /etc/hosts
3445
35-
- name: Run end-to-end tests
36-
uses: ./.github/actions/run-pytest-with-uv
46+
- name: Install uv
47+
uses: astral-sh/setup-uv@v7
3748
with:
38-
compose-file-path: infra/local/docker-compose.yml
39-
install-cmd: uv sync --locked --script extract_and_load.py
40-
pytest-file-or-dir: tests
41-
uv-cache-dependency-glob: elt-common/pyproject.toml
42-
working-directory: warehouses/accelerator/extract_load/opralogweb
49+
activate-environment: true
50+
version: ${{ env.UV_VERSION }}
51+
python-version: ${{ env.PYTHON_VERSION }}
52+
53+
- name: Install dependencies
54+
shell: bash -l {0}
55+
run: |
56+
uv sync --active --script extract_and_load.py
57+
uv pip install pytest
58+
working-directory: warehouses/accelerator/extract_load/opralogweb
59+
60+
- name: Run tests
61+
shell: bash -l {0}
62+
run: |
63+
uv run --active pytest --durations-min=0.5 --exitfirst tests --cache-clear
64+
working-directory: warehouses/accelerator/extract_load/opralogweb
4365

4466
- name: Remove adp-router from /etc/hosts
4567
if: always()

0 commit comments

Comments
 (0)