Skip to content

Commit dae421d

Browse files
CarliJoyalexanderankin
authored andcommitted
fix(main): adopt ci to new src structure
- removed some now deprecated make entrypoints/scripts
1 parent 9427055 commit dae421d

4 files changed

Lines changed: 46 additions & 74 deletions

File tree

.github/workflows/ci-community.yml

Lines changed: 22 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,13 @@ on:
1010
push:
1111
branches: [ main ]
1212
paths:
13-
- "modules/**"
13+
- "src/testcontainers/community/**"
14+
- "tests/community/**"
1415
pull_request:
1516
branches: [ main ]
1617
paths:
17-
- "modules/**"
18+
- "src/testcontainers/community/**"
19+
- "tests/community/**"
1820

1921
jobs:
2022
track-modules:
@@ -32,15 +34,29 @@ jobs:
3234
list-files: 'json'
3335
filters: |
3436
modules:
35-
- 'modules/**'
37+
- 'src/testcontainers/community/**'
38+
- 'tests/community/**'
3639
- name: Compute modules from files
3740
id: compute-changes
3841
run: |
39-
modules=$(echo "${{ toJson(steps.changed-files.outputs.modules_files) }}" | jq '.[] | split("/") | nth(1)' | jq -s -c '. | unique')
42+
modules=$(echo '${{ toJson(steps.changed-files.outputs.modules_files) }}' | jq -c '
43+
[.[] |
44+
if startswith("src/testcontainers/community/") then split("/")[3]
45+
elif startswith("tests/community/") then split("/")[2]
46+
else empty
47+
end |
48+
select(. and (startswith("__") | not)) |
49+
if . == "oracle" then "oracle-free"
50+
elif . == "influxdb1" or . == "influxdb2" then "influxdb"
51+
else .
52+
end
53+
] | unique
54+
')
4055
echo "computed_modules=$modules"
4156
echo "computed_modules=$modules" >> $GITHUB_OUTPUT
4257
outputs:
4358
changed_modules: ${{ steps.compute-changes.outputs.computed_modules }}
59+
4460
test:
4561
runs-on: ubuntu-22.04
4662
needs: [track-modules]
@@ -60,6 +76,6 @@ jobs:
6076
- name: Install Python dependencies
6177
run: uv sync --extra ${{ matrix.module }}
6278
- name: Run tests
63-
run: make modules/${{ matrix.module }}/tests
79+
run: make community/${{ matrix.module }}/tests
6480
- name: Run doctests
65-
run: make modules/${{ matrix.module }}/doctests
81+
run: make community/${{ matrix.module }}/doctests

.github/workflows/ci-lint.yml

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,4 @@ jobs:
2222
- name: Execute pre-commit handler
2323
continue-on-error: true
2424
run: |
25-
uv run pre-commit run check-toml
26-
uv run pre-commit run trailing-whitespace
27-
uv run pre-commit run end-of-file-fixer
28-
uv run pre-commit run ruff
29-
uv run pre-commit run ruff-format
30-
- name: Execute mypy
31-
run: |
32-
make mypy-core-report
33-
make mypy-core
25+
uv run pre-commit run --all-files

Makefile

Lines changed: 23 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,10 @@
33

44
PYTHON_VERSION ?= 3.10
55
IMAGE = testcontainers-python:${PYTHON_VERSION}
6-
PACKAGES = core $(addprefix modules/,$(notdir $(wildcard modules/*)))
76

8-
UPLOAD = $(addsuffix /upload,${PACKAGES})
9-
TESTS = $(addsuffix /tests,$(filter-out meta,${PACKAGES}))
10-
TESTS_DIND = $(addsuffix -dind,${TESTS})
11-
DOCTESTS = $(addsuffix /doctests,$(filter-out modules/README.md,${PACKAGES}))
7+
COMMUNITY_MODULES = $(patsubst tests/community/%/,%,$(wildcard tests/community/*/))
8+
COMMUNITY_TESTS = $(addprefix community/,$(addsuffix /tests,$(COMMUNITY_MODULES)))
9+
COMMUNITY_DOCTESTS = $(addprefix community/,$(addsuffix /doctests,$(COMMUNITY_MODULES)))
1210

1311

1412
install: ## Set up the project for development
@@ -18,15 +16,17 @@ install: ## Set up the project for development
1816
build: ## Build the python package
1917
uv build && uv run twine check dist/*
2018

21-
tests: ${TESTS} ## Run tests for each package
22-
${TESTS}: %/tests:
23-
uv run coverage run --parallel -m pytest -v $*/tests
19+
tests: core/tests community-tests ## Run all tests
2420

25-
quick-core-tests: ## Run core tests excluding long_running
26-
uv run coverage run --parallel -m pytest -v -m "not long_running" core/tests
21+
core/tests: ## Run tests for the core package
22+
uv run coverage run --parallel -m pytest -v tests/core
23+
24+
community-tests: $(COMMUNITY_TESTS) ## Run tests for all community modules
25+
$(COMMUNITY_TESTS): community/%/tests:
26+
uv run coverage run --parallel -m pytest -v tests/community/$*
2727

28-
core-tests: ## Run tests for the core package
29-
uv run coverage run --parallel -m pytest -v core/tests
28+
quick-core-tests: ## Run core tests excluding long_running
29+
uv run coverage run --parallel -m pytest -v -m "not long_running" tests/core
3030

3131
coverage: ## Target to combine and report coverage.
3232
uv run coverage combine
@@ -37,24 +37,21 @@ coverage: ## Target to combine and report coverage.
3737
lint: ## Lint all files in the project, which we also run in pre-commit
3838
uv run pre-commit run --all-files
3939

40-
mypy-core: ## Run mypy on the core package
41-
uv run mypy --config-file pyproject.toml core
42-
43-
mypy-core-report: ## Generate a report for mypy on the core package
44-
uv run mypy --config-file pyproject.toml core | uv run python scripts/mypy_report.py
45-
4640
docs: ## Build the docs for the project
4741
uv run --all-extras sphinx-build -nW docs docs/_build
4842

4943
# Target to build docs watching for changes as per https://stackoverflow.com/a/21389615
50-
docs-watch :
44+
docs-watch:
5145
uv run sphinx-autobuild docs docs/_build # requires 'pip install sphinx-autobuild'
5246

53-
doctests: ${DOCTESTS} ## Run doctests found across the documentation.
54-
uv run --all-extras sphinx-build -b doctest . docs/_build
47+
doctests: core/doctests community-doctests ## Run doctests found across the documentation.
48+
49+
core/doctests: ## Run doctests for the core package
50+
uv run --all-extras sphinx-build -b doctest -c doctests docs/core docs/_build
5551

56-
${DOCTESTS}: %/doctests: ## Run doctests found for a module.
57-
uv run --all-extras sphinx-build -b doctest -c doctests $* docs/_build
52+
community-doctests: $(COMMUNITY_DOCTESTS) ## Run doctests for all community modules
53+
$(COMMUNITY_DOCTESTS): community/%/doctests:
54+
uv run --all-extras sphinx-build -b doctest docs docs/_build docs/community/$*.rst
5855

5956

6057
clean: ## Remove generated files.
@@ -67,7 +64,9 @@ clean-all: clean ## Remove all generated files and reset the local virtual envir
6764
rm -rf .venv
6865

6966
# Targets that do not generate file-level artifacts.
70-
.PHONY: clean docs doctests image tests quick-core-tests ${TESTS}
67+
.PHONY: clean docs doctests core/doctests community-doctests $(COMMUNITY_DOCTESTS) \
68+
tests core/tests community-tests $(COMMUNITY_TESTS) \
69+
quick-core-tests install build coverage lint mypy-core mypy-core-report docs-watch
7170

7271

7372
# Implements this pattern for autodocumenting Makefiles:

scripts/mypy_report.py

Lines changed: 0 additions & 35 deletions
This file was deleted.

0 commit comments

Comments
 (0)