I have the following Azure DevOps template, which is currently hardcoded to some specific files. I'm hoping to refactor it into a simpler template using loops so I don't need to duplicate (and hardcode) specific files.
[ pseduo code for brevity ]
#tests.yml
steps:
# pre-test steps. This is done once.
- script: install tool1
- script: install tool2
- script: setup path stuff.
# Tests
- script: test project1 |
display codecoverage to console-out
- script: test project 2 |
display codecoverage to console-out
# Post-tests
- script: upload coverage report for project1
- script: upload coverage report for project2
- task: PublishTestResults@2 # publish test results to Azure DevOps.
So notice how i'm doing this per project
- test project
- display codecoverage result to console-out (so i can see the results here)
- upload result to 3rd party website (for others to see also)
I was hoping there might be a way I can someone pass in the info into the template and then just loop through the array of input data.
like this..
steps:
# pre tests.
...
# tests
foreach project in projects
- script: test project |
display code coverage report
- script: upload report
# post-test
...
can this be done in Azure DevOps ?
-
-
