Commit 5002403a authored by Jorge Moratinos's avatar Jorge Moratinos
Browse files

Merge branch 'SDK22-code-refactor' into 'staging'

Resolve "Code refactor"

See merge request !19
parents fa99fccc fb39defa
Loading
Loading
Loading
Loading
Loading
+4 −2
Changes for .githooks/pre-push: 4 added lines, 2 removed lines.
Original line number Diff line number Diff line
@@ -5,8 +5,8 @@

echo "--- 🚀 Running 'make lint' before push ---"

# Run the linter
make fix
# Run the linter (check only: run 'make fix' yourself and commit the result)
make lint

# Save the exit code of the last command
EXIT_CODE=$?
@@ -15,6 +15,8 @@ if [ $EXIT_CODE -ne 0 ]; then
    echo "-----------------------------------------------"
    echo "|        ⛔ The linter has failed! ⛔.        |"
    echo "|     Please fix the errors before pushing.   |"
    echo "|  ('make fix' corrects most of them; commit  |"
    echo "|   the changes and push again)               |"
    echo "-----------------------------------------------"
    exit 1 # Abort the push
fi
+6 −6
Changes for .github/workflows/gitlab.yml: 6 added lines, 6 removed lines.
Original line number Diff line number Diff line
@@ -3,28 +3,28 @@ name: Sync GitHub to GitLab
on:
  push:
    branches:
      - develop  # Se activa cuando hay cambios en la rama develop
      - develop  # Triggered when there are changes on the develop branch

jobs:
  create-merge-request:
    runs-on: ubuntu-latest

    steps:
      # 1. Checkout del código desde GitHub
      # 1. Check out the code from GitHub
      - name: Checkout GitHub repository
        uses: actions/checkout@v4

      # 2. Crear un Merge Request en GitLab
      # 2. Create a Merge Request in GitLab
      - name: Create Merge Request in GitLab
        env:
          GITLAB_TOKEN: ${{ secrets.GITLAB_TOKEN }}
        run: |
          # Información del MR
          PROJECT_ID="335" # Reemplaza con el ID del proyecto de GitLab
          # MR information
          PROJECT_ID="335" # Replace with the GitLab project ID
          SOURCE_BRANCH="develop"
          TARGET_BRANCH="main"

          # Crear el Merge Request usando la API de GitLab
          # Create the Merge Request using the GitLab API
          curl -X POST \
            -H "Content-Type: application/json" \
            -H "Authorization: Bearer $GITLAB_TOKEN" \
+6
Changes for .gitignore: 6 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -179,3 +179,9 @@ config

/test/capif_sdk_config_sample_test.json


# Keys and certificates generated by the samples and testing clients
**/test_*_certificate_folder/
network_app_samples/network_app_provider_sample/aef_server_certificate/
ci_cd_test/testing_samples/aef_server_certificate/
ci_cd_test/testing_samples/testing_provider_sample/aef_servers.ready
+19
Changes for Makefile: 19 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -3,6 +3,16 @@ VENV_BIN := venv/bin
RUFF := $(VENV_BIN)/ruff
lint_cmd := $(RUFF) check opencapif_sdk scripts test
fix_cmd := $(lint_cmd) --fix
# Python used for the unit tests: the repository venv if it exists, otherwise python3 (override with PYTHON=...).
# 'python -m pytest' runs from the repository root, so the tests use this code and not an installed opencapif_sdk.
PYTHON ?= $(if $(wildcard $(VENV_BIN)/python),$(VENV_BIN)/python,python3)
unit_tests_cmd := $(PYTHON) -m pytest test/unit
# Unit tests in a Docker container (test/Dockerfile), without a local Python environment.
# PYTHON_IMAGE selects the Python version (e.g. PYTHON_IMAGE=python:3.9-slim); UNIT_TESTS_IMAGE is the image built.
PYTHON_IMAGE ?= labs.etsi.org:5050/ocf/capif/python:3.13-slim
UNIT_TESTS_IMAGE ?= opencapif_sdk_unit_tests
unit_tests_docker_cmd := docker build -f test/Dockerfile --build-arg PYTHON_IMAGE=$(PYTHON_IMAGE) \
	-t $(UNIT_TESTS_IMAGE) . && docker run --rm $(UNIT_TESTS_IMAGE)


.PHONY: lint
@@ -12,3 +22,12 @@ lint:
.PHONY: fix
fix:
	$(fix_cmd)

.PHONY: unit_tests
unit_tests:
	$(unit_tests_cmd)

.PHONY: unit_tests_docker
unit_tests_docker:
	$(unit_tests_docker_cmd)
+135 −21

File changed.

Preview size limit exceeded, changes collapsed.

Loading