-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
051cc92
commit e941db7
Showing
12 changed files
with
316 additions
and
14 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
"saleor-dashboard": patch | ||
--- | ||
|
||
Add manual test run for e2e |
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 @@ | ||
name: Merge playwright reports | ||
description: Merge reports from all shards | ||
|
||
runs: | ||
using: "composite" | ||
steps: | ||
- uses: actions/setup-node@v3 | ||
with: | ||
node-version-file: ".nvmrc" | ||
|
||
- name: Install dependencies | ||
shell: bash | ||
run: npm ci | ||
|
||
- name: Download blob reports from GitHub Actions Artifacts | ||
uses: actions/download-artifact@v3 | ||
with: | ||
name: all-blob-reports | ||
path: all-blob-reports | ||
|
||
- name: Merge into HTML Report | ||
shell: bash | ||
run: npx playwright merge-reports --reporter html ./all-blob-reports | ||
|
||
- name: Upload HTML report | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: html-report--attempt-${{ github.run_attempt }} | ||
path: playwright-report | ||
retention-days: 14 |
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,77 @@ | ||
name: Prepare api variables | ||
description: Prepare env config for cloud | ||
|
||
inputs: | ||
MODE: | ||
description: "The mode of running tests (pull-request, release, main)" | ||
required: true | ||
|
||
outputs: | ||
BASE_URL: | ||
description: "Dashboard base url" | ||
value: ${{ steps.generate.outputs.BASE_URL }} | ||
API_URL: | ||
description: "API url" | ||
value: ${{ steps.generate.outputs.API_URL }} | ||
BASE_URL_DOMAIN: | ||
description: "Dashboard domain" | ||
value: ${{ steps.generate.outputs.BASE_URL_DOMAIN }} | ||
POOL_NAME: | ||
description: "The name of the instance" | ||
value: ${{ steps.generate.outputs.POOL_NAME }} | ||
POOL_INSTANCE: | ||
description: "The full URL of the instance" | ||
value: ${{ steps.generate.outputs.POOL_INSTANCE }} | ||
BACKUP_NAMESPACE: | ||
description: "The backup namespace" | ||
value: ${{ steps.generate.outputs.BACKUP_NAMESPACE }} | ||
|
||
runs: | ||
using: "composite" | ||
steps: | ||
- name: Generate | ||
id: generate | ||
shell: bash | ||
env: | ||
MODE: ${{ inputs.MODE }} | ||
PULL_REQUEST_NUMBER: ${{ github.event.number }} | ||
PREFIX: pr- | ||
run: | | ||
if [[ "$MODE" == 'pull-request' ]]; then | ||
echo "BASE_URL=https://${PREFIX}${PULL_REQUEST_NUMBER}.dashboard.saleor.rocks" >> $GITHUB_OUTPUT | ||
echo "API_URL=https://${PREFIX}${PULL_REQUEST_NUMBER}.staging.saleor.cloud/graphql/" >> $GITHUB_OUTPUT | ||
echo "BASE_URL_DOMAIN=${PREFIX}${PULL_REQUEST_NUMBER}.dashboard.saleor.rocks" >> $GITHUB_OUTPUT | ||
echo "POOL_NAME=${PREFIX}${PULL_REQUEST_NUMBER}" >> $GITHUB_OUTPUT | ||
echo "POOL_INSTANCE=https://${PREFIX}${PULL_REQUEST_NUMBER}.staging.saleor.cloud" >> $GITHUB_OUTPUT | ||
echo "BACKUP_NAMESPACE=snapshot-automation-tests" >> $GITHUB_OUTPUT | ||
exit 0 | ||
fi | ||
if [[ "$MODE" == 'release' ]]; then | ||
CURRENT_BRANCH=$(echo "${GITHUB_REF}" | sed "s/refs\/heads\///") | ||
VERSION_SLUG=$(echo "${CURRENT_BRANCH}" | sed "s/\.//") | ||
echo "BASE_URL=https://v${VERSION_SLUG}.staging.saleor.cloud/dashboard/" >> $GITHUB_OUTPUT | ||
echo "API_URL=https://v${VERSION_SLUG}.staging.saleor.cloud/graphql/" >> $GITHUB_OUTPUT | ||
echo "BASE_URL_DOMAIN=v${VERSION_SLUG}.staging.saleor.cloud" >> $GITHUB_OUTPUT | ||
echo "POOL_NAME=${CURRENT_BRANCH} Staging" >> $GITHUB_OUTPUT | ||
echo "POOL_INSTANCE=https://v${VERSION_SLUG}.staging.saleor.cloud/" >> $GITHUB_OUTPUT | ||
echo "BACKUP_NAMESPACE=snapshot-automation-tests-${CURRENT_BRANCH}" >> $GITHUB_OUTPUT | ||
exit 0 | ||
fi | ||
if [[ "$MODE" == 'main' ]]; then | ||
echo "BASE_URL=https://automation-dashboard.staging.saleor.cloud/dashboard/" >> $GITHUB_OUTPUT | ||
echo "API_URL=https://automation-dashboard.staging.saleor.cloud/graphql/" >> $GITHUB_OUTPUT | ||
echo "BASE_URL_DOMAIN=automation-dashboard.staging.saleor.cloud" >> $GITHUB_OUTPUT | ||
echo "POOL_NAME=automation-dashboard" >> $GITHUB_OUTPUT | ||
echo "POOL_INSTANCE=https://automation-dashboard.staging.saleor.cloud" >> $GITHUB_OUTPUT | ||
echo "BACKUP_NAMESPACE=snapshot-automation-tests" >> $GITHUB_OUTPUT | ||
exit 0 | ||
fi | ||
echo "Unknown mode: $MODE" >&2 | ||
exit 1 |
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,41 @@ | ||
name: Prepare backup variables | ||
description: Prepare database snapshots | ||
inputs: | ||
CLI_TOKEN: | ||
description: "Saleor cli token" | ||
required: true | ||
BACKUP_NAMESPACE: | ||
description: "The backups namespace" | ||
required: true | ||
outputs: | ||
BACKUP_ID: | ||
description: "The ID of backup" | ||
value: ${{ steps.backup.outputs.BACKUP_ID }} | ||
BACKUP_VER: | ||
description: "The version of backup" | ||
value: ${{ steps.backup.outputs.BACKUP_VER }} | ||
BACKUP_NAME: | ||
description: "The name of backup" | ||
value: ${{ steps.backup.outputs.BACKUP_NAME }} | ||
runs: | ||
using: "composite" | ||
steps: | ||
- name: Saleor login | ||
uses: ./.github/actions/cli-login | ||
with: | ||
token: ${{ inputs.CLI_TOKEN }} | ||
|
||
- name: Obtain backup id | ||
id: backup | ||
shell: bash | ||
env: | ||
BACKUP_NAME: ${{ inputs.BACKUP_NAMESPACE }} | ||
run: | | ||
BACKUPS=$(npx saleor backup list --name="$BACKUP_NAME" --latest --json) | ||
BACKUP_ID=$(echo "$BACKUPS" | jq -r '.[0].key') | ||
BACKUP_VER=$(echo "$BACKUPS" | jq -r '.[0].saleor_version') | ||
BACKUP_NAME=$(echo "$BACKUPS" | jq -r '.[0].name') | ||
echo "BACKUP_ID=$BACKUP_ID" >> $GITHUB_OUTPUT | ||
echo "BACKUP_VER=$BACKUP_VER" >> $GITHUB_OUTPUT | ||
echo "BACKUP_NAME=$BACKUP_NAME" >> $GITHUB_OUTPUT |
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,70 @@ | ||
name: Prepare instance | ||
description: Prepare cloud instance for testing | ||
inputs: | ||
STRATEGY: | ||
description: "How to create the new instance (create|reload)" | ||
required: false | ||
default: "create" | ||
CLI_TOKEN: | ||
description: "Saleor cli token" | ||
required: true | ||
BASE_URL: | ||
description: "Dashboard base url" | ||
required: true | ||
API_URL: | ||
description: "API url" | ||
required: true | ||
POOL_NAME: | ||
description: "The name of the instance" | ||
required: true | ||
POOL_INSTANCE: | ||
description: "The full URL of the instance" | ||
required: true | ||
BACKUP_ID: | ||
description: "The id of backup" | ||
required: true | ||
runs: | ||
using: "composite" | ||
steps: | ||
- name: Saleor login | ||
uses: ./.github/actions/cli-login | ||
with: | ||
token: ${{ inputs.CLI_TOKEN }} | ||
|
||
- name: Instance check | ||
if: ${{ inputs.STRATEGY == 'reload' }} | ||
shell: bash | ||
id: instance_check | ||
env: | ||
INSTANCE_NAME: ${{ inputs.POOL_NAME }} | ||
run: | | ||
set +o pipefail | ||
INSTANCE_KEY=$(npx saleor env show "$INSTANCE_NAME" --json | jq .key) | ||
echo "INSTANCE_KEY=$INSTANCE_KEY" >> $GITHUB_OUTPUT | ||
- name: Reload snapshot | ||
shell: bash | ||
if: ${{ steps.instance_check.outputs.INSTANCE_KEY }} | ||
env: | ||
BACKUP_ID: ${{ inputs.BACKUP_ID }} | ||
INSTANCE_NAME: ${{ inputs.POOL_NAME }} | ||
run: | | ||
npx saleor backup restore "$BACKUP_ID" \ | ||
--environment="$INSTANCE_NAME" \ | ||
--skip-webhooks-update | ||
- name: Create new instance | ||
shell: bash | ||
if: ${{ !steps.instance_check.outputs.INSTANCE_KEY }} | ||
env: | ||
BACKUP_ID: ${{ inputs.BACKUP_ID }} | ||
INSTANCE_NAME: ${{ inputs.POOL_NAME }} | ||
run: | | ||
npx saleor env create "$INSTANCE_NAME" \ | ||
--project=project-for-pr-testing \ | ||
--database=snapshot \ | ||
--restore-from="$BACKUP_ID" \ | ||
--saleor=saleor-master-staging \ | ||
--domain="$INSTANCE_NAME" \ | ||
--skip-restrict \ | ||
--skip-webhooks-update |
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,71 @@ | ||
name: Prepare tests variables | ||
description: Prepare database snapshots | ||
inputs: | ||
MODE: | ||
description: "The mode of running tests (pull-request, release, main)" | ||
required: true | ||
CLI_TOKEN: | ||
description: "Saleor cli token" | ||
required: true | ||
outputs: | ||
BASE_URL: | ||
description: "Dashboard base url" | ||
value: ${{ steps.api.outputs.BASE_URL }} | ||
BASE_URL_DOMAIN: | ||
description: "Dashboard domain" | ||
value: ${{ steps.api.outputs.BASE_URL_DOMAIN }} | ||
API_URL: | ||
description: "API url" | ||
value: ${{ steps.api.outputs.API_URL }} | ||
POOL_NAME: | ||
description: "The name of the instance" | ||
value: ${{ steps.api.outputs.POOL_NAME }} | ||
POOL_INSTANCE: | ||
description: "The full URL of the instance" | ||
value: ${{ steps.api.outputs.POOL_INSTANCE }} | ||
BACKUP_ID: | ||
description: "The ID of backup" | ||
value: ${{ steps.backup.outputs.BACKUP_ID }} | ||
BACKUP_VER: | ||
description: "The version of backup" | ||
value: ${{ steps.backup.outputs.BACKUP_VER }} | ||
BACKUP_NAME: | ||
description: "The name of backup" | ||
value: ${{ steps.backup.outputs.BACKUP_NAME }} | ||
BACKUP_NAMESPACE: | ||
description: "The name of backup" | ||
value: ${{ steps.api.outputs.BACKUP_NAMESPACE }} | ||
runs: | ||
using: "composite" | ||
steps: | ||
- name: Generate api | ||
id: api | ||
uses: ./.github/actions/prepare-api-variables | ||
with: | ||
MODE: ${{ inputs.MODE }} | ||
|
||
- name: Generate backup | ||
id: backup | ||
uses: ./.github/actions/prepare-backups-variables | ||
with: | ||
CLI_TOKEN: ${{ inputs.CLI_TOKEN }} | ||
BACKUP_NAMESPACE: ${{ steps.api.outputs.BACKUP_NAMESPACE }} | ||
|
||
- name: Print annotations | ||
shell: bash | ||
env: | ||
BASE_URL: ${{ steps.api.outputs.BASE_URL }} | ||
API_URL: ${{ steps.api.outputs.API_URL }} | ||
POOL_NAME: ${{ steps.api.outputs.POOL_NAME }} | ||
POOL_INSTANCE: ${{ steps.api.outputs.POOL_INSTANCE }} | ||
BACKUP_ID: ${{ steps.backup.outputs.BACKUP_ID }} | ||
BACKUP_VER: ${{ steps.backup.outputs.BACKUP_VER }} | ||
BACKUP_NAME: ${{ steps.backup.outputs.BACKUP_NAME }} | ||
BACKUP_NAMESPACE: ${{ steps.api.outputs.BACKUP_NAMESPACE }} | ||
run: | | ||
echo "::notice title=BASE_URL::${BASE_URL}" | ||
echo "::notice title=API_URL::${API_URL}" | ||
echo "::notice title=POOL_NAME::${POOL_NAME}" | ||
echo "::notice title=POOL_INSTANCE::${POOL_INSTANCE}" | ||
echo "::notice title=BACKUP_NAMESPACE::${BACKUP_NAMESPACE}" | ||
echo "::notice title=SNAPSHOT::backup_id=${BACKUP_ID}, version=${BACKUP_VER}, name=${BACKUP_NAME}" |
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
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
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
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
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
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