-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Feat: reusable lighthouse image (#23)
* chore: initial commit from template * chore: rename step * chore: sonar container with param * chore: param the lighthouse steps * feat: docker lighthouse step * fix: param changes * fix: linting * chore: try remove the other array * chore: define as multivalue * chore: debug * chore: indentation * chore: indentation * fix: linting * feat: remove redundent param * fix: iterate through urls * fix: linting indentation and parenthesis * chore: publish results regardless of outcome * chore: refactor uploading to blob * fix: relative to step * fix: working dir * fix: reference param * chore: add in target * fix: linting * chore: target container * chore: check current dir * chore: silly me figuring out devops * fix: remove container * chore: upload results blob * chore: remove old code * chore: remove blob as step of step * chore: add back in upload to blob * chore: debug file contents * chore: remve debugging
- Loading branch information
1 parent
c99243f
commit f838bce
Showing
5 changed files
with
77 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
30 changes: 30 additions & 0 deletions
30
azDevOps/azure/templates/v2/steps/test-profiling-lighthouse.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
############################################################################################################ | ||
# desc: Runs the lighthouse ci in a docker container. | ||
# return: | ||
# inputs: | ||
# - working_directory | ||
# - target_container (see amidostacks/lhci) | ||
# - lighthouse_config_filename: name of the lighthouse config file, eg. lighthouserc.json | ||
# - lighthouse_command: commands to run as configured in the config file, e.g. collect, assert, server | ||
# - lighthouse_urls: list/array of urls to run on, overiding defaults in config file. eg. - google.com | ||
# pre-reqs: Deployed webapp on a given URL | ||
############################################################################################################ | ||
|
||
parameters: | ||
working_directory: '' | ||
target_container: '' | ||
lighthouse_config_filename: '' | ||
lighthouse_commands: [] | ||
lighthouse_urls: [] | ||
|
||
steps: | ||
- ${{ each url in parameters.lighthouse_urls }}: | ||
- ${{ each lhcommand in parameters.lighthouse_commands }}: | ||
- bash: | | ||
lhci ${{ lhcommand }} --config=${{ parameters.lighthouse_config_filename }} | ||
target: | ||
container: ${{ parameters.target_container }} | ||
displayName: "Lighthouse Audit: lhci ${{ lhcommand }}" | ||
workingDirectory: ${{ parameters.working_directory }} | ||
env: | ||
LHCI_URL: ${{ url }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
############################################################################################################ | ||
# desc: Publishes reports and converts and uploads to specified blob container | ||
# params: test tool (eg, cypress, testcafe, selenium, lighthouse), working dir, blob storage account, storage container | ||
# tests results path, blob prefix | ||
# return: | ||
# pre-reqs: | ||
############################################################################################################ | ||
|
||
parameters: | ||
test_tool_name: '' | ||
working_directory: '' | ||
test_results_storage: '' | ||
test_results_blob_prefix: '' | ||
test_results_container: 'testresults' | ||
test_results_path: $(working_directory) | ||
|
||
steps: | ||
# Upload single or directory of reports 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_results_path }} -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 }} Reports 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) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
14 changes: 7 additions & 7 deletions
14
azDevOps/azure/templates/v2/steps/test-static-code-sonar.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,26 +1,26 @@ | ||
############################################################################################################ | ||
# desc: Performs static code analysis using code coverage from Jest unit tests and SonarCloud | ||
# params: Working directory | ||
# params: Working directory, container to run in | ||
# return: | ||
# pre-reqs: dependency installation | ||
############################################################################################################ | ||
|
||
parameters: | ||
workingDirectory: "" | ||
working_directory: "" | ||
target_container: "" | ||
|
||
steps: | ||
# SonarCloud Start | ||
- bash: | | ||
sonar-scanner -v | ||
sonar-scanner | ||
${{ parameters.target_container }} -v | ||
${{ parameters.target_container }} | ||
displayName: "Static Analysis: SonarScanner Run" | ||
# TOD: remove this! all target/container definitions should be handled at a job/caller level | ||
target: | ||
container: sonar_scanner | ||
container: ${{ parameters.target_container }} | ||
env: | ||
SONAR_HOST_URL: https://sonarcloud.io | ||
SONAR_TOKEN: $SONAR_TOKEN | ||
SONAR_PROJECT_KEY: $SONAR_PROJECT_KEY | ||
SONAR_ORGANIZATION: $SONAR_ORGANIZATION | ||
BUILD_NUMBER: $(Build.BuildNumber) | ||
workingDirectory: ${{ parameters.workingDirectory }} | ||
workingDirectory: ${{ parameters.working_directory }} |