diff --git a/.github/workflows/CICD.yaml b/.github/workflows/CICD.yaml index eab255fa..197cb336 100644 --- a/.github/workflows/CICD.yaml +++ b/.github/workflows/CICD.yaml @@ -41,6 +41,7 @@ jobs: outputs: cache-key-dependencies: ${{ steps.generate-cache-keys.outputs.cache_key }} cache-key-run: ${{ steps.generate-cache-keys.outputs.cache_key_run }} + python-version: ${{ steps.install-python.outputs.python-version }} env: PYTHON_VERSION: "3.10" @@ -61,12 +62,13 @@ jobs: echo "cache_key_dependencies=$cache_key_dependencies" >> $GITHUB_OUTPUT echo "cache_key_run=$cache_key_run" >> $GITHUB_OUTPUT - - name: Set up Python ${{ env.PYTHON_VERSION }} + - name: Set up Python ${{ steps.generate-cache-keys.outputs.python-version }} #if: ${{ success() && (inputs.use_dependency_cache == 'false' || !steps.restore-dependency-cache.outputs.cache-hit) }} uses: actions/setup-python@v5 - id: install_python + id: install-python with: python-version: ${{ env.PYTHON_VERSION }} + #run: echo "python-version=${{ steps.install-python.outputs.python-version }}" >> "$GITHUB_OUTPUT" - name: Install dependencies #if: ${{ success() && (inputs.use_dependency_cache == 'false' || !steps.restore-dependency-cache.outputs.cache-hit) }} @@ -93,14 +95,14 @@ jobs: - Checkout env: - PYTHON_VERSION: "3.10" + PYTHON_VERSION: ${{ needs.Checkout.outputs.python-version }} if: ${{( success() && !cancelled() ) }} steps: - name: Set up Python ${{ env.PYTHON_VERSION }} uses: actions/setup-python@v5 - id: install_python + id: install-python with: python-version: ${{ env.PYTHON_VERSION }} @@ -128,14 +130,14 @@ jobs: - Checkout env: - PYTHON_VERSION: "3.10" + PYTHON_VERSION: ${{ needs.Checkout.outputs.python-version }} if: ${{( success() && !cancelled() ) }} steps: - name: Set up Python ${{ env.PYTHON_VERSION }} uses: actions/setup-python@v5 - id: install_python + id: install-python with: python-version: ${{ env.PYTHON_VERSION }} @@ -176,7 +178,7 @@ jobs: - Checkout env: - PYTHON_VERSION: "3.10" + PYTHON_VERSION: ${{ needs.Checkout.outputs.python-version }} if: ${{( success() && !cancelled() ) }} @@ -186,7 +188,7 @@ jobs: steps: - name: Set up Python ${{ env.PYTHON_VERSION }} uses: actions/setup-python@v5 - id: install_python + id: install-python with: python-version: ${{ env.PYTHON_VERSION }} @@ -228,14 +230,14 @@ jobs: - Checkout env: - PYTHON_VERSION: "3.10" + PYTHON_VERSION: ${{ needs.Checkout.outputs.python-version }} if: ${{( success() && !cancelled() ) }} steps: - name: Set up Python ${{ env.PYTHON_VERSION }} uses: actions/setup-python@v5 - id: install_python + id: install-python with: python-version: ${{ env.PYTHON_VERSION }} diff --git a/Makefile b/Makefile index 34375bed..1b1a54e1 100644 --- a/Makefile +++ b/Makefile @@ -47,7 +47,6 @@ endif ACTIVATE_VENV := . $(VENV)/bin/activate -PREFIX_VENV := PATH=$(CURDIR)/$(VENV)/bin:$$PATH REPORT_VENV_USAGE := echo '\nActivate your venv with `. $(VENV)/bin/activate`' PACKAGE_INSTALL_DIR := $(VENV)/lib/python*/site-packages/BL_Python @@ -82,11 +81,9 @@ _dev_build : _dev_configure else $(ACTIVATE_VENV) - $(PREFIX_VENV) \ pip install -e .[dev-dependencies] # By default, psycopg2 is not installed # but it should be for development - $(PREFIX_VENV) \ pip install -e src/database[postgres-binary] rm -rf $(PACKAGE_INSTALL_DIR) @@ -103,11 +100,9 @@ _cicd_build : _cicd_configure else $(ACTIVATE_VENV) - $(PREFIX_VENV) \ pip install .[dev-dependencies] # By default, psycopg2 is not installed # but it should be for CI/CD - $(PREFIX_VENV) \ pip install src/database[postgres-binary] fi @@ -120,10 +115,8 @@ $(PACKAGES) : BL_Python.%: src/%/pyproject.toml $(VENV) $(CONFIGURE_TARGET) $(PY $(ACTIVATE_VENV) if [ "$@" = "BL_Python.database" ]; then - $(PREFIX_VENV) \ pip install -e $(dir $<)[postgres-binary] else - $(PREFIX_VENV) \ pip install -e $(dir $<) fi @@ -137,19 +130,17 @@ SETUP_DEPENDENCIES=$(call dep_to_venv_path,toml/__init__.py) $(call dep_to_venv_ $(call dep_to_venv_path,toml/__init__.py): $(VENV) $(ACTIVATE_VENV) - $(PREFIX_VENV) pip install toml + pip install toml $(call dep_to_venv_path,typing_extensions.py): $(VENV) $(ACTIVATE_VENV) - $(PREFIX_VENV) \ pip install typing_extensions $(PACKAGE_PATHS) : $(VENV) $(SETUP_DEPENDENCIES) $(PYPROJECT_FILES) : $(VENV) $(SETUP_DEPENDENCIES) $(ACTIVATE_VENV) - $(PREFIX_VENV) \ REWRITE_DEPENDENCIES=$(REWRITE_DEPENDENCIES) \ GITHUB_REF=$(GITHUB_REF) \ GITHUB_WORKSPACE=$(GITHUB_WORKSPACE) \ @@ -164,20 +155,17 @@ $(VENV) : $(ACTIVATE_VENV) - $(PREFIX_VENV) \ pip install -U pip format-isort : $(VENV) $(BUILD_TARGET) $(ACTIVATE_VENV) - $(PREFIX_VENV) \ isort src format-ruff : $(VENV) $(BUILD_TARGET) $(ACTIVATE_VENV) - $(PREFIX_VENV) \ ruff format --preview --respect-gitignore format : $(VENV) $(BUILD_TARGET) format-isort format-ruff @@ -186,20 +174,17 @@ format : $(VENV) $(BUILD_TARGET) format-isort format-ruff test-isort : $(VENV) $(BUILD_TARGET) $(ACTIVATE_VENV) - $(PREFIX_VENV) \ isort --check-only src test-ruff : $(VENV) $(BUILD_TARGET) $(ACTIVATE_VENV) - $(PREFIX_VENV) \ ruff format --preview --respect-gitignore --check test-pyright : $(VENV) $(BUILD_TARGET) $(ACTIVATE_VENV) ifeq "$(PYRIGHT_MODE)" "pip" - $(PREFIX_VENV) \ pyright else ifeq "$(PYRIGHT_MODE)" "npm" @@ -215,7 +200,6 @@ test-pyright : $(VENV) $(BUILD_TARGET) test-bandit : $(VENV) $(BUILD_TARGET) $(ACTIVATE_VENV) - $(PREFIX_VENV) \ bandit -c pyproject.toml \ --format sarif \ --output $(BANDIT_REPORT) \ @@ -228,10 +212,8 @@ test-bandit : $(VENV) $(BUILD_TARGET) test-pytest : $(VENV) $(BUILD_TARGET) $(ACTIVATE_VENV) - $(PREFIX_VENV) \ pytest $(PYTEST_FLAGS) - $(PREFIX_VENV) \ coverage html -d coverage test : CMD_PREFIX=@ @@ -243,7 +225,6 @@ publish-all : REWRITE_DEPENDENCIES=false publish-all : reset $(VENV) $(ACTIVATE_VENV) - $(PREFIX_VENV) \ ./publish_all.sh $(PYPI_REPO)