From 5bb18688fc9e2dc314e996aea66051cd0221e0fe Mon Sep 17 00:00:00 2001 From: MJedr Date: Mon, 2 Oct 2023 13:00:13 +0200 Subject: [PATCH] update ci --- .github/workflows/ci.yml | 20 ++++++++++++++ .github/workflows/reusable-workflow.yml | 35 +++++++++++++++++++++++++ matomo-api/pyproject.toml | 2 +- matomo-api/{matomo => src}/__init__.py | 0 matomo-api/{matomo => src}/api.py | 0 matomo-api/{matomo => src}/cli.py | 0 matomo-api/{matomo => src}/models.py | 0 matomo-api/tests/utils.py | 6 ----- 8 files changed, 56 insertions(+), 7 deletions(-) create mode 100644 .github/workflows/ci.yml create mode 100644 .github/workflows/reusable-workflow.yml rename matomo-api/{matomo => src}/__init__.py (100%) rename matomo-api/{matomo => src}/api.py (100%) rename matomo-api/{matomo => src}/cli.py (100%) rename matomo-api/{matomo => src}/models.py (100%) delete mode 100644 matomo-api/tests/utils.py diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..0d811aa --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,20 @@ +name: Test + +on: + pull_request: + branches: + - main + +jobs: + test: + strategy: + matrix: + directory: + - matomo + - notification-service + runs-on: ubuntu-latest + steps: + - name: Use the reusable workflow + uses: ./.github/workflows/reusable-workflow.yml + with: + directory: ${{ matrix.directory }} diff --git a/.github/workflows/reusable-workflow.yml b/.github/workflows/reusable-workflow.yml new file mode 100644 index 0000000..e9e094d --- /dev/null +++ b/.github/workflows/reusable-workflow.yml @@ -0,0 +1,35 @@ +name: Reusable workflow + +on: + workflow_call: + inputs: + directory: + required: true + type: string +jobs: + lint: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v3 + + - name: Setup Python + uses: actions/setup-python@v4 + with: + python-version: "3.11" + + - uses: psf/black@stable + with: + src: ${{ inputs.directory }}/src + tests: + runs-on: ubuntu-latest + environment: production + steps: + - uses: actions/checkout@v3 + + - uses: actions/setup-python@v4 + with: + python-version: "3.11" + + - name: Test + run: pip install poetry && cd ${{ inputs.directory }} poetry install && poetry run pytest diff --git a/matomo-api/pyproject.toml b/matomo-api/pyproject.toml index a5508e4..4621db1 100644 --- a/matomo-api/pyproject.toml +++ b/matomo-api/pyproject.toml @@ -4,7 +4,7 @@ version = "0.1.0" description = "" authors = ["MJedr "] packages = [ - { include = "*", from = "matomo" }, + { include = "*", from = "src" }, ] [tool.poetry.dependencies] diff --git a/matomo-api/matomo/__init__.py b/matomo-api/src/__init__.py similarity index 100% rename from matomo-api/matomo/__init__.py rename to matomo-api/src/__init__.py diff --git a/matomo-api/matomo/api.py b/matomo-api/src/api.py similarity index 100% rename from matomo-api/matomo/api.py rename to matomo-api/src/api.py diff --git a/matomo-api/matomo/cli.py b/matomo-api/src/cli.py similarity index 100% rename from matomo-api/matomo/cli.py rename to matomo-api/src/cli.py diff --git a/matomo-api/matomo/models.py b/matomo-api/src/models.py similarity index 100% rename from matomo-api/matomo/models.py rename to matomo-api/src/models.py diff --git a/matomo-api/tests/utils.py b/matomo-api/tests/utils.py deleted file mode 100644 index acb357b..0000000 --- a/matomo-api/tests/utils.py +++ /dev/null @@ -1,6 +0,0 @@ -import json - -def filter_sensitive(request): - if "api-access" in request.path: - return None - return request \ No newline at end of file