Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: blob reporting and test reports #22

Merged
merged 24 commits into from
May 14, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
eb9db89
chore: artifact publishing
estherthetesteramido Apr 28, 2020
fc75857
fix: linting
estherthetesteramido Apr 29, 2020
bfbcbfa
chore: param name
estherthetesteramido Apr 29, 2020
bcbb2df
chore: check path exisits
estherthetesteramido Apr 29, 2020
fd81fc0
fix: correct param
estherthetesteramido Apr 29, 2020
dcf39bb
chore: fix name
estherthetesteramido Apr 29, 2020
dc920f7
chore: remove second it
estherthetesteramido Apr 29, 2020
9cd3e6a
feat: new build test dotnet pipeline
estherthetesteramido Apr 29, 2020
e49eec2
chore: one report task
estherthetesteramido Apr 29, 2020
df577ed
chore: debug
estherthetesteramido Apr 29, 2020
8708359
chore: try full path
estherthetesteramido Apr 29, 2020
00c2ea7
chore: debug
estherthetesteramido Apr 29, 2020
0030fce
feat: scaffoling cli
estherthetesteramido Apr 29, 2020
76e231d
chore: reports
estherthetesteramido Apr 29, 2020
ac708d0
chore: fixes
estherthetesteramido Apr 29, 2020
5848b45
chore: remove check
estherthetesteramido Apr 29, 2020
e53a449
chore: blob storage and junit
estherthetesteramido Apr 30, 2020
95631c7
chore: update task
estherthetesteramido Apr 30, 2020
6bb7384
fix: right context
estherthetesteramido Apr 30, 2020
e1f86cc
fix: stop making silly mistakes
estherthetesteramido Apr 30, 2020
1c65c11
fix: change the results path as current dir
estherthetesteramido Apr 30, 2020
a9ec079
fix: total path and file
estherthetesteramido Apr 30, 2020
bad4557
chore: script instead of task
estherthetesteramido May 1, 2020
7d4e657
fix: linting and docs
estherthetesteramido May 1, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
# GEneric
# Generic
.pytest_cache
.idea
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
############################################################################################################
# desc: Boostrap a template using the scaffolding-cli
# params: working dir, version spec, sample config file, sample config path (eg. tests), custom registry
# return: templated solution
# pre-reqs: published packages and templates, example config file
############################################################################################################

parameters:
working_directory: ''
version_spec: ''
sample_config: ''
sample_config_path: ''
customRegistry: ''

steps:
# Ensure Node.js 12 is active
- task: NodeTool@0
inputs:
versionSpec: ${{ parameters.version_spec }}
customRegistry: ${{ parameters.customRegistry }}
displayName: 'Use Node.js ${{ parameters.version_spec }}'

- task: Npm@1
displayName: 'Build: Scaffold project from sample config'
inputs:
command: 'custom'
customCommand: 'npx @amidostacks/scaffolding-cli -run -c ${{ parameters.sample_config}}'
workingDir: ${{ parameters.sample_config_path }}
verbose: true
customRegistry: ${{ parameters.customRegistry }}
37 changes: 37 additions & 0 deletions azDevOps/azure/templates/v2/steps/build-test-dotnet.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
parameters:
test_path: ''
package_path: ''
package_feed: ''
# .NET Core version variable
dotnet_core_version: '2.2.x'

steps:
- bash: |
echo 'Testing ${{ parameters.test_path }}'
echo 'Building ${{ parameters.package_path }}'
echo 'Restoring from ${{ parameters.package_feed }}'
displayName: 'Display: Package Path Info'

- task: UseDotNet@2
displayName: 'Use .NET Core SDK ${{ parameters.dotnet_core_version }}'
inputs:
packageType: sdk
version: ${{ parameters.dotnet_core_version }}
installationPath: $(Agent.ToolsDirectory)/dotnet

- task: DotNetCoreCLI@2
displayName: 'Build: Restore'
inputs:
command: 'restore'
projects: '${{ parameters.package_path }}**/*.csproj'
feedsToUse: 'select'
vstsFeed: '${{ parameters.package_feed }}'
includeNuGetOrg: true

- task: DotNetCoreCLI@2
displayName: 'Test: Unit Tests'
inputs:
command: 'test'
projects: '${{ parameters.test_path }}/*.csproj'
arguments: '--no-restore'
failOnStderr: true
25 changes: 4 additions & 21 deletions azDevOps/azure/templates/v2/steps/test-functional-testcafe.yml
Original file line number Diff line number Diff line change
@@ -1,42 +1,25 @@
############################################################################################################
# desc: Runs the functional (e2e) tests on a deployed webapp with Testcafe
# params: Env vars, workingDirectory, testcafe_browser_list (default to all)
# params: Env vars, working_directory, testcafe_browser_list (default to all)
# return: Publishes test results, screenshots
# pre-reqs: deployed webapp
############################################################################################################

parameters:
env_vars: {}
workingDirectory: ''
working_directory: ''
testcafe_browser_list: 'all'

steps:
# Install test runtime dependencies (not installing modules listed in devDependencies)
- script: npm install
displayName: 'Install test dependencies'
workingDirectory: ${{ parameters.workingDirectory }}
workingDirectory: ${{ parameters.working_directory }}

# Run tests with Testcafe
- script: npm run test:e2e -- ${{ parameters.testcafe_browser_list }}
displayName: 'Test: Run Testcafe tests against specified browsers'
workingDirectory: ${{ parameters.workingDirectory }}
workingDirectory: ${{ parameters.working_directory }}
env:
${{ each var in parameters.env_vars }}:
${{ var.key }}: ${{ var.value }}

# Publish Artifacts: Cypress will automatically capture screenshots when a failure happens
- task: PublishPipelineArtifact@1
inputs:
artifactName: 'screenshots'
targetPath: '${{ parameters.workingDirectory }}/screenshots'
displayName: 'Publish Screenshots (TestCafe)'
condition: failed()

# Publish CI test results
- task: PublishTestResults@2
inputs:
testRunner: xUnit
testResultsFiles: '**/testcafe-xunit-test-report.xml'
testRunTitle: 'TestCafe Tests'
displayName: 'Publish test results'
condition: succeededOrFailed()
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
############################################################################################################
# desc: Publishes test reports and converts xunit/junit xml into html and uploads to specified blob container
# params: test tool (eg, cypress, testcafe, selenium), working dir, blob storage account, storage container
# tests results path, blob prefix
# return:
# pre-reqs:
############################################################################################################

parameters:
test_tool_name: ''
artifacts: {}
working_directory: ''
test_results_storage: ''
test_results_blob_prefix: ''
test_results_container: 'testresults'
test_results_path: $(working_directory)

steps:
# Takes a number of artifacts to publish (like screenshots, videos) and publishes them
- ${{ each var in parameters.artifacts }}:
task: PublishPipelineArtifact@1
inputs:
artifactName: ${{ var.key }}
targetPath: ${{ var.value }}
displayName: 'Test Artifact: ${{ var.key }}'
condition: failed()

# Publish CI test results to Azure Devops artifacts
- task: PublishTestResults@2
inputs:
testRunner: jUnit
testResultsFiles: '${{ parameters.test_tool_name }}-xunit-test-report.xml'
searchFolder: ${{ parameters.working_directory }}
testRunTitle: '${{ parameters.test_tool_name }} Tests'
displayName: 'Publish: ${{ parameters.test_tool_name }} results'
condition: succeededOrFailed()

# Coverets the xml output into a standalone html report
- bash: |
npx xunit-viewer -r ${{ parameters.test_tool_name }}-xunit-test-report.xml -o ${{ parameters.test_tool_name }}-xunit-test-results.html -t ${{ parameters.test_tool_name }}
workingDirectory: ${{ parameters.working_directory }}
displayName: 'Generate ${{ parameters.test_tool_name }} HTML Report'

# Upload html report to blob storage
- bash: |
az login --service-principal --username $azure_client_id --password $azure_client_secret --tenant $azure_tenant_id
az account set -s $azure_subscription_id
az storage copy -s ${{ parameters.test_tool_name }}-xunit-test-results.html -d https://${{ parameters.test_results_storage }}.blob.core.windows.net/${{ parameters.test_results_container }}/${{ parameters.test_results_blob_prefix }} --recursive
az logout --username $azure_client_id
displayName: 'Copy: ${{ parameters.test_tool_name }} HTML Report Blob Storge '
workingDirectory: ${{ parameters.working_directory }}
env:
azure_client_id: $(azure_client_id)
azure_client_secret: $(azure_client_secret)
azure_subscription_id: $(azure_subscription_id)
azure_tenant_id: $(azure_tenant_id)