diff --git a/.github/workflows/client-test.yml b/.github/workflows/client-test.yml index 9bba477..571dafc 100644 --- a/.github/workflows/client-test.yml +++ b/.github/workflows/client-test.yml @@ -2,7 +2,7 @@ name: '🧪 Test Cloud Client' on: push: - branches: + branches: - 'main' paths: - '**.py' @@ -16,7 +16,7 @@ on: - edited - reopened - synchronize - branches: + branches: - 'main' paths: - '**.py' @@ -24,6 +24,9 @@ on: - '.github/workflows/*.json' - '!**/README.md' + schedule: + - cron: '0 12 * * *' # Runs every day at 12 PM UTC + jobs: build: runs-on: ubuntu-latest @@ -89,14 +92,18 @@ jobs: - name: '☁️ Connect to IoT cloud (CPython / Key-Cert Auth / Async)' env: DEVICE_ID: ${{ secrets.DEVICE_ID2 }} - SECRET_KEY: ${{ secrets.SECRET_KEY }} run: | python tests/ci.py --file-auth + - name: '☁️ Connect to IoT cloud (CPython / Key-Cert Auth / CADATA / Async)' + env: + DEVICE_ID: ${{ secrets.DEVICE_ID2 }} + run: | + python tests/ci.py --file-auth --ca-data + - name: '☁️ Connect to IoT cloud (CPython / Crypto Auth / Async)' env: DEVICE_ID: ${{ secrets.DEVICE_ID2 }} - SECRET_KEY: ${{ secrets.SECRET_KEY }} run: | export SOFTHSM2_CONF="${HOME}/softhsm/tokens/softhsm2.conf" python tests/ci.py --crypto-device @@ -122,7 +129,6 @@ jobs: - name: '☁️ Connect to IoT cloud (MicroPython / Key-Cert Auth / Async)' env: DEVICE_ID: ${{ secrets.DEVICE_ID2 }} - SECRET_KEY: ${{ secrets.SECRET_KEY }} run: | export PATH="${HOME}/cache/bin:${PATH}" micropython -c "import sys; print(sys.path)" diff --git a/tests/ci.py b/tests/ci.py index bb090ad..17892e2 100644 --- a/tests/ci.py +++ b/tests/ci.py @@ -8,6 +8,7 @@ import asyncio from arduino_iot_cloud import ArduinoCloudClient from arduino_iot_cloud import Task +from arduino_iot_cloud import CADATA # noqa import argparse @@ -25,7 +26,7 @@ def on_value_changed(client, value): def wdt_task(client, args, ts=[None]): if ts[0] is None: ts[0] = time.time() - if time.time() - ts[0] > 10: + if time.time() - ts[0] > 20: loop = asyncio.get_event_loop() loop.set_exception_handler(exception_handler) logging.error("Timeout waiting for variable") @@ -47,6 +48,9 @@ def wdt_task(client, args, ts=[None]): parser.add_argument( "-f", "--file-auth", action="store_true", help="Use key/cert files" ) + parser.add_argument( + "-ca", "--ca-data", action="store_true", help="Use embedded CADATA" + ) parser.add_argument( "-s", "--sync", action="store_true", help="Run in synchronous mode" ) @@ -76,12 +80,14 @@ def wdt_task(client, args, ts=[None]): elif args.file_auth: import ssl fmt = "der" if sys.implementation.name == "micropython" else "pem" + ca_key = "cadata" if args.ca_data else "cafile" + ca_val = CADATA if args.ca_data else f"ca-root.{fmt}" client = ArduinoCloudClient( device_id=os.getenv("DEVICE_ID"), ssl_params={ "keyfile": f"key.{fmt}", "certfile": f"cert.{fmt}", - "ca_certs": f"ca-root.{fmt}", + ca_key: ca_val, "cert_reqs": ssl.CERT_REQUIRED, }, sync_mode=args.sync, @@ -95,7 +101,7 @@ def wdt_task(client, args, ts=[None]): "use_hsm": True, "keyfile": "pkcs11:token=arduino", "certfile": "pkcs11:token=arduino", - "ca_certs": "ca-root.pem", + "cafile": "ca-root.pem", "cert_reqs": ssl.CERT_REQUIRED, "engine_path": "/lib/x86_64-linux-gnu/engines-3/libpkcs11.so", "module_path": "/lib/x86_64-linux-gnu/softhsm/libsofthsm2.so",