-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
E2e instance assign and create #4350
Merged
Merged
Changes from all commits
Commits
Show all changes
78 commits
Select commit
Hold shift + click to select a range
f3a0fde
E2e pool
andrzejewsky c11f06d
E2e pool
andrzejewsky 773c6ee
E2e pool
andrzejewsky 2c9841c
E2e pool
andrzejewsky 023e0d2
E2e pool
andrzejewsky 6346dd5
E2e pool
andrzejewsky b8d139c
E2e pool
andrzejewsky 3c1c8c2
E2e pool
andrzejewsky aba9202
E2e pool
andrzejewsky 24eb4c4
E2e pool
andrzejewsky aef988d
E2e pool
andrzejewsky 8ed7b6e
E2e pool
andrzejewsky 782d3e0
E2e pool
andrzejewsky 2f0f952
E2e pool
andrzejewsky 32d4694
E2e pool
andrzejewsky 6f0a6d9
E2E pool
andrzejewsky 0a6d500
bump workers to 4 on CI
wojteknowacki 9315910
run single test with logs
wojteknowacki a7f8f87
store artifacts
wojteknowacki 596a405
baseurl in e2e-pool - removed postfix dashboard
wojteknowacki 4554b09
baseurl in e2e-pool - added postfix dashboard
wojteknowacki 5d99faa
baseurl in e2e-pool - slash removed on the end
wojteknowacki 2b33ce2
Revert "baseurl in e2e-pool - slash removed on the end"
wojteknowacki fa3b9e3
matrix run on ci
wojteknowacki 877172c
matrix indexes fix
wojteknowacki 4aef17c
Deployment
andrzejewsky cb2bdb7
Deployment
andrzejewsky e8b0359
Deployment
andrzejewsky 854cb58
Deployment
andrzejewsky 86b205a
base url fix
wojteknowacki 6cf09d5
auth login method - base url from env var
wojteknowacki c775143
Deployment
andrzejewsky 299c9e6
fix path in directions urls
wojteknowacki ee87b30
Trrigger 1
andrzejewsky 4e5493e
Trigger 2
andrzejewsky 12ba436
Concurenc
andrzejewsky be3cfe9
Trigger
andrzejewsky 6f51c47
Workflows
andrzejewsky c062fdf
Workflows
andrzejewsky fb1cea7
Workflows
andrzejewsky 5eea706
Workflows
andrzejewsky 4986843
Workflows
andrzejewsky 4fe09d5
Workflows
andrzejewsky 7ca8caf
Workflows
andrzejewsky 9efd6ce
Workflows
andrzejewsky 16d16b9
Workflows
andrzejewsky f5f1f0e
Workflows
andrzejewsky b8ab240
Workflows
andrzejewsky 81dfb2a
Merge branch 'main' into e2e-pool
andrzejewsky 35994b8
Instances
andrzejewsky 399cee0
trigger
andrzejewsky f395ed0
Instances
andrzejewsky 525e90b
Instances
andrzejewsky ee46b37
Instances
andrzejewsky 07b28ce
Instances
andrzejewsky f4711d6
Instances
andrzejewsky 0ab869e
trigger
andrzejewsky 6a5f84f
Separate storybook
andrzejewsky 213e084
Backup list
andrzejewsky 75779e0
Backup list
andrzejewsky 3a83591
Annotations
andrzejewsky e244903
Annotations
andrzejewsky 7f5dd7f
Annotations
andrzejewsky 92e4130
Annotations
andrzejewsky d93b9a5
Annotations
andrzejewsky ad4b7e7
Annotations
andrzejewsky 33db992
Annotations
andrzejewsky 3070366
Merge remote-tracking branch 'origin/main' into e2e-pool
andrzejewsky e87f071
Changeset
andrzejewsky 6ab9620
Annotations
andrzejewsky 016f50c
Annotations
andrzejewsky 6546116
Annotations
andrzejewsky 2b215f0
instances
andrzejewsky 3b6576a
Cr
andrzejewsky 80d665d
Limit permissions
andrzejewsky fb78364
Merge branch 'main' into e2e-pool
andrzejewsky c4ede1f
Naming
andrzejewsky bb9d906
Merge branch 'main' into e2e-pool
andrzejewsky File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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": minor | ||
--- | ||
|
||
Implement the e2e instance managing |
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,15 @@ | ||
name: Saleor CLI login | ||
description: Saleor CLI login | ||
inputs: | ||
token: | ||
description: "Cloud accces token" | ||
required: true | ||
runs: | ||
using: "composite" | ||
steps: | ||
- name: Write config file | ||
shell: bash | ||
id: write-config-file | ||
env: | ||
ACCESS_TOKEN: ${{ inputs.token }} | ||
run: jq --null-input --arg token "Token $ACCESS_TOKEN" '{"token":$token,"telemetry":"false","organization_slug":"saleor","organization_name":"Saleor"}' > ~/.config/saleor.json |
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,329 @@ | ||
name: PR automation | ||
|
||
on: [pull_request] | ||
|
||
concurrency: | ||
group: ${{ github.ref }} | ||
cancel-in-progress: true | ||
|
||
jobs: | ||
prepare_variables: | ||
runs-on: ubuntu-22.04 | ||
outputs: | ||
POOL_NAME: ${{ steps.generate.outputs.POOL_NAME }} | ||
POOL_INSTANCE: ${{ steps.generate.outputs.POOL_INSTANCE }} | ||
BASE_URL: ${{ steps.generate.outputs.BASE_URL }} | ||
API_URI: ${{ steps.generate.outputs.API_URI }} | ||
BACKUP_ID: ${{ steps.backup.outputs.BACKUP_ID }} | ||
BACKUP_VER: ${{ steps.backup.outputs.BACKUP_VER }} | ||
BACKUP_NAME: ${{ steps.backup.outputs.BACKUP_NAME }} | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
sparse-checkout: ./.github/actions | ||
|
||
- name: Inject slug/short variables | ||
uses: rlespinasse/github-slug-action@102b1a064a9b145e56556e22b18b19c624538d94 | ||
|
||
- name: Generate | ||
id: generate | ||
run: | | ||
echo "BASE_URL=${GITHUB_HEAD_REF_SLUG_URL}.dashboard.saleor.rocks" >> $GITHUB_OUTPUT | ||
echo "API_URI=https://${GITHUB_HEAD_REF_SLUG_URL}.staging.saleor.cloud/graphql/" >> $GITHUB_OUTPUT | ||
echo "POOL_NAME=${GITHUB_HEAD_REF_SLUG_URL}" >> $GITHUB_OUTPUT | ||
echo "POOL_INSTANCE=https://${GITHUB_HEAD_REF_SLUG_URL}.staging.saleor.cloud" >> $GITHUB_OUTPUT | ||
|
||
- name: Saleor login | ||
uses: ./.github/actions/cli-login | ||
with: | ||
token: ${{ secrets.STAGING_TOKEN }} | ||
|
||
- name: Obtain backup id | ||
id: backup | ||
env: | ||
SALEOR_CLI_ENV: staging | ||
BACKUP_NAME: snapshot-automation-tests | ||
run: | | ||
BACKUPS=$(npx saleor backup list --name=snapshot-automation-tests --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 | ||
|
||
- name: Print annotations | ||
env: | ||
BASE_URL: ${{ steps.generate.outputs.BASE_URL }} | ||
API_URI: ${{ steps.generate.outputs.API_URI }} | ||
POOL_NAME: ${{ steps.generate.outputs.POOL_NAME }} | ||
POOL_INSTANCE: ${{ steps.generate.outputs.POOL_INSTANCE }} | ||
BACKUP_ID: ${{ steps.backup.outputs.BACKUP_ID }} | ||
BACKUP_VER: ${{ steps.backup.outputs.BACKUP_VER }} | ||
BACKUP_NAME: ${{ steps.backup.outputs.BACKUP_NAME }} | ||
run: | | ||
echo "::notice title=BASE_URL::${BASE_URL}" | ||
echo "::notice title=API_URI::${API_URI}" | ||
echo "::notice title=POOL_NAME::${POOL_NAME}" | ||
echo "::notice title=POOL_INSTANCE::${POOL_INSTANCE}" | ||
echo "::notice title=SNAPSHOT::backup_id=${BACKUP_ID}, version=${BACKUP_VER}, name=${BACKUP_NAME}" | ||
|
||
prepare_instance: | ||
runs-on: ubuntu-22.04 | ||
needs: prepare_variables | ||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
sparse-checkout: ./.github/actions | ||
|
||
- name: Inject slug/short variables | ||
uses: rlespinasse/github-slug-action@102b1a064a9b145e56556e22b18b19c624538d94 | ||
|
||
- name: Saleor login | ||
uses: ./.github/actions/cli-login | ||
with: | ||
token: ${{ secrets.STAGING_TOKEN }} | ||
|
||
- name: Reload snapshot | ||
if: ${{ github.event_name == 'pull_request' && github.event.action != 'opened' && github.event.action != 'closed' }} | ||
env: | ||
SALEOR_CLI_ENV: staging | ||
BACKUP_ID: ${{ needs.prepare_variables.outputs.BACKUP_ID }} | ||
INSTANCE_NAME: ${{ needs.prepare_variables.outputs.POOL_NAME }} | ||
run: | | ||
npx saleor backup restore "$BACKUP_ID" \ | ||
--environment="$INSTANCE_NAME" \ | ||
--skip-webhooks-update | ||
|
||
- name: Create new instance | ||
if: ${{ github.event_name == 'pull_request' && github.event.action == 'opened' }} | ||
env: | ||
SALEOR_CLI_ENV: staging | ||
BACKUP_ID: ${{ needs.prepare_variables.outputs.BACKUP_ID }} | ||
INSTANCE_NAME: ${{ needs.prepare_variables.outputs.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 | ||
|
||
deploy_dashboard: | ||
if: github.event.pull_request.head.repo.full_name == 'saleor/saleor-dashboard' | ||
runs-on: ubuntu-22.04 | ||
needs: prepare_variables | ||
permissions: | ||
deployments: write | ||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- name: Setup Node | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version-file: ".nvmrc" | ||
|
||
- name: Start deployment | ||
uses: bobheadxi/deployments@88ce5600046c82542f8246ac287d0a53c461bca3 | ||
id: deployment | ||
with: | ||
step: start | ||
token: ${{ secrets.GITHUB_TOKEN }} | ||
env: ${{ needs.prepare_variables.outputs.POOL_NAME }} | ||
ref: ${{ github.head_ref }} | ||
|
||
- name: Cache node modules | ||
uses: actions/cache@v3 | ||
env: | ||
cache-name: cache-node-modules | ||
with: | ||
path: ~/.npm | ||
key: ${{ runner.os }}-qa-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }} | ||
restore-keys: | | ||
${{ runner.os }}-qa-${{ env.cache-name }}- | ||
${{ runner.os }}-qa- | ||
${{ runner.os }}- | ||
|
||
- name: Install deps | ||
run: npm ci | ||
|
||
- name: Build dashboard | ||
env: | ||
API_URI: ${{ needs.prepare_variables.outputs.API_URI }} | ||
APPS_MARKETPLACE_API_URI: "https://apps.staging.saleor.io/api/v2/saleor-apps" | ||
APP_MOUNT_URI: / | ||
STATIC_URL: / | ||
IS_CLOUD_INSTANCE: true | ||
run: npm run build | ||
|
||
- name: Configure AWS credentials | ||
uses: aws-actions/configure-aws-credentials@v3 | ||
with: | ||
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} | ||
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | ||
aws-region: ${{ secrets.AWS_DEFAULT_REGION }} | ||
|
||
- name: Deploy to S3 | ||
env: | ||
AWS_TEST_DEPLOYMENT_BUCKET: ${{ secrets.AWS_TEST_DEPLOYMENT_BUCKET }} | ||
BASE_URL: ${{ needs.prepare_variables.outputs.BASE_URL }} | ||
run: aws s3 sync ./build/dashboard "s3://${AWS_TEST_DEPLOYMENT_BUCKET}/${BASE_URL}" | ||
|
||
- name: Invalidate cache | ||
env: | ||
AWS_TEST_CF_DIST_ID: ${{ secrets.AWS_TEST_CF_DIST_ID }} | ||
BASE_URL: ${{ needs.prepare_variables.outputs.BASE_URL }} | ||
run: aws cloudfront create-invalidation --distribution-id "$AWS_TEST_CF_DIST_ID" --paths "/${BASE_URL}/*" | ||
|
||
- name: Update deployment status | ||
uses: bobheadxi/deployments@88ce5600046c82542f8246ac287d0a53c461bca3 | ||
if: always() | ||
with: | ||
step: finish | ||
token: ${{ secrets.GITHUB_TOKEN }} | ||
status: ${{ job.status }} | ||
env_url: https://${{ needs.prepare_variables.outputs.BASE_URL }}/ | ||
deployment_id: ${{ steps.deployment.outputs.deployment_id }} | ||
env: ${{ needs.prepare_variables.outputs.POOL_NAME }} | ||
|
||
|
||
deploy_storybook: | ||
if: github.event.pull_request.head.repo.full_name == 'saleor/saleor-dashboard' | ||
runs-on: ubuntu-22.04 | ||
needs: prepare_variables | ||
permissions: | ||
deployments: write | ||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- name: Setup Node | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version-file: ".nvmrc" | ||
|
||
- name: Start storybook deployment | ||
uses: bobheadxi/deployments@88ce5600046c82542f8246ac287d0a53c461bca3 | ||
id: storybook-deployment | ||
with: | ||
step: start | ||
token: ${{ secrets.GITHUB_TOKEN }} | ||
env: storybook ${{ needs.prepare_variables.outputs.POOL_NAME }} | ||
ref: ${{ github.head_ref }} | ||
|
||
- name: Cache node modules | ||
uses: actions/cache@v3 | ||
env: | ||
cache-name: cache-node-modules | ||
with: | ||
path: ~/.npm | ||
key: ${{ runner.os }}-qa-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }} | ||
restore-keys: | | ||
${{ runner.os }}-qa-${{ env.cache-name }}- | ||
${{ runner.os }}-qa- | ||
${{ runner.os }}- | ||
|
||
- name: Install deps | ||
run: npm ci | ||
|
||
- name: Build storybook | ||
run: npm run build-storybook | ||
|
||
- name: Configure AWS credentials | ||
uses: aws-actions/configure-aws-credentials@v3 | ||
with: | ||
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} | ||
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | ||
aws-region: ${{ secrets.AWS_DEFAULT_REGION }} | ||
|
||
- name: Deploy to S3 | ||
env: | ||
AWS_TEST_DEPLOYMENT_BUCKET: ${{ secrets.AWS_TEST_DEPLOYMENT_BUCKET }} | ||
BASE_URL: ${{ needs.prepare_variables.outputs.BASE_URL }} | ||
run: aws s3 sync ./build/storybook "s3://${AWS_TEST_DEPLOYMENT_BUCKET}/${BASE_URL}/storybook" | ||
|
||
- name: Invalidate cache | ||
env: | ||
AWS_TEST_CF_DIST_ID: ${{ secrets.AWS_TEST_CF_DIST_ID }} | ||
BASE_URL: ${{ needs.prepare_variables.outputs.BASE_URL }} | ||
run: aws cloudfront create-invalidation --distribution-id "$AWS_TEST_CF_DIST_ID" --paths "/${BASE_URL}/*" | ||
|
||
- name: Update storybook deployment status | ||
uses: bobheadxi/deployments@88ce5600046c82542f8246ac287d0a53c461bca3 | ||
if: always() | ||
with: | ||
step: finish | ||
token: ${{ secrets.GITHUB_TOKEN }} | ||
status: ${{ job.status }} | ||
env_url: https://${{ needs.prepare_variables.outputs.BASE_URL }}/storybook/index.html | ||
deployment_id: ${{ steps.storybook-deployment.outputs.deployment_id }} | ||
env: storybook ${{ needs.prepare_variables.outputs.POOL_NAME }} | ||
|
||
run-tests: | ||
runs-on: ubuntu-latest | ||
needs: [prepare_variables, deploy_dashboard, prepare_instance] | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
shard: [1/2, 2/2] | ||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- uses: actions/setup-node@v3 | ||
with: | ||
node-version-file: ".nvmrc" | ||
|
||
- name: Install dependencies | ||
run: npm ci | ||
|
||
- name: Install Playwright Browsers | ||
run: npx playwright install --with-deps | ||
|
||
- name: Run tests | ||
env: | ||
API_URI: ${{ needs.prepare_variables.outputs.API_URI }} | ||
BASE_URL: https://${{ needs.prepare_variables.outputs.BASE_URL }}/ | ||
E2E_USER_NAME: ${{ secrets.CYPRESS_USER_NAME }} | ||
E2E_USER_PASSWORD: ${{ secrets.CYPRESS_USER_PASSWORD }} | ||
E2E_PERMISSIONS_USERS_PASSWORD: ${{ secrets.CYPRESS_PERMISSIONS_USERS_PASSWORD }} | ||
run: npx playwright test --shard ${{ matrix.shard }} | ||
|
||
- name: Upload blob report to GitHub Actions Artifacts | ||
uses: actions/upload-artifact@v3 | ||
if: always() | ||
with: | ||
name: all-blob-reports | ||
path: blob-report | ||
retention-days: 1 | ||
|
||
merge-reports: | ||
if: '!cancelled()' | ||
needs: [run-tests] | ||
|
||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: actions/setup-node@v3 | ||
with: | ||
node-version: 18 | ||
- name: Install dependencies | ||
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 | ||
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,31 @@ | ||
name: PR cleanup | ||
|
||
on: | ||
pull_request: | ||
types: [closed] | ||
|
||
jobs: | ||
remove_instance: | ||
runs-on: ubuntu-22.04 | ||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
sparse-checkout: ./.github/actions | ||
|
||
- name: Setup Node | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version-file: ".nvmrc" | ||
|
||
- name: Inject slug/short variables | ||
uses: rlespinasse/github-slug-action@102b1a064a9b145e56556e22b18b19c624538d94 | ||
|
||
- name: Saleor login | ||
uses: ./.github/actions/cli-login | ||
with: | ||
token: ${{ secrets.STAGING_TOKEN }} | ||
|
||
- name: Remove instance | ||
env: | ||
SALEOR_CLI_ENV: staging | ||
run: npx saleor env remove "$GITHUB_HEAD_REF_SLUG_URL" --force |
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,4 +1,4 @@ | ||
name: TEST-ENV-CLEANUP | ||
name: Testing | ||
# Remove test instance for closed pull requests | ||
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. Is it intentional? This name may be a bit confusing. |
||
|
||
on: | ||
|
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.