From a7f1a00bc4aa91d4a2922ee814d38ae020d6c38c Mon Sep 17 00:00:00 2001 From: Sebastien Morais Date: Wed, 29 Nov 2023 12:40:07 +0100 Subject: [PATCH] CI: fix workflows The main issue we had was to retrieve `ansys-api-edb`. It is now accessible through private pypi. Changes: - use PIP_EXTRA_INDEX_URL to leverage private pypi - remove python3.7 from CI and tox.ini - fix doc-build deps - fix tox.ini by installing with .[tests] - change project extra deps to be compatible with private pypi --- .github/workflows/ci_cd.yml | 15 +++++++++------ pyproject.toml | 6 +++--- tox.ini | 18 +++++++++--------- 3 files changed, 21 insertions(+), 18 deletions(-) diff --git a/.github/workflows/ci_cd.yml b/.github/workflows/ci_cd.yml index 4029722915..c7943dd2af 100644 --- a/.github/workflows/ci_cd.yml +++ b/.github/workflows/ci_cd.yml @@ -12,6 +12,7 @@ on: env: DOCUMENTATION_CNAME: 'edb.docs.pyansys.com' MAIN_PYTHON_VERSION: '3.10' + PIP_EXTRA_INDEX_URL: 'https://${{ secrets.PYANSYS_PYPI_PRIVATE_PAT }}@pkgs.dev.azure.com/pyansys/_packaging/pyansys/pypi/simple/' concurrency: group: ${{ github.workflow }}-${{ github.ref }} @@ -42,7 +43,7 @@ jobs: strategy: matrix: os: [windows-latest, ubuntu-latest] - python-version: ['3.7', '3.8', '3.9', '3.10'] + python-version: ['3.8', '3.9', '3.10'] fail-fast: false steps: @@ -51,10 +52,12 @@ jobs: uses: actions/setup-python@v2 with: python-version: ${{ matrix.python-version }} + - name: Install dependencies run: | - python -m pip install --upgrade .[test] + python -m pip install --upgrade .[tests] python -m pip install --upgrade tox-gh-actions + - name: Test with tox # Only the tox environment specified in the tox.ini gh-actions is run run: tox -e test -- --ignore=tests/e2e @@ -69,11 +72,11 @@ jobs: - name: Set up Python uses: actions/setup-python@v2 with: - python-version: 3.7 + python-version: 3.8 - name: Install dependencies run: | - python -m pip install --upgrade .[test] + python -m pip install --upgrade .[doc] tox - name: Generate the documentation with tox run: tox -e doc @@ -93,7 +96,7 @@ jobs: - name: Set up Python uses: actions/setup-python@v2 with: - python-version: 3.7 + python-version: 3.8 - name: Install dependencies run: | python -m pip install --upgrade pip flit twine @@ -123,7 +126,7 @@ jobs: - name: Set up Python uses: actions/setup-python@v4.3.0 with: - python-version: 3.7 + python-version: 3.8 - uses: actions/checkout@v2 - uses: actions/download-artifact@v3 diff --git a/pyproject.toml b/pyproject.toml index 6d096b0a90..0baa525d28 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -41,16 +41,16 @@ notebook = [ tests = [ "pytest==7.4.3", "pytest-cov==4.1.0", - "pytest-mock==3.12.0", + "pytest-mock==3.11.1", "python-dotenv>=0.20.0", "tox", ] # FIXME: update to newer versions doc = [ - "sphinx==7.2.5", + "sphinx==7.1.2", "numpydoc==1.6.0", - "ansys_sphinx_theme>=0.12.4", + "ansys_sphinx_theme>=0.12.2", "sphinx-copybutton==0.5.2", ] diff --git a/tox.ini b/tox.ini index 7c117a08f9..eb66cec3d9 100644 --- a/tox.ini +++ b/tox.ini @@ -1,7 +1,7 @@ [tox] description = Default tox environments list envlist = - style,{py37,py38,py39,py310},doc + style,{py38,py39,py310},doc skip_missing_interpreters = true isolated_build = true isolated_build_env = build @@ -9,7 +9,6 @@ isolated_build_env = build [gh-actions] description = The tox environment to be executed in gh-actions for a given python version python = - 3.7: style,py37-coverage,doc 3.8: style,py38-coverage,doc 3.9: style,py39-coverage,doc 3.10: style,py310-coverage,doc @@ -17,7 +16,6 @@ python = [testenv] description = Checks for project unit tests basepython = - py37: python3.7 py38: python3.8 py39: python3.9 py310: python3.10 @@ -27,20 +25,22 @@ setenv = install_command = python -m pip install {opts} {packages} - pip install .[tests] -commands = - pytest {posargs} {env:PYTEST_EXTRA_ARGS:} - [testenv:test] description = Checks for project unit tests setenv = PYTEST_EXTRA_ARGS = --junitxml=junit/test-results.xml +commands = + python -m pip install .[tests] + pytest {posargs} {env:PYTEST_EXTRA_ARGS:} [testenv:coverage] description = Checks for project unit tests and coverage setenv = PYTEST_EXTRA_ARGS = --cov=ansys.edb --cov-report=term --cov-report=xml --cov-report=html +commands = + python -m pip install .[tests] + pytest {posargs} {env:PYTEST_EXTRA_ARGS:} [testenv:style] @@ -55,11 +55,11 @@ commands = [testenv:doc] description = Check if documentation generates properly commands = - pip install .[doc] + python -m pip install .[doc] sphinx-build -d "{toxworkdir}/doc_doctree" doc/source "{toxworkdir}/doc_out" --color -vW -bhtml [testenv:notebook] description = Run Jupyter notebook commands = - pip install .[notebook] + python -m pip install .[notebook] jupyter notebook notebooks