From e4ae59c7d9f277b1210dc7f19f4b6f7e899c61b3 Mon Sep 17 00:00:00 2001 From: Stefano Lottini Date: Thu, 11 Apr 2024 10:36:05 +0200 Subject: [PATCH] prepare CI workflow and bump to 1.0.0 --- .github/workflows/idiomatic_tests.yaml | 38 -------------------------- .github/workflows/main.yml | 21 +++++++++++--- README.md | 19 ++++++++++--- pyproject.toml | 2 +- 4 files changed, 33 insertions(+), 47 deletions(-) delete mode 100644 .github/workflows/idiomatic_tests.yaml diff --git a/.github/workflows/idiomatic_tests.yaml b/.github/workflows/idiomatic_tests.yaml deleted file mode 100644 index 21c3c605..00000000 --- a/.github/workflows/idiomatic_tests.yaml +++ /dev/null @@ -1,38 +0,0 @@ -name: Run Pytest on Idiomatic - -on: - push: - branches: - - pymongo-convergence-m1 - pull_request: - branches: - - pymongo-convergence-m1 - -jobs: - test: - env: - ASTRA_DB_API_ENDPOINT: ${{ secrets.ASTRA_DB_API_ENDPOINT }} - ASTRA_DB_APPLICATION_TOKEN: ${{ secrets.ASTRA_DB_APPLICATION_TOKEN }} - ASTRA_DB_ID: ${{ secrets.ASTRA_DB_ID }} - TEST_SKIP_COLLECTION_DELETE: ${{ secrets.TEST_SKIP_COLLECTION_DELETE }} - ASTRA_DB_SECONDARY_KEYSPACE: ${{ secrets.ASTRA_DB_SECONDARY_KEYSPACE }} - runs-on: ubuntu-latest - - steps: - - name: Checkout code - uses: actions/checkout@v2 - - - name: Set up Python - uses: actions/setup-python@v2 - with: - python-version: 3.11 - - - name: Install dependencies - run: | - python -m pip install --upgrade pip - pip install poetry - poetry install - - - name: Run pytest - run: | - poetry run pytest tests/idiomatic diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index b341c008..a0238217 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -11,11 +11,24 @@ on: jobs: test: env: - ASTRA_DB_API_ENDPOINT: ${{ secrets.ASTRA_DB_API_ENDPOINT }} + # basic secrets ASTRA_DB_APPLICATION_TOKEN: ${{ secrets.ASTRA_DB_APPLICATION_TOKEN }} - ASTRA_DB_ID: ${{ secrets.ASTRA_DB_ID }} - TEST_SKIP_COLLECTION_DELETE: ${{ secrets.TEST_SKIP_COLLECTION_DELETE }} + ASTRA_DB_API_ENDPOINT: ${{ secrets.ASTRA_DB_API_ENDPOINT }} + ASTRA_DB_KEYSPACE: ${{ secrets.ASTRA_DB_KEYSPACE }} ASTRA_DB_SECONDARY_KEYSPACE: ${{ secrets.ASTRA_DB_SECONDARY_KEYSPACE }} + # special setting to not drop any collection + TEST_SKIP_COLLECTION_DELETE: ${{ secrets.TEST_SKIP_COLLECTION_DELETE }} + # for admin-related testing if enabled + DO_IDIOMATIC_ADMIN_TESTS: ${{ secrets.DO_IDIOMATIC_ADMIN_TESTS }} + PROD_ADMIN_TEST_ASTRA_DB_APPLICATION_TOKEN: ${{ secrets.PROD_ADMIN_TEST_ASTRA_DB_APPLICATION_TOKEN }} + PROD_ADMIN_TEST_ASTRA_DB_PROVIDER: ${{ secrets.PROD_ADMIN_TEST_ASTRA_DB_PROVIDER }} + PROD_ADMIN_TEST_ASTRA_DB_REGION: ${{ secrets.PROD_ADMIN_TEST_ASTRA_DB_REGION }} + DEV_ADMIN_TEST_ASTRA_DB_APPLICATION_TOKEN: ${{ secrets.DEV_ADMIN_TEST_ASTRA_DB_APPLICATION_TOKEN }} + DEV_ADMIN_TEST_ASTRA_DB_PROVIDER: ${{ secrets.DEV_ADMIN_TEST_ASTRA_DB_PROVIDER }} + DEV_ADMIN_TEST_ASTRA_DB_REGION: ${{ secrets.DEV_ADMIN_TEST_ASTRA_DB_REGION }} + # for "core" ops testing + ASTRA_DB_ID: ${{ secrets.ASTRA_DB_ID }} + ASTRA_DB_OPS_APPLICATION_TOKEN: ${{ secrets.ASTRA_DB_OPS_APPLICATION_TOKEN }} runs-on: ubuntu-latest steps: @@ -35,4 +48,4 @@ jobs: - name: Run pytest run: | - poetry run pytest tests/core + poetry run pytest tests/idiomatic diff --git a/README.md b/README.md index fd332660..7855d2d3 100644 --- a/README.md +++ b/README.md @@ -199,7 +199,7 @@ naming convention and module structure). ### Running tests -Full testing requires environment variables: +"Full regular" testing requires environment variables: ```bash export ASTRA_DB_APPLICATION_TOKEN="AstraCS:..." @@ -213,8 +213,6 @@ export ASTRA_DB_SECONDARY_KEYSPACE="..." Tests can be started in various ways: ```bash -# test the core modules -poetry run pytest tests/core # test the "idiomatic" layer poetry run pytest tests/idiomatic poetry run pytest tests/idiomatic/unit @@ -222,11 +220,24 @@ poetry run pytest tests/idiomatic/integration # remove logging noise: poetry run pytest [...] -o log_cli=0 +``` + +The above runs the regular testing (i.e. non-Admin, non-core). +The (idiomatic) Admin part is tested manually by you, on Astra accounts with room +for up to 3 new databases, possibly both on prod and dev, and uses specific env vars, +as can be seen on `tests/idiomatic/integration/test_admin.py`. + +Should you be interested in testing the "core" modules, moreover, +this is also something for you to run manually (do that if you touch "core"): + +```bash +# test the core modules +poetry run pytest tests/core # do not drop collections: TEST_SKIP_COLLECTION_DELETE=1 poetry run pytest [...] -# include astrapy.core.ops testing (must cleanup after that): +# include astrapy.core.ops testing (tester must clean up after that): TEST_ASTRADBOPS=1 poetry run pytest [...] ``` diff --git a/pyproject.toml b/pyproject.toml index 3652876b..3671197f 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "astrapy" -version = "1.0.0rc1" +version = "1.0.0" description = "AstraPy is a Pythonic SDK for DataStax Astra and its Data API" authors = [ "Stefano Lottini ",