-
Notifications
You must be signed in to change notification settings - Fork 8
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
[Tooling] add playwright tests into azure pipeline #9652
Changes from all commits
9ea6040
43a2328
2f035ef
ed1ef99
ddc9a57
8640f14
e316994
ce9c186
af110a7
e5c979f
01e8833
3668b70
67b4ec3
25abede
b6e56af
2f2eebe
e148a9d
dbd4556
36e9d5e
a2f72ad
629ec10
c864b40
72cac43
76c8871
21838fb
17aea70
d791a27
56215f6
914a004
1a254f8
9ee5d1b
a39271c
ff45afd
c8bb6e6
2358d8d
ecb7fda
5d4b0ec
8bd591d
1f415d6
d81019b
ea6da20
966f634
e6b8f5a
1cdd287
a837d2a
bd49741
f02304c
3be2468
61c169b
b6d2524
eae8c7b
5006f2b
0c64a4c
20db718
144efec
bf70aa2
caece8f
ecd9614
6ff4c10
2d2fba8
824cc35
c0e18cf
334c530
9d56208
d448b48
fcb44a5
d00e8b8
06ec9d0
fc06d03
45953aa
487e21f
0ebdab1
34f1ec6
ba0a6b2
e9a1ac4
46c21cd
0c35453
9daa6f1
697badb
f44b406
8eddc6a
ef0e613
69a2b2b
b86d62f
de72f21
53d7f44
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,3 +2,4 @@ | |
auto-install-peers=true | ||
legacy-peer-deps=true | ||
node-linker=hoisted | ||
ignore-workspace-root-check=true |
petertgiles marked this conversation as resolved.
Show resolved
Hide resolved
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
registry=https://pkgs.dev.azure.com/tbs-sct/53c8b022-82b7-4031-88aa-0d1266fc3bf5/_packaging/TalentCloud_Custom_NPM_Feed/npm/registry/ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. btw, we still need this.. as we need npm to install the pnpm asfaik |
||
always-auth=true | ||
ignore-workspace-root-check=true |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,38 +8,80 @@ resources: | |
ref: refs/heads/main | ||
variables: | ||
phpVersion: "8.2" | ||
|
||
serviceConnectionName: "Talent Cloud Service Connection" | ||
npm_config_user_config: "$(System.DefaultWorkingDirectory)/.npmrc" | ||
dirResults: "$(System.DefaultWorkingDirectory)/apps/playwright/test-results" | ||
resourceGroupName: "rg_tbs_talent_2_PaaS" | ||
vertical: "dev" | ||
storageAccountName: "sttalclddevcacstdl" | ||
storageContainer: "playwright-results" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Does this container automatically clean up old results? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. we have set a lifecycle rule on the container level to delete older results. Currently it is more than 30 days old. |
||
pool: | ||
name: "TBS Linux Self Hosted" | ||
jobs: | ||
- job: build_artifact | ||
displayName: Build artifact | ||
pool: | ||
vmImage: ubuntu-22.04 | ||
- job: run_playwright_tests | ||
displayName: Run Playwright tests | ||
timeoutInMinutes: 30 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It seems like this is not long enough. It's timing out for me, though it completes in around 25 minutes in GH. |
||
steps: | ||
- checkout: self | ||
clean: true | ||
fetchDepth: 1 | ||
|
||
- script: infrastructure/bin/set_php_versions.sh ${{ variables.phpVersion }} | ||
displayName: "PHP version" | ||
- task: AzureCLI@2 | ||
displayName: "Update NPMRC Config" | ||
inputs: | ||
scriptType: bash | ||
scriptLocation: inlineScript | ||
azureSubscription: $(serviceConnectionName) | ||
inlineScript: | | ||
NPMRC_FILE="${{ variables.npm_config_user_config }}" | ||
echo "Editing .npmrc: ${NPMRC_FILE}" | ||
echo "registry=https://pkgs.dev.azure.com/tbs-sct/53c8b022-82b7-4031-88aa-0d1266fc3bf5/_packaging/TalentCloud_Custom_NPM_Feed/npm/registry/" >> "${NPMRC_FILE}" | ||
- task: npmAuthenticate@0 | ||
displayName: "00 - NPM Authenticate" | ||
name: "NPM_Authenticate" | ||
inputs: | ||
workingFile: $(npm_config_user_config) | ||
|
||
# -d option to install dev dependencies and -r option to specify the root directory | ||
petertgiles marked this conversation as resolved.
Show resolved
Hide resolved
|
||
- script: infrastructure/bin/deploy.sh -d -r $(System.DefaultWorkingDirectory) | ||
displayName: Dependencies | ||
env: | ||
API_URI: /graphql | ||
API_PROTECTED_URI: /admin/graphql | ||
# We don't need Cypress in this environment, and so this avoid permission errors of installing it. | ||
# See: https://docs.cypress.io/guides/getting-started/installing-cypress#Skipping-installation | ||
CYPRESS_INSTALL_BINARY: 0 | ||
- script: echo ##vso[task.setvariable variable=NPM_CONFIG_USERCONFIG]$(npm_config_user_config) | ||
displayName: "Set Custom .npmrc Location" | ||
|
||
- task: ArchiveFiles@2 | ||
displayName: "Archive Files" | ||
inputs: | ||
rootFolderOrFile: $(System.DefaultWorkingDirectory) | ||
includeRootFolder: false | ||
archiveFile: "$(Build.ArtifactStagingDirectory)/Application_$(Build.BuildId).zip" | ||
- script: CYPRESS_INSTALL_BINARY=/opt/cypress/13.10.0/cypress.zip pnpm install cypress | ||
displayName: "Install Cypress" | ||
|
||
- task: PublishBuildArtifacts@1 | ||
displayName: "Publish Artifact: gcDigitalTalent" | ||
- script: pnpm install --no-frozen-lockfile | ||
displayName: "Install Node.js dependencies" | ||
|
||
- script: pnpm run build | ||
displayName: "Build dependencies" | ||
|
||
- script: npx playwright install | ||
displayName: "Install Playwright browsers" | ||
|
||
- script: pnpm run e2e:playwright:chromium | ||
displayName: "Run playwright tests" | ||
env: | ||
CI: "true" | ||
BASE_URL: "https://dev-talentcloud.tbs-sct.gc.ca" | ||
- task: AzureCLI@2 | ||
displayName: "Copy Playwright Results to Storage" | ||
condition: always() | ||
inputs: | ||
ArtifactName: gcDigitalTalent | ||
azureSubscription: $(serviceConnectionName) | ||
scriptType: bash | ||
scriptLocation: inlineScript | ||
inlineScript: | | ||
if [ ! $(which az 2> /dev/null) ]; then echo “ERROR: az cli not found” && exit 1; fi | ||
DIR_SRC="${{ variables.dirResults }}" | ||
echo "dirResults: ${{ variables.dirResults }}" | ||
TIMESTAMP="$(date +'%Y-%m-%d %H:%M:%S')" | ||
echo "Timestamp: ${TIMESTAMP}" | ||
if [ -d "${DIR_SRC}" ]; then | ||
SA_RG="${{ variables.resourceGroupName }}" | ||
SA_NAME="${{ variables.storageAccountName }}" | ||
SA_CONTAINER_NAME="${{ variables.storageContainer }}" | ||
SA_CONTAINER_PATH_PREFIX="${{ variables.vertical }}/${TIMESTAMP}" | ||
AZURE_STORAGE_KEY=$(az storage account keys list --resource-group "$SA_RG" --account-name "$SA_NAME" --query "[0].value" --output tsv) | ||
az storage blob upload-batch --destination "${SA_CONTAINER_NAME}" --account-name "${SA_NAME}" --destination-path "${SA_CONTAINER_PATH_PREFIX}" --source "${DIR_SRC}" | ||
else | ||
echo "No 'test-results' directory found" | ||
fi |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think the app services have this environment variable. There is already an APP_URL variable though.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm giving it in here
gc-digital-talent/infrastructure/azure-pipelines-dev.yml
Line 118 in 69a2b2b
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think App services would need this.
Also this pipeline can be used to run against any env like UAT and is different from APP_URL