diff --git a/.github/workflows/cd-post-release-tests.yml b/.github/workflows/cd-post-release-tests.yml index 6996b5a06df..a6031d87cec 100644 --- a/.github/workflows/cd-post-release-tests.yml +++ b/.github/workflows/cd-post-release-tests.yml @@ -11,15 +11,78 @@ on: type: string jobs: + notebook-test-hagrid: + strategy: + max-parallel: 99 + matrix: + os: [ubuntu-latest] + python-version: ["3.11"] + + runs-on: ${{ matrix.os }} + steps: + - uses: actions/checkout@v4 + + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v5 + + with: + python-version: ${{ matrix.python-version }} + + - name: Upgrade pip + run: | + python -m pip install --upgrade --user pip + + - name: Get pip cache dir + id: pip-cache + shell: bash + run: | + echo "dir=$(pip cache dir)" >> $GITHUB_OUTPUT + + - name: pip cache + uses: actions/cache@v4 + with: + path: ${{ steps.pip-cache.outputs.dir }} + key: ${{ runner.os }}-pip-py${{ matrix.python-version }}-${{ hashFiles('setup.cfg') }} + restore-keys: | + ${{ runner.os }}-pip-py${{ matrix.python-version }}- + + - name: Install Hagrid and tox + run: | + pip install -U hagrid + pip install tox + + - name: Hagrid Version + run: | + hagrid version + + - name: Launch Domain + run: | + hagrid launch test-domain-1 to docker:8081 --tag=${{ github.event.inputs.syft_version }} --low-side + + - name: Run tests + env: + NODE_PORT: "8081" + SYFT_VERSION: ${{ github.event.inputs.syft_version }} + EXCLUDE_NOTEBOOKS: "not 11-container-images-k8s.ipynb" + run: | + tox -e e2e.test.notebook + syft-install-check: strategy: max-parallel: 99 matrix: os: [ubuntu-latest, macos-latest, windows-latest] + # Re-enable macos-14 when it's available when we remove python 3.9 from syft + # os: [ubuntu-latest, macos-latest, windows-latest, macos-14] python-version: ["3.11", "3.10", "3.9"] runs-on: ${{ matrix.os }} steps: + - name: System Architecture + run: | + echo "System Architecture: $(uname -m)" + echo "System Version: $(uname -a)" + - uses: actions/checkout@v4 - name: Set up Python ${{ matrix.python-version }} diff --git a/.github/workflows/cd-syft.yml b/.github/workflows/cd-syft.yml index d815fa0f981..0eb72df049b 100644 --- a/.github/workflows/cd-syft.yml +++ b/.github/workflows/cd-syft.yml @@ -514,3 +514,9 @@ jobs: add: "helm/" push: "origin gh-pages" cwd: "./ghpages/" + + # Can we remove the always flag from the below job? + call-cd-post-release-tests: + needs: [deploy-syft] + if: always() && github.repository == 'OpenMined/PySyft' && needs.deploy-syft.result == 'success' # don't run on forks + uses: OpenMined/PySyft/.github/workflows/cd-post-release-tests.yml@dev diff --git a/tox.ini b/tox.ini index 60e96d12b0c..b99085a89fb 100644 --- a/tox.ini +++ b/tox.ini @@ -33,6 +33,7 @@ envlist = syftcli.publish syftcli.build backend.test.basecpu + e2e.test.notebook skipsdist = True @@ -1105,3 +1106,40 @@ commands = bash -c 'for pkg in perl make curl wget; do docker run --rm cpu-worker:custom-cmd apk -e info "$pkg"; done' bash -c 'docker run --rm cpu-worker:custom-cmd bash -c "cd cowsay-3.7.0 && curl https://api.github.com/zen -s | ./cowsay"' bash -c 'docker rmi cpu-worker:custom-cmd' + + +# There are other adjacent notebook tests like +# stack.test.notebook, syft.test.notebook, etc. +# They could be modularized and reused. +# The below is the notebook test suite for point at external servers +[testenv:e2e.test.notebook] +description = E2E Notebook tests +changedir = {toxinidir}/notebooks +allowlist_externals = + bash +setenv = + ORCHESTRA_DEPLOYMENT_TYPE = {env:ORCHESTRA_DEPLOYMENT_TYPE:k8s} + NODE_PORT = {env:NODE_PORT:8080} + NODE_URL = {env:NODE_URL:http://localhost} + EXCLUDE_NOTEBOOKS = {env:EXCLUDE_NOTEBOOKS:} + SYFT_VERSION = {env:SYFT_VERSION:latest} +commands = + bash -c "echo Running with ORCHESTRA_DEPLOYMENT_TYPE=$ORCHESTRA_DEPLOYMENT_TYPE NODE_PORT=$NODE_PORT NODE_URL=$NODE_URL \ + Excluding notebooks: $EXCLUDE_NOTEBOOKS SYFT_VERSION=$SYFT_VERSION; date" + + + # Schema for EXLUDE_NOTEBOOKS is + # for excluding + # notebook1.ipynb, notebook2.ipynb + # EXCLUDE_NOTEBOOKS=not notebook1.ipynb and not notebook2.ipynb + bash -c "pip install pytest pytest-randomly nbmake" + #If the syft version is latest install the latest version of syft + # else install the version of syft specified + bash -c "if [[ $SYFT_VERSION == 'latest' ]]; then \ + pip install syft[data_science]; \ + else \ + pip install syft[data_science]==$SYFT_VERSION; \ + fi" + + + pytest api/0.8 --nbmake -p no:randomly -vvvv --nbmake-timeout=1000 -k '{env:EXCLUDE_NOTEBOOKS:}' \ No newline at end of file