diff --git a/.github/workflows/check.yml b/.github/workflows/check.yml index 1fc612d..91c37f3 100644 --- a/.github/workflows/check.yml +++ b/.github/workflows/check.yml @@ -1,43 +1,40 @@ name: Check on: - push: - branches: - - main - pull_request: + push: + branches: + - main + pull_request: env: EDGEE_API_TOKEN: ${{ secrets.EDGEE_API_TOKEN }} jobs: - test: - name: test - runs-on: ubuntu-latest - steps: - - name: Checkout - uses: actions/checkout@v4 - - - name: Install uv - uses: astral-sh/setup-uv@v5 - - - name: "Set up Python" - uses: actions/setup-python@v5 - with: - python-version-file: "pyproject.toml" - - - name: Install edgee - uses: edgee-cloud/install-edgee-cli@v0.2.0 - - - name: Build component - run: | - edgee component build - - - name: Verify .wasm file exists - run: | - if [ ! -f "./dc_component.wasm" ]; then - echo "❌ Error: dc_component.wasm not found" >&2 - exit 1 - fi - - - name: Test component - run: | - make test + full-ci: + name: Full CI (${{ matrix.dir }}) + runs-on: ubuntu-latest + strategy: + matrix: + dir: [consent-management, data-collection] + defaults: + run: + working-directory: ${{ matrix.dir }} + steps: + - uses: actions/checkout@v4 + + - name: Install uv + uses: astral-sh/setup-uv@v5 + + - name: "Set up Python" + uses: actions/setup-python@v5 + with: + python-version-file: "${{ matrix.dir }}/pyproject.toml" + + - name: Install Edgee CLI + uses: edgee-cloud/install-edgee-cli@v0.2.0 + + - name: Run edgee component wit + run: edgee component wit + + - name: Build component + run: | + edgee component build diff --git a/Makefile b/Makefile deleted file mode 100644 index 7f3d81d..0000000 --- a/Makefile +++ /dev/null @@ -1,15 +0,0 @@ -.PHONY: all -MAKEFLAGS += --silent - -all: help - -help: - @grep -E '^[a-zA-Z1-9\._-]+:.*?## .*$$' $(MAKEFILE_LIST) \ - | sort \ - | sed -e "s/^Makefile://" -e "s///" \ - | awk 'BEGIN { FS = ":.*?## " }; { printf "\033[36m%-30s\033[0m %s\n", $$1, $$2 }' -build: - edgee components build - -test: ## test the component functions - python -m unittest dc_component_test.py diff --git a/.gitignore b/consent-management/.gitignore similarity index 81% rename from .gitignore rename to consent-management/.gitignore index 8351d0b..734088c 100644 --- a/.gitignore +++ b/consent-management/.gitignore @@ -1,7 +1,7 @@ # deps .edgee/ # build output -dc_component.wasm +component.wasm # world binding edgee_world/ # python diff --git a/README.md b/consent-management/README.md similarity index 100% rename from README.md rename to consent-management/README.md diff --git a/consent-management/component.py b/consent-management/component.py new file mode 100644 index 0000000..e1f2ba7 --- /dev/null +++ b/consent-management/component.py @@ -0,0 +1,23 @@ +import edgee_world.consent_management.exports as exports +import edgee_world.consent_management.exports.consent_management as consent_management + +from edgee_world.consent_management.types import * + +class ConsentManagement(exports.ConsentManagement): + def map(self, cookies: List[Tuple[str, str]], settings: List[Tuple[str, str]]) -> Optional[consent_management.Consent]: + cookies_dict = dict(cookies) + settings_dict = dict(settings) + + key = cookies_dict.get("key") + if key is None: + return None + + if key == "granted": + return consent_management.Consent.GRANTED + elif key == "denied": + return consent_management.Consent.DENIED + else: + return consent_management.Consent.PENDING + + + raise NotImplementedError diff --git a/consent-management/edgee-component.toml b/consent-management/edgee-component.toml new file mode 100644 index 0000000..244f1f5 --- /dev/null +++ b/consent-management/edgee-component.toml @@ -0,0 +1,21 @@ +manifest-version = 1 + +[component] +name = "example-py-consent-management-component" +version = "1.0.0" +category = "consent-management" +subcategory = "consent-mapping" +description = "Example Python component for consent management" +documentation = "https://github.com/edgee-cloud/example-py-component" +repository = "https://github.com/edgee-cloud/example-py-component" +language = "Python" +wit-version = "1.0.0" + +[component.build] +command = "uv sync && rm -rf edgee_world && uv run componentize-py --wit-path .edgee/wit/ bindings edgee_world && uv run componentize-py --wit-path .edgee/wit/ --world consent-management componentize component -o component.wasm" +output_path = "./component.wasm" + +[component.settings.example] +title = "Example Config Field" +type = "string" + diff --git a/pyproject.toml b/consent-management/pyproject.toml similarity index 100% rename from pyproject.toml rename to consent-management/pyproject.toml diff --git a/uv.lock b/consent-management/uv.lock similarity index 100% rename from uv.lock rename to consent-management/uv.lock diff --git a/data-collection/.gitignore b/data-collection/.gitignore new file mode 100644 index 0000000..734088c --- /dev/null +++ b/data-collection/.gitignore @@ -0,0 +1,8 @@ +# deps +.edgee/ +# build output +component.wasm +# world binding +edgee_world/ +# python +__pycache__/ diff --git a/data-collection/README.md b/data-collection/README.md new file mode 100644 index 0000000..9248bcb --- /dev/null +++ b/data-collection/README.md @@ -0,0 +1,29 @@ +
+
+
+