From 0bd2e4bd1af44ecabb80bc327ae04e610ce15912 Mon Sep 17 00:00:00 2001 From: Anthony Mahanna Date: Thu, 9 Nov 2023 18:30:24 -0500 Subject: [PATCH 01/27] Update config.yml --- .circleci/config.yml | 217 +++++++++++++++---------------------------- 1 file changed, 75 insertions(+), 142 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 921a3bf7..f08294d2 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -1,164 +1,97 @@ version: 2.1 -parameters: - preview: - type: boolean - default: true - 3-10: - type: boolean - default: true - 3-11: - type: boolean - default: true +# orbs: +# coveralls: coveralls/coveralls@2.2.1 + +workflows: + ci: + jobs: + - lint + - test: + matrix: + parameters: + 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: - run-tests: + 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: resource_class: small parameters: - python-version: + python_version: type: string - default: "latest" - arangodb-version: + arangodb_config: type: string - default: "arangodb:latest" - arangodb-config: + arangodb_license: + type: string + arangodb_version: type: string - default: "single.conf" - cluster: - type: boolean - default: false - enterprise: - type: boolean - default: false docker: - - image: python:<< parameters.python-version >> - command: ["/bin/sh", "-c", "python -m http.server"] - - image: arangodb/<< parameters.arangodb-version >> - environment: - ARANGODB_CONF: << parameters.arangodb-config >> - PROJECT: /root/project - command: - - "/bin/sh" - - "-c" - - > - while ! wget -q -O /dev/null http://localhost:8000/$PROJECT/tests/static/setup.sh; do sleep 1; done && - wget -O - http://localhost:8000/$PROJECT/tests/static/setup.sh | - /bin/sh + - image: cimg/python:<< parameters.python_version >> steps: - checkout + - setup_remote_docker + - run: - name: "Install Dependencies" + name: Set Up ArangoDB command: | - pip install -e .[dev] + chmod +x starter.sh + ./starter.sh << parameters.arangodb_config >> << parameters.arangodb_license >> << parameters.arangodb_version >> + - run: - name: "Wait for ArangoDB starter" - command: | - wget --quiet --waitretry=1 --tries=120 -O - http://localhost:8528/version - if [ $? -eq 0 ]; then - echo "starter ready" - exit 0 - else - echo "starter not ready, giving up" - exit 1 - fi + name: "Install Dependencies" + command: pip install -e .[dev] pytest + + - run: + name: "Sleep" + command: sleep 15 + + - run: docker ps -a + + # - run: docker logs arango + + - run: curl -v http://localhost:8529/ + - run: name: "Run pytest" command: | - mkdir test-results - args=("--junitxml=test-results/junit.xml" "--log-cli-level=DEBUG" "--host" "localhost") - if [ << parameters.cluster >> = true ]; then - args+=("--cluster" "--port=8529" "--port=8539" "--port=8549") - else - args+=("--port=8529") + args=("--junitxml=test-results/junit.xml" "--log-cli-level=DEBUG" "--host" "arango" "--port=8529") + + if [ << parameters.arangodb_config >> = "cluster" ]; then + args+=("--cluster" "--port=8539" "--port=8549") fi - if [ << parameters.enterprise >> = true ]; then + + if [ << parameters.arangodb_license >> = "enterprise" ]; then args+=("--enterprise") fi - echo "Running py.test with args: ${args[@]}" - py.test "${args[@]}" - - store_artifacts: - path: test-results - - store_test_results: - path: test-results -workflows: - python-3.8-community-single-3.10: - when: << pipeline.parameters.3-10 >> - jobs: - - run-tests: - name: python-3.8-community-single-3.10 - python-version: "3.8.2" - arangodb-version: "arangodb:3.10.10" - arangodb-config: "single-3.10.conf" - cluster: false - enterprise: false - python-3.8-enterprise-cluster-3.10: - when: << pipeline.parameters.3-10 >> - jobs: - - run-tests: - name: python-3.8-enterprise-cluster-3.10 - python-version: "3.8.2" - arangodb-version: "enterprise:3.10.10" - arangodb-config: "cluster-3.10.conf" - cluster: true - enterprise: true - python-3.10-community-single-3.11: - when: << pipeline.parameters.3-11 >> - jobs: - - run-tests: - name: python-3.10-community-single-3.11 - python-version: "3.10.6" - arangodb-version: "arangodb:3.11.4" - arangodb-config: "single.conf" - cluster: false - enterprise: false - python-3.10-community-cluster-3.11: - when: << pipeline.parameters.3-11 >> - jobs: - - run-tests: - name: python-3.10-community-cluster-3.11 - python-version: "3.10.6" - arangodb-version: "arangodb:3.11.4" - arangodb-config: "cluster.conf" - cluster: true - enterprise: false - python-3.10-enterprise-single-3.11: - when: << pipeline.parameters.3-11 >> - jobs: - - run-tests: - name: python-3.10-enterprise-single-3.11 - python-version: "3.10.6" - arangodb-version: "enterprise:3.11.4" - arangodb-config: "single.conf" - cluster: false - enterprise: true - python-3.10-enterprise-cluster-3.11: - when: << pipeline.parameters.3-11 >> - jobs: - - run-tests: - name: python-3.10-enterprise-cluster-3.11 - python-version: "3.10.6" - arangodb-version: "enterprise:3.11.4" - arangodb-config: "cluster.conf" - cluster: true - enterprise: true - python-latest-enterprise-single-preview: - when: << pipeline.parameters.preview >> - jobs: - - run-tests: - name: python-latest-enterprise-single-preview - python-version: "latest" - arangodb-version: "enterprise-preview:latest" - arangodb-config: "single.conf" - cluster: false - enterprise: true - python-latest-enterprise-cluster-preview: - when: << pipeline.parameters.preview >> - jobs: - - run-tests: - name: python-latest-enterprise-cluster-preview - python-version: "latest" - arangodb-version: "enterprise-preview:latest" - arangodb-config: "cluster.conf" - cluster: true - enterprise: true + echo "Running pytest with args: ${args[@]}" + pytest --cov=arango --cov-report=xml "${args[@]}" + + # - coveralls/upload From 631fbaee796c69d25d7c93d33c06c94641b85cbd Mon Sep 17 00:00:00 2001 From: Anthony Mahanna Date: Thu, 9 Nov 2023 18:30:26 -0500 Subject: [PATCH 02/27] Update build.yaml --- .github/workflows/build.yaml | 109 ++++++++++++++++++++++++++++++----- 1 file changed, 96 insertions(+), 13 deletions(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index a542f28b..7f2c8e52 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -1,23 +1,106 @@ name: Build -on: - pull_request: - branches: [main] - workflow_dispatch: - inputs: - debug_enabled: - type: boolean - description: Debug with tmate - required: false - default: false +on: push +# on: +# pull_request: +# branches: [main] +# workflow_dispatch: +# inputs: +# debug_enabled: +# type: boolean +# description: Debug with tmate +# required: false +# default: false jobs: + lint: + runs-on: ubuntu-latest + + steps: + - name: Check out code + uses: actions/checkout@v4 + + - name: Set up Python + uses: actions/setup-python@v4 + with: + python-version: '3.10' + + - name: Install Dependencies + run: pip install .[dev] + + - name: Run black + run: black --check --verbose --diff --color --config=pyproject.toml ./arango ./tests/ + + - name: Run flake8 + run: flake8 ./arango ./tests + + - name: Run isort + run: isort --check ./arango ./tests + + - name: Run mypy + run: mypy ./arango + + test: + runs-on: ubuntu-latest + + strategy: + fail-fast: false + matrix: + 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"] + + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Set up Python + uses: actions/setup-python@v4 + with: + python-version: ${{ matrix.python_version }} + + - name: Setup ArangoDB + run: | + chmod +x starter.sh + ./starter.sh ${{ matrix.arangodb_config }} ${{ matrix.arangodb_license }} ${{ matrix.arangodb_version }} + + - name: Install Dependencies + run: pip install -e .[dev] + + # - name: Sleep + # run: sleep 15 + + - name: List Docker Containers + run: docker ps -a + + # - name: Show Docker Logs + # run: docker logs arango + + # - name: Curl Request + # run: curl -v http://localhost:8529/ + + - name: Pytest + run: | + args=("--host" "localhost" "--port=8529") + + if [ ${{ matrix.arangodb_config }} = "cluster" ]; then + args+=("--cluster" "--port=8539" "--port=8549") + fi + + if [ ${{ matrix.arangodb_license }} = "enterprise" ]; then + args+=("--enterprise") + fi + + echo "Running pytest with args: ${args[@]}" + pytest -k "test_client_good_connection" --cov=arango --cov-report=xml "${args[@]}" + docs: - runs-on: ubuntu-22.04 + runs-on: ubuntu-latest steps: - name: Checkout repository - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Fetch all tags and branches run: git fetch --prune --unshallow @@ -25,7 +108,7 @@ jobs: - name: Create ArangoDB Docker container run: > docker create --name arango -p 8529:8529 -e ARANGO_ROOT_PASSWORD=passwd -v "$(pwd)/tests/static/":/tests/static - arangodb/arangodb:3.11.4 --server.jwt-secret-keyfile=/tests/static/keyfile + arangodb/arangodb:latest --server.jwt-secret-keyfile=/tests/static/keyfile - name: Start ArangoDB Docker container run: docker start arango From 2d411e67df3381a0c13110da13516c52828282da Mon Sep 17 00:00:00 2001 From: Anthony Mahanna Date: Thu, 9 Nov 2023 18:30:27 -0500 Subject: [PATCH 03/27] Update starter.sh --- starter.sh | 91 ++++++++++++++++++++---------------------------------- 1 file changed, 34 insertions(+), 57 deletions(-) diff --git a/starter.sh b/starter.sh index e69ce24b..b0374c58 100755 --- a/starter.sh +++ b/starter.sh @@ -9,74 +9,51 @@ # ./starter.sh cluster enterprise 3.11.4 setup="${1:-single}" -if [[ "$setup" != "single" && "$setup" != "cluster" ]]; then +license="${2:-community}" +version="${3:-latest}" + +extra_ports="" +if [ "$setup" == "single" ]; then + echo "" +elif [ "$setup" == "cluster" ]; then + extra_ports="-p 8539:8539 -p 8549:8549" +else echo "Invalid argument. Please provide either 'single' or 'cluster'." exit 1 fi -license="${2:-all}" -if [[ "$license" != "community" && "$license" != "enterprise" ]]; then +image_name="" +if [ "$license" == "community" ]; then + image_name="arangodb" +elif [ "$license" == "enterprise" ]; then + image_name="enterprise" +else echo "Invalid argument. Please provide either 'community' or 'enterprise'." exit 1 fi -version="${3:-3.11.4}" - -if [ "$setup" == "single" ]; then - if [ "$license" == "community" ]; then - echo "Starting community single server..." - docker run -d --rm \ - --name arango \ - -p 8528:8528 \ - -p 8529:8529 \ - -v "$(pwd)/tests/static/":/tests/static \ - -v /tmp:/tmp \ - arangodb/arangodb:"$version" \ - /bin/sh -c "arangodb --configuration=/tests/static/single.conf" - elif [ "$license" == "enterprise" ]; then - echo "Starting enterprise single server..." - docker run -d --rm \ - --name arango \ - -p 8528:8528 \ - -p 8529:8529 \ - -v "$(pwd)/tests/static/":/tests/static \ - -v /tmp:/tmp \ - arangodb/enterprise:"$version" \ - /bin/sh -c "arangodb --configuration=/tests/static/single.conf" - fi -elif [ "$setup" == "cluster" ]; then - if [ "$license" == "community" ]; then - echo "Starting community cluster..." - docker run -d --rm \ - --name arango \ - -p 8528:8528 \ - -p 8529:8529 \ - -p 8539:8539 \ - -p 8549:8549 \ - -v "$(pwd)/tests/static/":/tests/static \ - -v /tmp:/tmp \ - arangodb/arangodb:"$version" \ - /bin/sh -c "arangodb --configuration=/tests/static/cluster.conf" - elif [ "$license" == "enterprise" ]; then - echo "Starting enterprise cluster..." - docker run -d --rm \ - --name arango \ - -p 8528:8528 \ - -p 8529:8529 \ - -p 8539:8539 \ - -p 8549:8549 \ - -v "$(pwd)/tests/static/":/tests/static \ - -v /tmp:/tmp \ - arangodb/enterprise:"$version" \ - /bin/sh -c "arangodb --configuration=/tests/static/cluster.conf" - fi +conf_file="" +if [[ "${version%.*}" == "3.10" ]]; then + conf_file="${setup}-3.10" +else + conf_file="${setup}" fi +docker run -d --rm \ + --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=120 -O - http://localhost:8528/version | jq if [ $? -eq 0 ]; then - echo "OK starter ready" - exit 0 + echo "OK starter ready" + exit 0 else - echo "ERROR starter not ready, giving up" - exit 1 + echo "ERROR starter not ready, giving up" + exit 1 fi From 987fdff3b5ce008200764f5ccbe2b0793d6c7dda Mon Sep 17 00:00:00 2001 From: Anthony Mahanna Date: Thu, 9 Nov 2023 18:31:51 -0500 Subject: [PATCH 04/27] remove `pytest -k` flag --- .github/workflows/build.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 7f2c8e52..ad74e62b 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -93,7 +93,7 @@ jobs: fi echo "Running pytest with args: ${args[@]}" - pytest -k "test_client_good_connection" --cov=arango --cov-report=xml "${args[@]}" + pytest --cov=arango --cov-report=xml "${args[@]}" docs: runs-on: ubuntu-latest From e659ec4cb4b9feb8febcf9f5794b27fd23dd9dd9 Mon Sep 17 00:00:00 2001 From: Anthony Mahanna Date: Thu, 9 Nov 2023 18:40:21 -0500 Subject: [PATCH 05/27] include all arangodb variations --- .github/workflows/build.yaml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index ad74e62b..f4ea665a 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -47,9 +47,9 @@ jobs: fail-fast: false matrix: 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"] + arangodb_config: ["single", "cluster"] + arangodb_license: ["community", "enterprise"] + arangodb_version: ["3.10.10", "3.11.4", "latest"] steps: - name: Checkout code From 637ef12def495f84e8b2ef5054414a6b113e3175 Mon Sep 17 00:00:00 2001 From: Anthony Mahanna Date: Thu, 9 Nov 2023 18:54:35 -0500 Subject: [PATCH 06/27] cleanup --- .github/workflows/build.yaml | 31 +++++++++++-------------------- 1 file changed, 11 insertions(+), 20 deletions(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index f4ea665a..dac043d4 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -1,16 +1,14 @@ name: Build -on: push -# on: -# pull_request: -# branches: [main] -# workflow_dispatch: -# inputs: -# debug_enabled: -# type: boolean -# description: Debug with tmate -# required: false -# default: false +on: + pull_request: + workflow_dispatch: + inputs: + debug_enabled: + type: boolean + description: Debug with tmate + required: false + default: false jobs: lint: @@ -51,6 +49,8 @@ jobs: arangodb_license: ["community", "enterprise"] arangodb_version: ["3.10.10", "3.11.4", "latest"] + name: Python ${{ matrix.python_version }} - ArangoDB ${{ matrix.arangodb_config }}:${{ matrix.arangodb_license }}:${{ matrix.arangodb_version }} + steps: - name: Checkout code uses: actions/checkout@v4 @@ -68,18 +68,9 @@ jobs: - name: Install Dependencies run: pip install -e .[dev] - # - name: Sleep - # run: sleep 15 - - name: List Docker Containers run: docker ps -a - # - name: Show Docker Logs - # run: docker logs arango - - # - name: Curl Request - # run: curl -v http://localhost:8529/ - - name: Pytest run: | args=("--host" "localhost" "--port=8529") From 2b44bddd8430a0c31e7484f7c6516379f1bf950b Mon Sep 17 00:00:00 2001 From: Anthony Mahanna Date: Thu, 9 Nov 2023 19:00:23 -0500 Subject: [PATCH 07/27] update job names --- .github/workflows/build.yaml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index dac043d4..8cde4c9d 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -14,6 +14,8 @@ jobs: lint: runs-on: ubuntu-latest + name: Lint + steps: - name: Check out code uses: actions/checkout@v4 @@ -49,7 +51,7 @@ jobs: arangodb_license: ["community", "enterprise"] arangodb_version: ["3.10.10", "3.11.4", "latest"] - name: Python ${{ matrix.python_version }} - ArangoDB ${{ matrix.arangodb_config }}:${{ matrix.arangodb_license }}:${{ matrix.arangodb_version }} + name: Test (${{ matrix.python_version }}:${{ matrix.arangodb_config }}:${{ matrix.arangodb_license }}:${{ matrix.arangodb_version }}) steps: - name: Checkout code @@ -89,6 +91,8 @@ jobs: docs: runs-on: ubuntu-latest + name: Sphinx Docs + steps: - name: Checkout repository uses: actions/checkout@v4 From fa3742b178cc0e3c703f9be23e36a0b7ce9f78df Mon Sep 17 00:00:00 2001 From: Anthony Mahanna Date: Thu, 9 Nov 2023 19:01:00 -0500 Subject: [PATCH 08/27] Update build.yaml --- .github/workflows/build.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 8cde4c9d..73e015ce 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -91,7 +91,7 @@ jobs: docs: runs-on: ubuntu-latest - name: Sphinx Docs + name: Docs steps: - name: Checkout repository From ce8ab60ceba5c1b4eb22a3d30670bc0e5bd6cc21 Mon Sep 17 00:00:00 2001 From: Anthony Mahanna Date: Fri, 10 Nov 2023 10:24:59 -0500 Subject: [PATCH 09/27] Update config.yml --- .circleci/config.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index f08294d2..91f27a24 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -52,11 +52,11 @@ jobs: type: string arangodb_version: type: string - docker: - - image: cimg/python:<< parameters.python_version >> + machine: + image: ubuntu-2004:202101-01 steps: - checkout - - setup_remote_docker + # - setup_remote_docker - run: name: Set Up ArangoDB @@ -74,7 +74,7 @@ jobs: - run: docker ps -a - # - run: docker logs arango + - run: docker logs arango - run: curl -v http://localhost:8529/ From f828f192680bebe94f6b0f74a8710e629ae929b0 Mon Sep 17 00:00:00 2001 From: Anthony Mahanna Date: Fri, 10 Nov 2023 10:28:08 -0500 Subject: [PATCH 10/27] Update config.yml --- .circleci/config.yml | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 91f27a24..c5c1e347 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -56,7 +56,6 @@ jobs: image: ubuntu-2004:202101-01 steps: - checkout - # - setup_remote_docker - run: name: Set Up ArangoDB @@ -64,13 +63,18 @@ jobs: chmod +x starter.sh ./starter.sh << parameters.arangodb_config >> << parameters.arangodb_license >> << parameters.arangodb_version >> + - restore_cache: + key: pip-and-local-cache + - run: - name: "Install Dependencies" - command: pip install -e .[dev] pytest + name: Setup Python + command: | + pyenv install << parameters.python_version >> + pyenv global << parameters.python_version >> - run: - name: "Sleep" - command: sleep 15 + name: "Install Dependencies" + command: pip install -e .[dev] pytest - run: docker ps -a From cc58450a26f2ed56cf98d03a9cd19a718bfef2c4 Mon Sep 17 00:00:00 2001 From: Anthony Mahanna Date: Fri, 10 Nov 2023 10:29:24 -0500 Subject: [PATCH 11/27] Update config.yml --- .circleci/config.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index c5c1e347..cf1e2865 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -53,7 +53,7 @@ jobs: arangodb_version: type: string machine: - image: ubuntu-2004:202101-01 + image: ubuntu-2204:2023.10.1 steps: - checkout From 52e9cec47beacd2523cb028c877fc43c26480cfb Mon Sep 17 00:00:00 2001 From: Anthony Mahanna Date: Fri, 10 Nov 2023 10:39:35 -0500 Subject: [PATCH 12/27] Update config.yml --- .circleci/config.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index cf1e2865..fc1e30fb 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -96,6 +96,6 @@ jobs: fi echo "Running pytest with args: ${args[@]}" - pytest --cov=arango --cov-report=xml "${args[@]}" + py.test --cov=arango --cov-report=xml "${args[@]}" # - coveralls/upload From 3d8c47b2678b1584cd73a99c70f25a04a64a97e6 Mon Sep 17 00:00:00 2001 From: Anthony Mahanna Date: Fri, 10 Nov 2023 10:49:53 -0500 Subject: [PATCH 13/27] Update config.yml --- .circleci/config.yml | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index fc1e30fb..264fce10 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -74,7 +74,7 @@ jobs: - run: name: "Install Dependencies" - command: pip install -e .[dev] pytest + command: pip install -e .[dev] - run: docker ps -a @@ -85,17 +85,24 @@ jobs: - run: name: "Run pytest" command: | - args=("--junitxml=test-results/junit.xml" "--log-cli-level=DEBUG" "--host" "arango" "--port=8529") + mkdir test-results + args=("--junitxml=test-results/junit.xml" "--log-cli-level=DEBUG" "--host" "localhost" "--port=8529") if [ << parameters.arangodb_config >> = "cluster" ]; then - args+=("--cluster" "--port=8539" "--port=8549") + args+=("--cluster" "--port=8529" "--port=8539" "--port=8549") fi - + if [ << parameters.arangodb_license >> = "enterprise" ]; then args+=("--enterprise") fi - echo "Running pytest with args: ${args[@]}" - py.test --cov=arango --cov-report=xml "${args[@]}" + echo "Running py.test with args: ${args[@]}" + pytest "${args[@]}" + + - store_artifacts: + path: test-results + + - store_test_results: + path: test-results # - coveralls/upload From c9194351c6c55d6f6cc4c1f990823a68377135de Mon Sep 17 00:00:00 2001 From: Anthony Mahanna Date: Fri, 10 Nov 2023 10:55:52 -0500 Subject: [PATCH 14/27] fix --port flag --- .circleci/config.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 264fce10..7d8e76e0 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -89,14 +89,14 @@ jobs: args=("--junitxml=test-results/junit.xml" "--log-cli-level=DEBUG" "--host" "localhost" "--port=8529") if [ << parameters.arangodb_config >> = "cluster" ]; then - args+=("--cluster" "--port=8529" "--port=8539" "--port=8549") + args+=("--cluster" "--port=8539" "--port=8549") fi if [ << parameters.arangodb_license >> = "enterprise" ]; then args+=("--enterprise") fi - echo "Running py.test with args: ${args[@]}" + echo "Running pytest with args: ${args[@]}" pytest "${args[@]}" - store_artifacts: From b6a567de93ec984e83a61931c233e8253b470a0e Mon Sep 17 00:00:00 2001 From: Anthony Mahanna Date: Fri, 10 Nov 2023 10:55:57 -0500 Subject: [PATCH 15/27] fail test on purpose --- tests/test_client.py | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/test_client.py b/tests/test_client.py index 5faa84db..eafc3485 100644 --- a/tests/test_client.py +++ b/tests/test_client.py @@ -55,6 +55,7 @@ def test_client_attributes(): def test_client_good_connection(db, username, password): + assert False client = ArangoClient(hosts="http://127.0.0.1:8529") # Test connection with verify flag on and off From a389c944327a8f11bcc68ebd65dca955e2baa877 Mon Sep 17 00:00:00 2001 From: Anthony Mahanna Date: Fri, 10 Nov 2023 11:07:05 -0500 Subject: [PATCH 16/27] remove test failure --- tests/test_client.py | 1 - 1 file changed, 1 deletion(-) diff --git a/tests/test_client.py b/tests/test_client.py index eafc3485..5faa84db 100644 --- a/tests/test_client.py +++ b/tests/test_client.py @@ -55,7 +55,6 @@ def test_client_attributes(): def test_client_good_connection(db, username, password): - assert False client = ArangoClient(hosts="http://127.0.0.1:8529") # Test connection with verify flag on and off From 0096dc9fe622b66a09a67e325b86cc9c4531c273 Mon Sep 17 00:00:00 2001 From: Anthony Mahanna Date: Fri, 10 Nov 2023 11:08:00 -0500 Subject: [PATCH 17/27] Update config.yml --- .circleci/config.yml | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 7d8e76e0..711e2339 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -11,9 +11,9 @@ workflows: matrix: parameters: 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"] + arangodb_config: ["single", "cluster"] + arangodb_license: ["community", "enterprise"] + arangodb_version: ["3.10.10", "3.11.4", "latest"] jobs: lint: @@ -78,10 +78,6 @@ jobs: - run: docker ps -a - - run: docker logs arango - - - run: curl -v http://localhost:8529/ - - run: name: "Run pytest" command: | @@ -97,7 +93,7 @@ jobs: fi echo "Running pytest with args: ${args[@]}" - pytest "${args[@]}" + pytest --cov=arango --cov-report=xml "${args[@]}" - store_artifacts: path: test-results From e3c9af2897b26e06edb5c01c444826be854b5c26 Mon Sep 17 00:00:00 2001 From: Anthony Mahanna Date: Fri, 10 Nov 2023 11:30:40 -0500 Subject: [PATCH 18/27] rename `build.yaml` to `docs.yaml` --- .github/workflows/build.yaml | 130 ----------------------------------- .github/workflows/docs.yaml | 102 +++++++++++++++++++++++++++ 2 files changed, 102 insertions(+), 130 deletions(-) delete mode 100644 .github/workflows/build.yaml create mode 100644 .github/workflows/docs.yaml diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml deleted file mode 100644 index 73e015ce..00000000 --- a/.github/workflows/build.yaml +++ /dev/null @@ -1,130 +0,0 @@ -name: Build - -on: - pull_request: - workflow_dispatch: - inputs: - debug_enabled: - type: boolean - description: Debug with tmate - required: false - default: false - -jobs: - lint: - runs-on: ubuntu-latest - - name: Lint - - steps: - - name: Check out code - uses: actions/checkout@v4 - - - name: Set up Python - uses: actions/setup-python@v4 - with: - python-version: '3.10' - - - name: Install Dependencies - run: pip install .[dev] - - - name: Run black - run: black --check --verbose --diff --color --config=pyproject.toml ./arango ./tests/ - - - name: Run flake8 - run: flake8 ./arango ./tests - - - name: Run isort - run: isort --check ./arango ./tests - - - name: Run mypy - run: mypy ./arango - - test: - runs-on: ubuntu-latest - - strategy: - fail-fast: false - matrix: - python_version: ["3.10"] #["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"] - - name: Test (${{ matrix.python_version }}:${{ matrix.arangodb_config }}:${{ matrix.arangodb_license }}:${{ matrix.arangodb_version }}) - - steps: - - name: Checkout code - uses: actions/checkout@v4 - - - name: Set up Python - uses: actions/setup-python@v4 - with: - python-version: ${{ matrix.python_version }} - - - name: Setup ArangoDB - run: | - chmod +x starter.sh - ./starter.sh ${{ matrix.arangodb_config }} ${{ matrix.arangodb_license }} ${{ matrix.arangodb_version }} - - - name: Install Dependencies - run: pip install -e .[dev] - - - name: List Docker Containers - run: docker ps -a - - - name: Pytest - run: | - args=("--host" "localhost" "--port=8529") - - if [ ${{ matrix.arangodb_config }} = "cluster" ]; then - args+=("--cluster" "--port=8539" "--port=8549") - fi - - if [ ${{ matrix.arangodb_license }} = "enterprise" ]; then - args+=("--enterprise") - fi - - echo "Running pytest with args: ${args[@]}" - pytest --cov=arango --cov-report=xml "${args[@]}" - - docs: - runs-on: ubuntu-latest - - name: Docs - - steps: - - name: Checkout repository - uses: actions/checkout@v4 - - - name: Fetch all tags and branches - run: git fetch --prune --unshallow - - - name: Create ArangoDB Docker container - run: > - docker create --name arango -p 8529:8529 -e ARANGO_ROOT_PASSWORD=passwd -v "$(pwd)/tests/static/":/tests/static - arangodb/arangodb:latest --server.jwt-secret-keyfile=/tests/static/keyfile - - - name: Start ArangoDB Docker container - run: docker start arango - - - name: Set up Python - uses: actions/setup-python@v4 - with: - python-version: '3.10' - - - name: Debug with tmate - uses: mxschmitt/action-tmate@v3 - if: ${{ github.event_name == 'workflow_dispatch' && inputs.debug_enabled }} - - - name: Run pre-commit checks - uses: pre-commit/action@v3.0.0 - - - name: Install dependencies - run: pip install .[dev] - - - name: Run Sphinx doctest - run: python -m sphinx -b doctest docs docs/_build - - - name: Generate Sphinx HTML - run: python -m sphinx -b html -W docs docs/_build diff --git a/.github/workflows/docs.yaml b/.github/workflows/docs.yaml new file mode 100644 index 00000000..bc06e12e --- /dev/null +++ b/.github/workflows/docs.yaml @@ -0,0 +1,102 @@ +name: Docs + +on: + pull_request: + workflow_dispatch: + inputs: + debug_enabled: + type: boolean + description: Debug with tmate + required: false + default: false + +jobs: + # This has been migrated to CircleCI + # test: + # runs-on: ubuntu-latest + + # strategy: + # fail-fast: false + # matrix: + # python_version: ["3.10"] #["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"] + + # name: Test (${{ matrix.python_version }}:${{ matrix.arangodb_config }}:${{ matrix.arangodb_license }}:${{ matrix.arangodb_version }}) + + # steps: + # - name: Checkout code + # uses: actions/checkout@v4 + + # - name: Set up Python + # uses: actions/setup-python@v4 + # with: + # python-version: ${{ matrix.python_version }} + + # - name: Setup ArangoDB + # run: | + # chmod +x starter.sh + # ./starter.sh ${{ matrix.arangodb_config }} ${{ matrix.arangodb_license }} ${{ matrix.arangodb_version }} + + # - name: Install Dependencies + # run: pip install -e .[dev] + + # - name: List Docker Containers + # run: docker ps -a + + # - name: Pytest + # run: | + # args=("--host" "localhost" "--port=8529") + + # if [ ${{ matrix.arangodb_config }} = "cluster" ]; then + # args+=("--cluster" "--port=8539" "--port=8549") + # fi + + # if [ ${{ matrix.arangodb_license }} = "enterprise" ]; then + # args+=("--enterprise") + # fi + + # echo "Running pytest with args: ${args[@]}" + # pytest --cov=arango --cov-report=xml "${args[@]}" + + docs: + runs-on: ubuntu-latest + + name: Docs + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Fetch all tags and branches + run: git fetch --prune --unshallow + + - name: Create ArangoDB Docker container + run: > + docker create --name arango -p 8529:8529 -e ARANGO_ROOT_PASSWORD=passwd -v "$(pwd)/tests/static/":/tests/static + arangodb/arangodb:latest --server.jwt-secret-keyfile=/tests/static/keyfile + + - name: Start ArangoDB Docker container + run: docker start arango + + - name: Set up Python + uses: actions/setup-python@v4 + with: + python-version: '3.10' + + - name: Debug with tmate + uses: mxschmitt/action-tmate@v3 + if: ${{ github.event_name == 'workflow_dispatch' && inputs.debug_enabled }} + + - name: Run pre-commit checks + uses: pre-commit/action@v3.0.0 + + - name: Install dependencies + run: pip install .[dev] + + - name: Run Sphinx doctest + run: python -m sphinx -b doctest docs docs/_build + + - name: Generate Sphinx HTML + run: python -m sphinx -b html -W docs docs/_build From 6425d281ef6dbe28f3041285a2dae7b547196eed Mon Sep 17 00:00:00 2001 From: Anthony Mahanna Date: Fri, 10 Nov 2023 11:30:48 -0500 Subject: [PATCH 19/27] use all python versions --- .circleci/config.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 711e2339..5ef4eaca 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -10,7 +10,7 @@ workflows: - test: matrix: parameters: - python_version: ["3.10"] # ["3.8", "3.9", "3.10", "3.11", "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"] From fb7eb0ad4c95e6864f5f1106d9c4909551ebb190 Mon Sep 17 00:00:00 2001 From: Anthony Mahanna Date: Fri, 10 Nov 2023 12:28:29 -0500 Subject: [PATCH 20/27] Update config.yml --- .circleci/config.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 5ef4eaca..eaab9378 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -42,7 +42,7 @@ jobs: command: mypy ./arango test: - resource_class: small + resource_class: medium parameters: python_version: type: string @@ -53,7 +53,7 @@ jobs: arangodb_version: type: string machine: - image: ubuntu-2204:2023.10.1 + image: ubuntu-2004 steps: - checkout @@ -87,7 +87,7 @@ jobs: if [ << parameters.arangodb_config >> = "cluster" ]; then args+=("--cluster" "--port=8539" "--port=8549") fi - + if [ << parameters.arangodb_license >> = "enterprise" ]; then args+=("--enterprise") fi From 1695a651f9fc0ec247a528fe00170c0ff0928a8a Mon Sep 17 00:00:00 2001 From: Anthony Mahanna Date: Fri, 10 Nov 2023 12:29:35 -0500 Subject: [PATCH 21/27] Update config.yml --- .circleci/config.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index eaab9378..45288ee8 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -42,7 +42,6 @@ jobs: command: mypy ./arango test: - resource_class: medium parameters: python_version: type: string From d569547e079906a55459be7126f08bc625dbc41b Mon Sep 17 00:00:00 2001 From: Anthony Mahanna Date: Fri, 10 Nov 2023 12:30:28 -0500 Subject: [PATCH 22/27] Update config.yml --- .circleci/config.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 45288ee8..bfb8e842 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -52,7 +52,7 @@ jobs: arangodb_version: type: string machine: - image: ubuntu-2004 + image: ubuntu-2004:current steps: - checkout From 30508c2b489aada97f7c7e56c56332d3fdb839e5 Mon Sep 17 00:00:00 2001 From: Anthony Mahanna Date: Fri, 10 Nov 2023 12:53:19 -0500 Subject: [PATCH 23/27] Update config.yml --- .circleci/config.yml | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index bfb8e842..dbc3aa5a 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -65,10 +65,16 @@ jobs: - restore_cache: key: pip-and-local-cache + # TODO: Revisit this bottleneck - run: name: Setup Python command: | - pyenv install << parameters.python_version >> + pyenv update + if ! pyenv versions | grep -q << parameters.python_version >>; then + pyenv install << parameters.python_version >> + else + echo "<< parameters.python_version >> already installed" + fi pyenv global << parameters.python_version >> - run: From 5fe59c547868ebc1266b8acde3bd4336f6a3d978 Mon Sep 17 00:00:00 2001 From: Anthony Mahanna Date: Fri, 10 Nov 2023 12:59:17 -0500 Subject: [PATCH 24/27] Update config.yml --- .circleci/config.yml | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index dbc3aa5a..ac0a86ae 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -52,7 +52,7 @@ jobs: arangodb_version: type: string machine: - image: ubuntu-2004:current + image: ubuntu-2204:current steps: - checkout @@ -69,12 +69,8 @@ jobs: - run: name: Setup Python command: | - pyenv update - if ! pyenv versions | grep -q << parameters.python_version >>; then - pyenv install << parameters.python_version >> - else - echo "<< parameters.python_version >> already installed" - fi + pyenv --version + pyenv install -f << parameters.python_version >> pyenv global << parameters.python_version >> - run: From 3b12712051adc4e78bf54cade6a0cb3d4b9e1d95 Mon Sep 17 00:00:00 2001 From: Anthony Mahanna Date: Fri, 10 Nov 2023 13:05:17 -0500 Subject: [PATCH 25/27] Update config.yml --- .circleci/config.yml | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index ac0a86ae..c47f4f7d 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -10,7 +10,8 @@ workflows: - test: matrix: parameters: - python_version: ["3.8", "3.9", "3.10", "3.11", "3.12"] + # 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"] @@ -102,4 +103,9 @@ jobs: - store_test_results: path: test-results - # - coveralls/upload + - run: + name: Upload to Coveralls + command: | + if [ "<< parameters.python_version >>" = "3.11" && "<< parameters.arangodb_config >>" == "single" && "<< parameters.arangodb_license >>" == "community" ]; then + coveralls/upload + fi From e77680ac46b4d90f6258b2911d05a0059865f526 Mon Sep 17 00:00:00 2001 From: Anthony Mahanna Date: Fri, 10 Nov 2023 13:16:18 -0500 Subject: [PATCH 26/27] Update config.yml --- .circleci/config.yml | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index c47f4f7d..ff6b5e4b 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -1,7 +1,7 @@ version: 2.1 -# orbs: -# coveralls: coveralls/coveralls@2.2.1 +orbs: + coveralls: coveralls/coveralls@2.2.1 workflows: ci: @@ -52,6 +52,8 @@ 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 steps: @@ -106,6 +108,6 @@ jobs: - run: name: Upload to Coveralls command: | - if [ "<< parameters.python_version >>" = "3.11" && "<< parameters.arangodb_config >>" == "single" && "<< parameters.arangodb_license >>" == "community" ]; then + if [ "<< parameters.python_version >>" = "3.11" && "<< parameters.arangodb_config >>" = "single" && "<< parameters.arangodb_license >>" = "community" && "<< parameters.arangodb_version >>" = "latest" ]; then coveralls/upload fi From eb8ce582e7b36acf71a51f1de43220c84842e133 Mon Sep 17 00:00:00 2001 From: Anthony Mahanna Date: Fri, 10 Nov 2023 13:18:19 -0500 Subject: [PATCH 27/27] Update config.yml --- .circleci/config.yml | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index ff6b5e4b..a75aba3e 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -1,7 +1,7 @@ version: 2.1 -orbs: - coveralls: coveralls/coveralls@2.2.1 +# orbs: +# coveralls: coveralls/coveralls@2.2.1 workflows: ci: @@ -105,9 +105,9 @@ jobs: - store_test_results: path: test-results - - run: - name: Upload to Coveralls - command: | - if [ "<< parameters.python_version >>" = "3.11" && "<< parameters.arangodb_config >>" = "single" && "<< parameters.arangodb_license >>" = "community" && "<< parameters.arangodb_version >>" = "latest" ]; then - coveralls/upload - fi + # - run: + # name: Upload to Coveralls + # command: | + # if [ "<< parameters.python_version >>" = "3.11" && "<< parameters.arangodb_config >>" = "single" && "<< parameters.arangodb_license >>" = "community" && "<< parameters.arangodb_version >>" = "latest" ]; then + # coveralls/upload + # fi