Skip to content

Commit

Permalink
ci: update CI (wip)
Browse files Browse the repository at this point in the history
  • Loading branch information
bolinocroustibat committed Aug 27, 2024
1 parent aea9d47 commit e3051e3
Showing 1 changed file with 21 additions and 15 deletions.
36 changes: 21 additions & 15 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
---
version: 2.1

parameters:
Expand All @@ -16,6 +15,7 @@ parameters:
default: "py-cache-v2"

jobs:

install:
docker:
- image: cimg/python:<< pipeline.parameters.python-version >>
Expand All @@ -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:
Expand All @@ -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:
Expand All @@ -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

Expand All @@ -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
Expand All @@ -115,7 +122,6 @@ jobs:
poetry publish --username "${PYPI_USERNAME}" --password "${PYPI_PASSWORD}" --no-interaction
workflows:
version: 2
build:
jobs:
- install:
Expand Down

0 comments on commit e3051e3

Please sign in to comment.