Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

wip: experimental CI Improvements #305

Closed
wants to merge 22 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
105 changes: 67 additions & 38 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -1,46 +1,72 @@
version: 2.1

#
# orbs:
# coveralls: coveralls/[email protected]

workflows:
ci:
jobs:
- lint
- temp
# - lint
- test:
matrix:
parameters:
# TODO: Revisit why pyenv doesn't recognize 3.12
python_version: ["3.8", "3.9", "3.10", "3.11"] # "3.12"
arangodb_config: ["single", "cluster"]
arangodb_license: ["community", "enterprise"]
arangodb_version: ["3.10.10", "3.11.4", "latest"]
python_version: ["3.10"] # ["3.8", "3.9", "3.10", "3.11"] # "3.12"
arangodb_config: ["single"] # ["single", "cluster"]
arangodb_license: ["community"] #["community", "enterprise"]
arangodb_version: ["latest"] #["3.10.10", "3.11.4", "latest"]

jobs:
lint:
temp:
docker:
- image: python:latest
- image: cimg/python:3.10

steps:
- checkout
- run:
name: Install Dependencies
command: pip install .[dev]

- run:
name: Run black
command: black --check --verbose --diff --color --config=pyproject.toml ./arango ./tests/
- setup_remote_docker:
docker_layer_caching: true

- run:
name: Run flake8
command: flake8 ./arango ./tests
# - run: docker create --name adb -p 8529:8529 -e ARANGO_ROOT_PASSWORD= arangodb/arangodb

- run:
name: Run isort
command: isort --check ./arango ./tests
# - run: docker start adb

- run:
name: Run mypy
command: mypy ./arango
- run: docker run -d --rm --name adb -p 8529:8529 -e ARANGO_ROOT_PASSWORD= arangodb/arangodb:latest

- run: docker ps -a

- run: sleep 10

- run: docker ps -a

- run: docker logs adb


# lint:
# docker:
# - image: python:latest
# steps:
# - checkout
# - run:
# name: Install Dependencies
# command: pip install .[dev]

# - run:
# name: Run black
# command: black --check --verbose --diff --color --config=pyproject.toml ./arango ./tests/

# - run:
# name: Run flake8
# command: flake8 ./arango ./tests

# - run:
# name: Run isort
# command: isort --check ./arango ./tests

# - run:
# name: Run mypy
# command: mypy ./arango

test:
parameters:
Expand All @@ -52,36 +78,39 @@ jobs:
type: string
arangodb_version:
type: string
# TODO: Reconsider using a docker image instead of a machine
# i.e cimg/python:<< parameters.python_version >>
machine:
image: ubuntu-2204:current
docker:
- image: cimg/python:<< parameters.python_version >>
# machine:
# image: ubuntu-2204:current
steps:
- checkout

- setup_remote_docker:
docker_layer_caching: true

- run:
name: Set Up ArangoDB
command: |
chmod +x starter.sh
./starter.sh << parameters.arangodb_config >> << parameters.arangodb_license >> << parameters.arangodb_version >>
command: ./starter.sh << parameters.arangodb_config >> << parameters.arangodb_license >> << parameters.arangodb_version >>

- run: docker logs arango

- run: docker ps -a

- restore_cache:
key: pip-and-local-cache

# TODO: Revisit this bottleneck
- run:
name: Setup Python
command: |
pyenv --version
pyenv install -f << parameters.python_version >>
pyenv global << parameters.python_version >>
# - run:
# name: Setup Python
# command: |
# pyenv --version
# pyenv install -f << parameters.python_version >>
# pyenv global << parameters.python_version >>

- run:
name: "Install Dependencies"
command: pip install -e .[dev]

- run: docker ps -a

- run:
name: "Run pytest"
command: |
Expand Down
6 changes: 6 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
ARG image_name
ARG version

FROM arangodb/${image_name}:${version}
COPY ./tests/static/ /tests/static/
# COPY /tmp /tmp
25 changes: 19 additions & 6 deletions starter.sh
Original file line number Diff line number Diff line change
Expand Up @@ -39,21 +39,34 @@ else
conf_file="${setup}"
fi

docker run -d --rm \
docker build \
--build-arg image_name=$image_name \
--build-arg version=$version \
-t arangodb-$image_name-ci:$version .

docker run -d \
--name arango \
-p 8528:8528 \
-p 8529:8529 \
$extra_ports \
-v "$(pwd)/tests/static/":/tests/static \
-v /tmp:/tmp \
"arangodb/$image_name:$version" \
arangodb-$image_name-ci:$version \
/bin/sh -c "arangodb --configuration=/tests/static/$conf_file.conf"

wget --quiet --waitretry=1 --tries=120 -O - http://localhost:8528/version | jq
# docker run -d \
# --name arango \
# -p 8528:8528 \
# -p 8529:8529 \
# $extra_ports \
# -v "$(pwd)/tests/static/":/tests/static \
# -v /tmp:/tmp \
# "arangodb/$image_name:$version" \
# /bin/sh -c "arangodb --configuration=/tests/static/$conf_file.conf"

wget --quiet --waitretry=1 --tries=3 -O - http://localhost:8528/version | jq
if [ $? -eq 0 ]; then
echo "OK starter ready"
exit 0
else
echo "ERROR starter not ready, giving up"
exit 1
fi
fi
Loading