Skip to content

Commit 66315cb

Browse files
committed
Add GHA to run warehouses tests
1 parent c04be45 commit 66315cb

4 files changed

Lines changed: 58 additions & 8 deletions

File tree

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

Lines changed: 9 additions & 6 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-
pyproject-directory:
9-
description: Path to the directory containing pyproject.toml
10-
required: true
8+
install-args-extra:
9+
description: Extra arguments to the uv sync command
10+
default: ""
1111
pytest-file-or-dir:
1212
description: Path to a file or directory for pytest execution
1313
required: true
@@ -19,6 +19,9 @@ 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
2225

2326
runs:
2427
using: composite
@@ -41,13 +44,13 @@ runs:
4144

4245
- name: Install the project
4346
shell: bash -l {0}
44-
run: uv sync --locked --all-extras --dev
45-
working-directory: ${{ inputs.pyproject-directory }}
47+
run: uv sync --locked --all-extras --dev ${{ inputs.install-args-extra }}
48+
working-directory: ${{ inputs.working-directory }}
4649

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

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

.github/workflows/elt-common_e2e_tests.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,9 @@ 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
4544
pytest-file-or-dir: tests/e2e_tests
4645
uv-cache-dependency-glob: elt-common/pyproject.toml
46+
working-directory: elt-common
4747

4848
- name: Remove adp-router from /etc/hosts
4949
shell: bash -l {0}

.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
3231
pytest-file-or-dir: tests/unit_tests
3332
uv-cache-dependency-glob: elt-common/pyproject.toml
33+
working-directory: elt-common
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
name: End-to-end tests for extract and load scripts in the warehouse
2+
on:
3+
push:
4+
branches:
5+
- "main"
6+
paths:
7+
- ".github/workflows/warehouses_e2e_tests.yml"
8+
- "elt-common/**"
9+
- "warehouses/accelerator/extract_load/opralogweb/**"
10+
pull_request:
11+
types: [opened, synchronize, reopened]
12+
paths:
13+
- ".github/workflows/warehouses_e2e_tests.yml"
14+
- "elt-common/**"
15+
- "warehouses/accelerator/extract_load/opralogweb/**"
16+
17+
concurrency:
18+
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.run_id }}
19+
cancel-in-progress: true
20+
21+
jobs:
22+
test:
23+
name: warehouses end-to-end tests
24+
runs-on: ubuntu-latest
25+
26+
steps:
27+
- name: Checkout
28+
uses: actions/checkout@v6
29+
30+
- name: Add adp-router to /etc/hosts
31+
shell: bash -l {0}
32+
run: |
33+
echo "127.0.0.1 adp-router" | sudo tee -a /etc/hosts
34+
35+
- name: Run end-to-end tests
36+
uses: ./.github/actions/run-pytest-with-uv
37+
with:
38+
compose-file-path: infra/local/docker-compose.yml
39+
install-args-extra: --script extract_and_load.py.lock
40+
pytest-file-or-dir: tests
41+
uv-cache-dependency-glob: elt-common/pyproject.toml
42+
working-directory: warehouses/accelerator/extract_load/opralogweb
43+
44+
- name: Remove adp-router from /etc/hosts
45+
shell: bash -l {0}
46+
run: |
47+
sudo sed -i -e '/adp-router/d' /etc/hosts

0 commit comments

Comments
 (0)