#2620: modify script

This commit is contained in:
Czar Echavez
2024-07-02 00:00:20 +01:00
parent ab3e84b8b9
commit 8097884ae2

View File

@@ -107,11 +107,8 @@ stages:
coverage html -d htmlcov -i coverage html -d htmlcov -i
displayName: 'Run tests and code coverage' displayName: 'Run tests and code coverage'
# Run the notebooks to make sure that they work # Run the notebooks
- script: | - script: |
# Detect OS
if [ "$(uname)" = "Linux" ] || [ "$(uname)" = "Darwin" ]; then
# Commands for Linux and macOS
pytest --nbmake -n=auto src/primaite/notebooks --junit-xml=./notebook-tests/notebooks.xml pytest --nbmake -n=auto src/primaite/notebooks --junit-xml=./notebook-tests/notebooks.xml
notebooks_exit_code=$? notebooks_exit_code=$?
pytest --nbmake -n=auto src/primaite/simulator/_package_data --junit-xml=./notebook-tests/package-notebooks.xml pytest --nbmake -n=auto src/primaite/simulator/_package_data --junit-xml=./notebook-tests/package-notebooks.xml
@@ -120,17 +117,23 @@ stages:
if [ $notebooks_exit_code -ne 0 ] || [ $package_notebooks_exit_code -ne 0 ]; then if [ $notebooks_exit_code -ne 0 ] || [ $package_notebooks_exit_code -ne 0 ]; then
exit 1 exit 1
fi fi
else displayName: 'Run notebooks on Linux and macOS'
# Commands for Windows condition: or(eq(variables['Agent.OS'], 'Linux'), eq(variables['Agent.OS'], 'Darwin'))
shell: bash
# Run notebooks
- script: |
pytest --nbmake -n=auto src/primaite/notebooks --junit-xml=./notebook-tests/notebooks.xml pytest --nbmake -n=auto src/primaite/notebooks --junit-xml=./notebook-tests/notebooks.xml
set notebooks_exit_code=%ERRORLEVEL% $notebooks_exit_code = $LASTEXITCODE
pytest --nbmake -n=auto src/primaite/simulator/_package_data --junit-xml=./notebook-tests/package-notebooks.xml pytest --nbmake -n=auto src/primaite/simulator/_package_data --junit-xml=./notebook-tests/package-notebooks.xml
set package_notebooks_exit_code=%ERRORLEVEL% $package_notebooks_exit_code = $LASTEXITCODE
# Fail step if either of these do not have exit code 0 # Fail step if either of these do not have exit code 0
if %notebooks_exit_code% NEQ 0 exit /b 1 if ($notebooks_exit_code -ne 0 -or $package_notebooks_exit_code -ne 0) {
if %package_notebooks_exit_code% NEQ 0 exit /b 1 exit 1
fi }
displayName: 'Run notebooks' displayName: 'Run notebooks on Windows'
condition: eq(variables['Agent.OS'], 'Windows_NT')
shell: pwsh
- task: PublishTestResults@2 - task: PublishTestResults@2
condition: succeededOrFailed() condition: succeededOrFailed()