From 65029ea07821f835adb9c99b1b666a74646899fa Mon Sep 17 00:00:00 2001 From: rasswanth-s <43314053+rasswanth-s@users.noreply.github.com> Date: Wed, 15 May 2024 11:20:28 +0530 Subject: [PATCH] add new workflow syft.test.integration to test local tests --- .github/workflows/pr-tests-stack.yml | 65 ++++++++++++++++++++++++++++ tox.ini | 30 +++++++++++++ 2 files changed, 95 insertions(+) diff --git a/.github/workflows/pr-tests-stack.yml b/.github/workflows/pr-tests-stack.yml index 1dbde3b88f2..961b86ae886 100644 --- a/.github/workflows/pr-tests-stack.yml +++ b/.github/workflows/pr-tests-stack.yml @@ -82,6 +82,71 @@ jobs: run: | tox -e backend.test.basecpu + pr-tests-syft-integration: + strategy: + max-parallel: 99 + matrix: + os: [ubuntu-latest] + python-version: ["3.12"] + pytest-modules: ["local_node"] + fail-fast: false + + runs-on: ${{matrix.os}} + + steps: + - uses: actions/checkout@v4 + + - name: Check for file changes + uses: dorny/paths-filter@v3 + id: changes + with: + base: ${{ github.ref }} + token: ${{ github.token }} + filters: .github/file-filters.yml + + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v5 + if: steps.changes.outputs.stack == 'true' + with: + python-version: ${{ matrix.python-version }} + + - name: Upgrade pip + if: steps.changes.outputs.stack == 'true' + run: | + pip install --upgrade pip uv==0.1.35 + uv --version + + - name: Get pip cache dir + if: steps.changes.outputs.stack == 'true' + id: pip-cache + shell: bash + run: | + echo "dir=$(uv cache dir)" >> $GITHUB_OUTPUT + + - name: pip cache + uses: actions/cache@v4 + if: steps.changes.outputs.stack == 'true' + with: + path: ${{ steps.pip-cache.outputs.dir }} + key: ${{ runner.os }}-uv-py${{ matrix.python-version }} + restore-keys: | + ${{ runner.os }}-uv-py${{ matrix.python-version }} + + - name: Install tox + if: steps.changes.outputs.stack == 'true' + run: | + pip install --upgrade tox tox-uv==1.5.1 + + - name: Run Syft Integration Tests + if: steps.changes.outputs.stack == 'true' + timeout-minutes: 60 + env: + PYTEST_MODULES: "${{ matrix.pytest-modules }}" + GITHUB_CI: true + shell: bash + run: | + tox -e syft.test.integration + pr-tests-integration-k8s: strategy: max-parallel: 99 diff --git a/tox.ini b/tox.ini index 1c16d2d7fbd..c2dd7515099 100644 --- a/tox.ini +++ b/tox.ini @@ -636,6 +636,36 @@ commands = python_version = 3.12 disable_error_code = attr-defined, valid-type, no-untyped-call, arg-type +[testenv:syft.test.integration] +description = Integration Tests for Syft Stack +basepython = python3 +deps = + {[testenv:syft]deps} + {[testenv:hagrid]deps} +changedir = {toxinidir} +passenv=HOME, USER +allowlist_externals = + bash +setenv = + PYTEST_MODULES = {env:PYTEST_MODULES:local_node} + ASSOCIATION_REQUEST_AUTO_APPROVAL = {env:ASSOCIATION_REQUEST_AUTO_APPROVAL:true} + PYTEST_FLAGS = {env:PYTEST_FLAGS:--ignore=tests/integration/local/gateway_local_test.py} +commands = + python -c 'import syft as sy; sy.stage_protocol_changes()' + + # Run Integration Tests + bash -c '\ + PYTEST_MODULES=($PYTEST_MODULES); \ + for i in "${PYTEST_MODULES[@]}"; do \ + echo "Starting test for $i"; date; \ + pytest tests/integration -m $i -vvvv -p no:randomly -p no:benchmark -o log_cli=True --capture=no $PYTEST_FLAGS; \ + return=$?; \ + echo "Finished $i"; \ + date; \ + if [[ $return -ne 0 ]]; then \ + exit $return; \ + fi; \ + done' [testenv:stack.test.integration.k8s] description = Integration Tests for Core Stack using K8s