Skip to content

Commit

Permalink
CI: fix workflows
Browse files Browse the repository at this point in the history
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
  • Loading branch information
SMoraisAnsys committed Nov 29, 2023
1 parent 7fcfb7d commit a7f1a00
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 18 deletions.
15 changes: 9 additions & 6 deletions .github/workflows/ci_cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
Expand Down Expand Up @@ -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:
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -123,7 +126,7 @@ jobs:
- name: Set up Python
uses: actions/[email protected]
with:
python-version: 3.7
python-version: 3.8

- uses: actions/checkout@v2
- uses: actions/download-artifact@v3
Expand Down
6 changes: 3 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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",
]

Expand Down
18 changes: 9 additions & 9 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -1,23 +1,21 @@
[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

[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

[testenv]
description = Checks for project unit tests
basepython =
py37: python3.7
py38: python3.8
py39: python3.9
py310: python3.10
Expand All @@ -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]
Expand All @@ -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

0 comments on commit a7f1a00

Please sign in to comment.