From e3051e381f6fd1a81f102d5a94efe47b805a6e9f Mon Sep 17 00:00:00 2001 From: Adrien Carpentier Date: Thu, 1 Aug 2024 21:02:40 +0200 Subject: [PATCH] ci: update CI (wip) --- .circleci/config.yml | 36 +++++++++++++++++++++--------------- 1 file changed, 21 insertions(+), 15 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 67030ba6..b50ea8eb 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -1,4 +1,3 @@ ---- version: 2.1 parameters: @@ -16,6 +15,7 @@ parameters: default: "py-cache-v2" jobs: + install: docker: - image: cimg/python:<< pipeline.parameters.python-version >> @@ -26,16 +26,19 @@ jobs: command: export BASE_BRANCH=$(base_branch) - restore_cache: keys: - - << pipeline.parameters.cache-prefix >>-{{ arch }}-{{ checksum "poetry.lock" }} + - << pipeline.parameters.cache-prefix >>-{{ arch }}-{{ checksum "requirements.txt" }}-{{ checksum "requirements-dev.txt" }} - << pipeline.parameters.cache-prefix >>-{{ arch }}-{{ .Branch }} - << pipeline.parameters.cache-prefix >>-{{ arch }}-{{ .Environment.BASE_BRANCH }} - run: name: Install python dependencies command: | - poetry config virtualenvs.in-project true - poetry install + python3 -m pip install --upgrade pip + python3 -m venv .venv + source .venv/bin/activate + pip install . + pip install '.[dev]' - save_cache: - key: << pipeline.parameters.cache-prefix >>-{{ arch }}-{{ checksum "poetry.lock" }} + key: << pipeline.parameters.cache-prefix >>-{{ arch }}-{{ checksum "requirements.txt" }}-{{ checksum "requirements-dev.txt" }} paths: - .venv - persist_to_workspace: @@ -50,12 +53,13 @@ jobs: - attach_workspace: at: . - run: - name: Lint and format code and sort imports - # ruff check --select I . : check linting and imports sorting without fixing (to fix, use --fix) - # ruff format --check . : check code formatting without fixing (to fix, remove --check) + name: Lint code, format code and sort imports command: | - poetry run ruff check --select I . - poetry run ruff format --check . + source .venv/bin/activate + # Check linting and imports sorting without fixing (to fix, use --fix) + ruff check + # Check code formattingfixing (to fix, remove --check) + ruff format --check tests: docker: @@ -74,7 +78,8 @@ jobs: DATABASE_URL: postgresql://postgres:postgres@localhost:5432/postgres UDATA_INSTANCE_NAME: udata command: | - poetry run pytest --junitxml=reports/python/tests.xml -p no:sugar --color=yes + source .venv/bin/activate + pytest --junitxml=reports/python/tests.xml -p no:sugar --color=yes - store_test_results: path: reports/python @@ -87,14 +92,16 @@ jobs: - run: name: Build a distributable package command: | + source .venv/bin/activate # Build a wheel release if [[ $CIRCLE_TAG ]]; then # This is a tagged release, version has been handled upstream - poetry build + python3 -m pip install --upgrade build + python3 -m build else # Relies on a dev version like "1.2.1.dev" by default - poetry version $(poetry version -s)$CIRCLE_BUILD_NUM - poetry build + python3 -m pip install --upgrade build + python3 -m build fi - store_artifacts: path: dist @@ -115,7 +122,6 @@ jobs: poetry publish --username "${PYPI_USERNAME}" --password "${PYPI_PASSWORD}" --no-interaction workflows: - version: 2 build: jobs: - install: