From d523e8f84dc5f71e37e54980a443816d0a786a21 Mon Sep 17 00:00:00 2001 From: adrians5j Date: Thu, 12 Dec 2024 15:16:22 +0100 Subject: [PATCH] ci: add node-20 variant of the workflow [no ci] --- .../pullRequestsCommandCypressNode20.yml | 852 ++++++++++++++++++ 1 file changed, 852 insertions(+) create mode 100644 .github/workflows/pullRequestsCommandCypressNode20.yml diff --git a/.github/workflows/pullRequestsCommandCypressNode20.yml b/.github/workflows/pullRequestsCommandCypressNode20.yml new file mode 100644 index 0000000000..0e9859e349 --- /dev/null +++ b/.github/workflows/pullRequestsCommandCypressNode20.yml @@ -0,0 +1,852 @@ +# This file was automatically generated by github-actions-wac. +# DO NOT MODIFY IT BY HAND. Instead, modify the source *.wac.ts file(s) +# and run "github-actions-wac build" (or "ghawac build") to regenerate this file. +# For more information, run "github-actions-wac --help". +name: Pull Requests Command - Cypress (Node v20) +'on': issue_comment +env: + NODE_OPTIONS: '--max_old_space_size=4096' + AWS_REGION: eu-central-1 +jobs: + checkComment: + name: Check comment for /cypress_node_20 + if: ${{ github.event.issue.pull_request }} + steps: + - uses: actions/setup-node@v4 + with: + node-version: 20 + - name: Check for Command + id: command + uses: xt0rted/slash-command-action@v2 + with: + repo-token: ${{ secrets.GITHUB_TOKEN }} + command: cypress_node_20 + reaction: 'true' + reaction-type: eyes + allow-edits: 'false' + permission-level: write + - name: Create comment + uses: peter-evans/create-or-update-comment@v2 + with: + issue-number: ${{ github.event.issue.number }} + body: >- + Cypress E2E tests have been initiated (for more information, click + [here](https://github.com/webiny/webiny-js/actions/runs/${{ + github.run_id }})). :sparkles: + runs-on: ubuntu-latest + env: + NODE_OPTIONS: '--max_old_space_size=4096' + YARN_ENABLE_IMMUTABLE_INSTALLS: false + validateWorkflows: + name: Validate workflows + steps: + - uses: actions/setup-node@v4 + with: + node-version: 20 + - uses: actions/checkout@v4 + - name: Install dependencies + run: yarn --immutable + - name: Validate + run: npx github-actions-wac validate + needs: checkComment + runs-on: ubuntu-latest + env: + NODE_OPTIONS: '--max_old_space_size=4096' + YARN_ENABLE_IMMUTABLE_INSTALLS: false + baseBranch: + needs: checkComment + name: Get base branch + outputs: + base-branch: ${{ steps.base-branch.outputs.base-branch }} + steps: + - uses: actions/setup-node@v4 + with: + node-version: 20 + - uses: actions/checkout@v4 + - name: Get base branch + id: base-branch + env: + GITHUB_TOKEN: ${{ secrets.GH_TOKEN }} + run: >- + echo "base-branch=$(gh pr view ${{ github.event.issue.number }} --json + baseRefName -q .baseRefName)" >> $GITHUB_OUTPUT + runs-on: ubuntu-latest + env: + NODE_OPTIONS: '--max_old_space_size=4096' + YARN_ENABLE_IMMUTABLE_INSTALLS: false + constants: + needs: baseBranch + name: Create constants + outputs: + global-cache-key: ${{ steps.global-cache-key.outputs.global-cache-key }} + run-cache-key: ${{ steps.run-cache-key.outputs.run-cache-key }} + steps: + - uses: actions/setup-node@v4 + with: + node-version: 20 + - name: Create global cache key + id: global-cache-key + run: >- + echo "global-cache-key=${{ needs.baseBranch.outputs.base-branch }}-${{ + runner.os }}-$(/bin/date -u "+%m%d")-${{ vars.RANDOM_CACHE_KEY_SUFFIX + }}" >> $GITHUB_OUTPUT + - name: Create workflow run cache key + id: run-cache-key + run: >- + echo "run-cache-key=${{ github.run_id }}-${{ github.run_attempt }}-${{ + vars.RANDOM_CACHE_KEY_SUFFIX }}" >> $GITHUB_OUTPUT + runs-on: ubuntu-latest + env: + NODE_OPTIONS: '--max_old_space_size=4096' + YARN_ENABLE_IMMUTABLE_INSTALLS: false + build: + name: Build + needs: + - baseBranch + - constants + runs-on: webiny-build-packages + steps: + - uses: actions/setup-node@v4 + with: + node-version: 20 + - uses: actions/checkout@v4 + with: + path: ${{ needs.baseBranch.outputs.base-branch }} + - name: Checkout Pull Request + working-directory: ${{ needs.baseBranch.outputs.base-branch }} + run: gh pr checkout ${{ github.event.issue.number }} + env: + GITHUB_TOKEN: ${{ secrets.GH_TOKEN }} + - uses: actions/cache@v4 + with: + path: ${{ needs.baseBranch.outputs.base-branch }}/.yarn/cache + key: yarn-${{ runner.os }}-${{ hashFiles('**/yarn.lock') }} + - uses: actions/cache@v4 + with: + path: ${{ needs.baseBranch.outputs.base-branch }}/.webiny/cached-packages + key: ${{ needs.constants.outputs.global-cache-key }} + - name: Install dependencies + run: yarn --immutable + working-directory: ${{ needs.baseBranch.outputs.base-branch }} + - name: Build packages + run: yarn build:quick + working-directory: ${{ needs.baseBranch.outputs.base-branch }} + - uses: actions/cache@v4 + with: + path: ${{ needs.baseBranch.outputs.base-branch }}/.webiny/cached-packages + key: ${{ needs.constants.outputs.run-cache-key }} + env: + NODE_OPTIONS: '--max_old_space_size=4096' + YARN_ENABLE_IMMUTABLE_INSTALLS: false + e2e-wby-cms-ddb-constants: + needs: + - baseBranch + - constants + - build + name: Constants - DDB + outputs: + cypress-folders: ${{ steps.list-cypress-folders.outputs.cypress-folders }} + pulumi-backend-url: ${{ steps.pulumi-backend-url.outputs.pulumi-backend-url }} + steps: + - uses: actions/setup-node@v4 + with: + node-version: 20 + - uses: actions/checkout@v4 + with: + path: ${{ needs.baseBranch.outputs.base-branch }} + - name: Checkout Pull Request + working-directory: ${{ needs.baseBranch.outputs.base-branch }} + run: gh pr checkout ${{ github.event.issue.number }} + env: + GITHUB_TOKEN: ${{ secrets.GH_TOKEN }} + - name: List Cypress tests folders + id: list-cypress-folders + run: >- + echo "cypress-folders=$(node scripts/listCypressTestsFolders.js)" >> + $GITHUB_OUTPUT + working-directory: ${{ needs.baseBranch.outputs.base-branch }} + - name: Get Pulumi backend URL + id: get-pulumi-backend-url + run: >- + echo "pulumi-backend-url=${{ secrets.WEBINY_PULUMI_BACKEND }}${{ + github.run_id }}_ddb" >> $GITHUB_OUTPUT + runs-on: ubuntu-latest + env: + NODE_OPTIONS: '--max_old_space_size=4096' + YARN_ENABLE_IMMUTABLE_INSTALLS: false + e2e-wby-cms-ddb-project-setup: + needs: + - baseBranch + - constants + - e2e-wby-cms-ddb-constants + name: E2E (DDB) - Project setup + outputs: + cypress-config: ${{ steps.save-cypress-config.outputs.cypress-config }} + environment: next + env: + NODE_OPTIONS: '--max_old_space_size=4096' + YARN_ENABLE_IMMUTABLE_INSTALLS: false + CYPRESS_MAILOSAUR_API_KEY: ${{ secrets.CYPRESS_MAILOSAUR_API_KEY }} + PULUMI_CONFIG_PASSPHRASE: ${{ secrets.PULUMI_CONFIG_PASSPHRASE }} + PULUMI_SECRETS_PROVIDER: ${{ secrets.PULUMI_SECRETS_PROVIDER }} + WEBINY_PULUMI_BACKEND: ${{ needs.e2e-wby-cms-ddb-constants.outputs.pulumi-backend-url }} + steps: + - uses: actions/setup-node@v4 + with: + node-version: 20 + - name: Configure AWS Credentials + uses: aws-actions/configure-aws-credentials@v4 + with: + role-to-assume: arn:aws:iam::726952677045:role/GitHubActionsWebinyJs + aws-region: eu-central-1 + - uses: actions/checkout@v4 + with: + path: ${{ needs.baseBranch.outputs.base-branch }} + - name: Checkout Pull Request + working-directory: ${{ needs.baseBranch.outputs.base-branch }} + run: gh pr checkout ${{ github.event.issue.number }} + env: + GITHUB_TOKEN: ${{ secrets.GH_TOKEN }} + - uses: actions/cache@v4 + with: + path: ${{ needs.baseBranch.outputs.base-branch }}/.yarn/cache + key: yarn-${{ runner.os }}-${{ hashFiles('**/yarn.lock') }} + - uses: actions/cache@v4 + with: + path: ${{ needs.baseBranch.outputs.base-branch }}/.webiny/cached-packages + key: ${{ needs.constants.outputs.run-cache-key }} + - name: Install dependencies + run: yarn --immutable + working-directory: ${{ needs.baseBranch.outputs.base-branch }} + - name: Build packages + run: yarn build:quick + working-directory: ${{ needs.baseBranch.outputs.base-branch }} + - name: Start Verdaccio local server + working-directory: ${{ needs.baseBranch.outputs.base-branch }} + run: >- + yarn add pm2 verdaccio && npx pm2 start verdaccio -- -c + .verdaccio.yaml + - name: Configure NPM to use local registry + run: npm config set registry http://localhost:4873 + - name: Set git email + run: git config --global user.email "webiny-bot@webiny.com" + - name: Set git username + run: git config --global user.name "webiny-bot" + - name: Create ".npmrc" file in the project root, with a dummy auth token + working-directory: ${{ needs.baseBranch.outputs.base-branch }} + run: echo '//localhost:4873/:_authToken="dummy-auth-token"' > .npmrc + - name: Version and publish to Verdaccio + working-directory: ${{ needs.baseBranch.outputs.base-branch }} + run: yarn release --type=verdaccio + - name: Create verdaccio-files artifact + uses: actions/upload-artifact@v4 + with: + name: verdaccio-files-ddb + retention-days: 1 + include-hidden-files: true + path: |- + ${{ needs.baseBranch.outputs.base-branch }}/.verdaccio/ + ${{ needs.baseBranch.outputs.base-branch }}/.verdaccio.yaml + - name: Disable Webiny telemetry + run: > + mkdir ~/.webiny && echo '{ "id": "ci", "telemetry": false }' > + ~/.webiny/config + - name: Create a new Webiny project + run: > + npx create-webiny-project@local-npm new-webiny-project --tag local-npm + --no-interactive --assign-to-yarnrc + '{"npmRegistryServer":"http://localhost:4873","unsafeHttpWhitelist":["localhost"]}' + --template-options '{"region":"${{ env.AWS_REGION + }}","storageOperations":"ddb"}' + - name: Print CLI version + working-directory: new-webiny-project + run: yarn webiny --version + - name: Create project-files artifact + uses: actions/upload-artifact@v4 + with: + name: project-files-ddb + retention-days: 1 + include-hidden-files: true + path: |- + new-webiny-project/ + !new-webiny-project/node_modules/**/* + !new-webiny-project/**/node_modules/**/* + !new-webiny-project/.yarn/cache/**/* + - name: Deploy Core + working-directory: new-webiny-project + run: yarn webiny deploy apps/core --env dev + - name: Deploy API + working-directory: new-webiny-project + run: yarn webiny deploy apps/api --env dev + - name: Deploy Admin Area + working-directory: new-webiny-project + run: yarn webiny deploy apps/admin --env dev + - name: Deploy Website + working-directory: new-webiny-project + run: yarn webiny deploy apps/website --env dev + - name: Deployment Summary + run: >- + node + .github/workflows/wac/utils/runNodeScripts/printDeploymentSummary.js + '../new-webiny-project' >> $GITHUB_STEP_SUMMARY + working-directory: ${{ needs.baseBranch.outputs.base-branch }} + - name: Create Cypress config + run: yarn setup-cypress --projectFolder ../new-webiny-project + working-directory: ${{ needs.baseBranch.outputs.base-branch }} + - name: Save Cypress config + id: save-cypress-config + run: >- + echo "cypress-config=$(cat cypress-tests/cypress.config.ts | tr -d + '\t\n\r')" >> $GITHUB_OUTPUT + working-directory: ${{ needs.baseBranch.outputs.base-branch }} + - name: Cypress - run installation wizard test + run: >- + yarn cy:run --browser chrome --spec + "cypress/e2e/adminInstallation/**/*.cy.js" + working-directory: ${{ needs.baseBranch.outputs.base-branch }} + runs-on: ubuntu-latest + permissions: + id-token: write + e2e-wby-cms-ddb-cypress-tests: + name: >- + ${{ matrix.cypress-folder }} (ddb, ${{ matrix.os }}, Node v${{ matrix.node + }}) + needs: + - baseBranch + - constants + - e2e-wby-cms-ddb-constants + - e2e-wby-cms-ddb-project-setup + strategy: + fail-fast: false + matrix: + os: + - ubuntu-latest + node: + - 22 + cypress-folder: >- + ${{ fromJson(needs.e2e-wby-cms-ddb-constants.outputs.cypress-folders) + }} + environment: next + env: + NODE_OPTIONS: '--max_old_space_size=4096' + YARN_ENABLE_IMMUTABLE_INSTALLS: false + CYPRESS_MAILOSAUR_API_KEY: ${{ secrets.CYPRESS_MAILOSAUR_API_KEY }} + PULUMI_CONFIG_PASSPHRASE: ${{ secrets.PULUMI_CONFIG_PASSPHRASE }} + PULUMI_SECRETS_PROVIDER: ${{ secrets.PULUMI_SECRETS_PROVIDER }} + WEBINY_PULUMI_BACKEND: ${{ needs.e2e-wby-cms-ddb-constants.outputs.pulumi-backend-url }} + steps: + - uses: actions/setup-node@v4 + with: + node-version: 20 + - uses: actions/checkout@v4 + with: + path: ${{ needs.baseBranch.outputs.base-branch }} + - name: Checkout Pull Request + working-directory: ${{ needs.baseBranch.outputs.base-branch }} + run: gh pr checkout ${{ github.event.issue.number }} + env: + GITHUB_TOKEN: ${{ secrets.GH_TOKEN }} + - uses: actions/cache@v4 + with: + path: ${{ needs.baseBranch.outputs.base-branch }}/.yarn/cache + key: yarn-${{ runner.os }}-${{ hashFiles('**/yarn.lock') }} + - uses: actions/cache@v4 + with: + path: ${{ needs.baseBranch.outputs.base-branch }}/.webiny/cached-packages + key: ${{ needs.constants.outputs.run-cache-key }} + - name: Install dependencies + run: yarn --immutable + working-directory: ${{ needs.baseBranch.outputs.base-branch }} + - name: Build packages + run: yarn build:quick + working-directory: ${{ needs.baseBranch.outputs.base-branch }} + - name: Set up Cypress config + working-directory: ${{ needs.baseBranch.outputs.base-branch }} + run: >- + echo '${{ needs.e2e-wby-cms-ddb-project-setup.outputs.cypress-config + }}' > cypress-tests/cypress.config.ts + - name: Cypress - run "${{ matrix.cypress-folder }}" tests + timeout-minutes: 40 + working-directory: ${{ needs.baseBranch.outputs.base-branch }} + run: yarn cy:run --browser chrome --spec "${{ matrix.cypress-folder }}" + runs-on: ubuntu-latest + e2e-wby-cms-ddb-es-constants: + needs: + - baseBranch + - constants + - build + name: Constants - DDB-ES + outputs: + cypress-folders: ${{ steps.list-cypress-folders.outputs.cypress-folders }} + pulumi-backend-url: ${{ steps.pulumi-backend-url.outputs.pulumi-backend-url }} + steps: + - uses: actions/setup-node@v4 + with: + node-version: 20 + - uses: actions/checkout@v4 + with: + path: ${{ needs.baseBranch.outputs.base-branch }} + - name: Checkout Pull Request + working-directory: ${{ needs.baseBranch.outputs.base-branch }} + run: gh pr checkout ${{ github.event.issue.number }} + env: + GITHUB_TOKEN: ${{ secrets.GH_TOKEN }} + - name: List Cypress tests folders + id: list-cypress-folders + run: >- + echo "cypress-folders=$(node scripts/listCypressTestsFolders.js)" >> + $GITHUB_OUTPUT + working-directory: ${{ needs.baseBranch.outputs.base-branch }} + - name: Get Pulumi backend URL + id: get-pulumi-backend-url + run: >- + echo "pulumi-backend-url=${{ secrets.WEBINY_PULUMI_BACKEND }}${{ + github.run_id }}_ddb-es" >> $GITHUB_OUTPUT + runs-on: ubuntu-latest + env: + NODE_OPTIONS: '--max_old_space_size=4096' + YARN_ENABLE_IMMUTABLE_INSTALLS: false + e2e-wby-cms-ddb-es-project-setup: + needs: + - baseBranch + - constants + - e2e-wby-cms-ddb-es-constants + name: E2E (DDB-ES) - Project setup + outputs: + cypress-config: ${{ steps.save-cypress-config.outputs.cypress-config }} + environment: next + env: + NODE_OPTIONS: '--max_old_space_size=4096' + YARN_ENABLE_IMMUTABLE_INSTALLS: false + CYPRESS_MAILOSAUR_API_KEY: ${{ secrets.CYPRESS_MAILOSAUR_API_KEY }} + PULUMI_CONFIG_PASSPHRASE: ${{ secrets.PULUMI_CONFIG_PASSPHRASE }} + PULUMI_SECRETS_PROVIDER: ${{ secrets.PULUMI_SECRETS_PROVIDER }} + WEBINY_PULUMI_BACKEND: ${{ needs.e2e-wby-cms-ddb-es-constants.outputs.pulumi-backend-url }} + AWS_ELASTIC_SEARCH_DOMAIN_NAME: ${{ secrets.AWS_ELASTIC_SEARCH_DOMAIN_NAME }} + ELASTIC_SEARCH_ENDPOINT: ${{ secrets.ELASTIC_SEARCH_ENDPOINT }} + ELASTIC_SEARCH_INDEX_PREFIX: ${{ github.run_id }}_ + steps: + - uses: actions/setup-node@v4 + with: + node-version: 20 + - name: Configure AWS Credentials + uses: aws-actions/configure-aws-credentials@v4 + with: + role-to-assume: arn:aws:iam::726952677045:role/GitHubActionsWebinyJs + aws-region: eu-central-1 + - uses: actions/checkout@v4 + with: + path: ${{ needs.baseBranch.outputs.base-branch }} + - name: Checkout Pull Request + working-directory: ${{ needs.baseBranch.outputs.base-branch }} + run: gh pr checkout ${{ github.event.issue.number }} + env: + GITHUB_TOKEN: ${{ secrets.GH_TOKEN }} + - uses: actions/cache@v4 + with: + path: ${{ needs.baseBranch.outputs.base-branch }}/.yarn/cache + key: yarn-${{ runner.os }}-${{ hashFiles('**/yarn.lock') }} + - uses: actions/cache@v4 + with: + path: ${{ needs.baseBranch.outputs.base-branch }}/.webiny/cached-packages + key: ${{ needs.constants.outputs.run-cache-key }} + - name: Install dependencies + run: yarn --immutable + working-directory: ${{ needs.baseBranch.outputs.base-branch }} + - name: Build packages + run: yarn build:quick + working-directory: ${{ needs.baseBranch.outputs.base-branch }} + - name: Start Verdaccio local server + working-directory: ${{ needs.baseBranch.outputs.base-branch }} + run: >- + yarn add pm2 verdaccio && npx pm2 start verdaccio -- -c + .verdaccio.yaml + - name: Configure NPM to use local registry + run: npm config set registry http://localhost:4873 + - name: Set git email + run: git config --global user.email "webiny-bot@webiny.com" + - name: Set git username + run: git config --global user.name "webiny-bot" + - name: Create ".npmrc" file in the project root, with a dummy auth token + working-directory: ${{ needs.baseBranch.outputs.base-branch }} + run: echo '//localhost:4873/:_authToken="dummy-auth-token"' > .npmrc + - name: Version and publish to Verdaccio + working-directory: ${{ needs.baseBranch.outputs.base-branch }} + run: yarn release --type=verdaccio + - name: Create verdaccio-files artifact + uses: actions/upload-artifact@v4 + with: + name: verdaccio-files-ddb-es + retention-days: 1 + include-hidden-files: true + path: |- + ${{ needs.baseBranch.outputs.base-branch }}/.verdaccio/ + ${{ needs.baseBranch.outputs.base-branch }}/.verdaccio.yaml + - name: Disable Webiny telemetry + run: > + mkdir ~/.webiny && echo '{ "id": "ci", "telemetry": false }' > + ~/.webiny/config + - name: Create a new Webiny project + run: > + npx create-webiny-project@local-npm new-webiny-project --tag local-npm + --no-interactive --assign-to-yarnrc + '{"npmRegistryServer":"http://localhost:4873","unsafeHttpWhitelist":["localhost"]}' + --template-options '{"region":"${{ env.AWS_REGION + }}","storageOperations":"ddb-es"}' + - name: Print CLI version + working-directory: new-webiny-project + run: yarn webiny --version + - name: Create project-files artifact + uses: actions/upload-artifact@v4 + with: + name: project-files-ddb-es + retention-days: 1 + include-hidden-files: true + path: |- + new-webiny-project/ + !new-webiny-project/node_modules/**/* + !new-webiny-project/**/node_modules/**/* + !new-webiny-project/.yarn/cache/**/* + - name: Deploy Core + working-directory: new-webiny-project + run: yarn webiny deploy apps/core --env dev + - name: Deploy API + working-directory: new-webiny-project + run: yarn webiny deploy apps/api --env dev + - name: Deploy Admin Area + working-directory: new-webiny-project + run: yarn webiny deploy apps/admin --env dev + - name: Deploy Website + working-directory: new-webiny-project + run: yarn webiny deploy apps/website --env dev + - name: Deployment Summary + run: >- + node + .github/workflows/wac/utils/runNodeScripts/printDeploymentSummary.js + '../new-webiny-project' >> $GITHUB_STEP_SUMMARY + working-directory: ${{ needs.baseBranch.outputs.base-branch }} + - name: Create Cypress config + run: yarn setup-cypress --projectFolder ../new-webiny-project + working-directory: ${{ needs.baseBranch.outputs.base-branch }} + - name: Save Cypress config + id: save-cypress-config + run: >- + echo "cypress-config=$(cat cypress-tests/cypress.config.ts | tr -d + '\t\n\r')" >> $GITHUB_OUTPUT + working-directory: ${{ needs.baseBranch.outputs.base-branch }} + - name: Cypress - run installation wizard test + run: >- + yarn cy:run --browser chrome --spec + "cypress/e2e/adminInstallation/**/*.cy.js" + working-directory: ${{ needs.baseBranch.outputs.base-branch }} + runs-on: ubuntu-latest + permissions: + id-token: write + e2e-wby-cms-ddb-es-cypress-tests: + name: >- + ${{ matrix.cypress-folder }} (ddb-es, ${{ matrix.os }}, Node v${{ + matrix.node }}) + needs: + - baseBranch + - constants + - e2e-wby-cms-ddb-es-constants + - e2e-wby-cms-ddb-es-project-setup + strategy: + fail-fast: false + matrix: + os: + - ubuntu-latest + node: + - 22 + cypress-folder: >- + ${{ + fromJson(needs.e2e-wby-cms-ddb-es-constants.outputs.cypress-folders) + }} + environment: next + env: + NODE_OPTIONS: '--max_old_space_size=4096' + YARN_ENABLE_IMMUTABLE_INSTALLS: false + CYPRESS_MAILOSAUR_API_KEY: ${{ secrets.CYPRESS_MAILOSAUR_API_KEY }} + PULUMI_CONFIG_PASSPHRASE: ${{ secrets.PULUMI_CONFIG_PASSPHRASE }} + PULUMI_SECRETS_PROVIDER: ${{ secrets.PULUMI_SECRETS_PROVIDER }} + WEBINY_PULUMI_BACKEND: ${{ needs.e2e-wby-cms-ddb-es-constants.outputs.pulumi-backend-url }} + AWS_ELASTIC_SEARCH_DOMAIN_NAME: ${{ secrets.AWS_ELASTIC_SEARCH_DOMAIN_NAME }} + ELASTIC_SEARCH_ENDPOINT: ${{ secrets.ELASTIC_SEARCH_ENDPOINT }} + ELASTIC_SEARCH_INDEX_PREFIX: ${{ github.run_id }}_ + steps: + - uses: actions/setup-node@v4 + with: + node-version: 20 + - uses: actions/checkout@v4 + with: + path: ${{ needs.baseBranch.outputs.base-branch }} + - name: Checkout Pull Request + working-directory: ${{ needs.baseBranch.outputs.base-branch }} + run: gh pr checkout ${{ github.event.issue.number }} + env: + GITHUB_TOKEN: ${{ secrets.GH_TOKEN }} + - uses: actions/cache@v4 + with: + path: ${{ needs.baseBranch.outputs.base-branch }}/.yarn/cache + key: yarn-${{ runner.os }}-${{ hashFiles('**/yarn.lock') }} + - uses: actions/cache@v4 + with: + path: ${{ needs.baseBranch.outputs.base-branch }}/.webiny/cached-packages + key: ${{ needs.constants.outputs.run-cache-key }} + - name: Install dependencies + run: yarn --immutable + working-directory: ${{ needs.baseBranch.outputs.base-branch }} + - name: Build packages + run: yarn build:quick + working-directory: ${{ needs.baseBranch.outputs.base-branch }} + - name: Set up Cypress config + working-directory: ${{ needs.baseBranch.outputs.base-branch }} + run: >- + echo '${{ + needs.e2e-wby-cms-ddb-es-project-setup.outputs.cypress-config }}' > + cypress-tests/cypress.config.ts + - name: Cypress - run "${{ matrix.cypress-folder }}" tests + timeout-minutes: 40 + working-directory: ${{ needs.baseBranch.outputs.base-branch }} + run: yarn cy:run --browser chrome --spec "${{ matrix.cypress-folder }}" + runs-on: ubuntu-latest + e2e-wby-cms-ddb-os-constants: + needs: + - baseBranch + - constants + - build + name: Constants - DDB-OS + outputs: + cypress-folders: ${{ steps.list-cypress-folders.outputs.cypress-folders }} + pulumi-backend-url: ${{ steps.pulumi-backend-url.outputs.pulumi-backend-url }} + steps: + - uses: actions/setup-node@v4 + with: + node-version: 20 + - uses: actions/checkout@v4 + with: + path: ${{ needs.baseBranch.outputs.base-branch }} + - name: Checkout Pull Request + working-directory: ${{ needs.baseBranch.outputs.base-branch }} + run: gh pr checkout ${{ github.event.issue.number }} + env: + GITHUB_TOKEN: ${{ secrets.GH_TOKEN }} + - name: List Cypress tests folders + id: list-cypress-folders + run: >- + echo "cypress-folders=$(node scripts/listCypressTestsFolders.js)" >> + $GITHUB_OUTPUT + working-directory: ${{ needs.baseBranch.outputs.base-branch }} + - name: Get Pulumi backend URL + id: get-pulumi-backend-url + run: >- + echo "pulumi-backend-url=${{ secrets.WEBINY_PULUMI_BACKEND }}${{ + github.run_id }}_ddb-os" >> $GITHUB_OUTPUT + runs-on: ubuntu-latest + env: + NODE_OPTIONS: '--max_old_space_size=4096' + YARN_ENABLE_IMMUTABLE_INSTALLS: false + e2e-wby-cms-ddb-os-project-setup: + needs: + - baseBranch + - constants + - e2e-wby-cms-ddb-os-constants + name: E2E (DDB-OS) - Project setup + outputs: + cypress-config: ${{ steps.save-cypress-config.outputs.cypress-config }} + environment: next + env: + NODE_OPTIONS: '--max_old_space_size=4096' + YARN_ENABLE_IMMUTABLE_INSTALLS: false + CYPRESS_MAILOSAUR_API_KEY: ${{ secrets.CYPRESS_MAILOSAUR_API_KEY }} + PULUMI_CONFIG_PASSPHRASE: ${{ secrets.PULUMI_CONFIG_PASSPHRASE }} + PULUMI_SECRETS_PROVIDER: ${{ secrets.PULUMI_SECRETS_PROVIDER }} + WEBINY_PULUMI_BACKEND: ${{ needs.e2e-wby-cms-ddb-os-constants.outputs.pulumi-backend-url }} + AWS_ELASTIC_SEARCH_DOMAIN_NAME: ${{ secrets.AWS_OPEN_SEARCH_DOMAIN_NAME }} + ELASTIC_SEARCH_ENDPOINT: ${{ secrets.OPEN_SEARCH_ENDPOINT }} + ELASTIC_SEARCH_INDEX_PREFIX: ${{ github.run_id }}_ + steps: + - uses: actions/setup-node@v4 + with: + node-version: 20 + - name: Configure AWS Credentials + uses: aws-actions/configure-aws-credentials@v4 + with: + role-to-assume: arn:aws:iam::726952677045:role/GitHubActionsWebinyJs + aws-region: eu-central-1 + - uses: actions/checkout@v4 + with: + path: ${{ needs.baseBranch.outputs.base-branch }} + - name: Checkout Pull Request + working-directory: ${{ needs.baseBranch.outputs.base-branch }} + run: gh pr checkout ${{ github.event.issue.number }} + env: + GITHUB_TOKEN: ${{ secrets.GH_TOKEN }} + - uses: actions/cache@v4 + with: + path: ${{ needs.baseBranch.outputs.base-branch }}/.yarn/cache + key: yarn-${{ runner.os }}-${{ hashFiles('**/yarn.lock') }} + - uses: actions/cache@v4 + with: + path: ${{ needs.baseBranch.outputs.base-branch }}/.webiny/cached-packages + key: ${{ needs.constants.outputs.run-cache-key }} + - name: Install dependencies + run: yarn --immutable + working-directory: ${{ needs.baseBranch.outputs.base-branch }} + - name: Build packages + run: yarn build:quick + working-directory: ${{ needs.baseBranch.outputs.base-branch }} + - name: Start Verdaccio local server + working-directory: ${{ needs.baseBranch.outputs.base-branch }} + run: >- + yarn add pm2 verdaccio && npx pm2 start verdaccio -- -c + .verdaccio.yaml + - name: Configure NPM to use local registry + run: npm config set registry http://localhost:4873 + - name: Set git email + run: git config --global user.email "webiny-bot@webiny.com" + - name: Set git username + run: git config --global user.name "webiny-bot" + - name: Create ".npmrc" file in the project root, with a dummy auth token + working-directory: ${{ needs.baseBranch.outputs.base-branch }} + run: echo '//localhost:4873/:_authToken="dummy-auth-token"' > .npmrc + - name: Version and publish to Verdaccio + working-directory: ${{ needs.baseBranch.outputs.base-branch }} + run: yarn release --type=verdaccio + - name: Create verdaccio-files artifact + uses: actions/upload-artifact@v4 + with: + name: verdaccio-files-ddb-os + retention-days: 1 + include-hidden-files: true + path: |- + ${{ needs.baseBranch.outputs.base-branch }}/.verdaccio/ + ${{ needs.baseBranch.outputs.base-branch }}/.verdaccio.yaml + - name: Disable Webiny telemetry + run: > + mkdir ~/.webiny && echo '{ "id": "ci", "telemetry": false }' > + ~/.webiny/config + - name: Create a new Webiny project + run: > + npx create-webiny-project@local-npm new-webiny-project --tag local-npm + --no-interactive --assign-to-yarnrc + '{"npmRegistryServer":"http://localhost:4873","unsafeHttpWhitelist":["localhost"]}' + --template-options '{"region":"${{ env.AWS_REGION + }}","storageOperations":"ddb-os"}' + - name: Print CLI version + working-directory: new-webiny-project + run: yarn webiny --version + - name: Create project-files artifact + uses: actions/upload-artifact@v4 + with: + name: project-files-ddb-os + retention-days: 1 + include-hidden-files: true + path: |- + new-webiny-project/ + !new-webiny-project/node_modules/**/* + !new-webiny-project/**/node_modules/**/* + !new-webiny-project/.yarn/cache/**/* + - name: Deploy Core + working-directory: new-webiny-project + run: yarn webiny deploy apps/core --env dev + - name: Deploy API + working-directory: new-webiny-project + run: yarn webiny deploy apps/api --env dev + - name: Deploy Admin Area + working-directory: new-webiny-project + run: yarn webiny deploy apps/admin --env dev + - name: Deploy Website + working-directory: new-webiny-project + run: yarn webiny deploy apps/website --env dev + - name: Deployment Summary + run: >- + node + .github/workflows/wac/utils/runNodeScripts/printDeploymentSummary.js + '../new-webiny-project' >> $GITHUB_STEP_SUMMARY + working-directory: ${{ needs.baseBranch.outputs.base-branch }} + - name: Create Cypress config + run: yarn setup-cypress --projectFolder ../new-webiny-project + working-directory: ${{ needs.baseBranch.outputs.base-branch }} + - name: Save Cypress config + id: save-cypress-config + run: >- + echo "cypress-config=$(cat cypress-tests/cypress.config.ts | tr -d + '\t\n\r')" >> $GITHUB_OUTPUT + working-directory: ${{ needs.baseBranch.outputs.base-branch }} + - name: Cypress - run installation wizard test + run: >- + yarn cy:run --browser chrome --spec + "cypress/e2e/adminInstallation/**/*.cy.js" + working-directory: ${{ needs.baseBranch.outputs.base-branch }} + runs-on: ubuntu-latest + permissions: + id-token: write + e2e-wby-cms-ddb-os-cypress-tests: + name: >- + ${{ matrix.cypress-folder }} (ddb-os, ${{ matrix.os }}, Node v${{ + matrix.node }}) + needs: + - baseBranch + - constants + - e2e-wby-cms-ddb-os-constants + - e2e-wby-cms-ddb-os-project-setup + strategy: + fail-fast: false + matrix: + os: + - ubuntu-latest + node: + - 22 + cypress-folder: >- + ${{ + fromJson(needs.e2e-wby-cms-ddb-os-constants.outputs.cypress-folders) + }} + environment: next + env: + NODE_OPTIONS: '--max_old_space_size=4096' + YARN_ENABLE_IMMUTABLE_INSTALLS: false + CYPRESS_MAILOSAUR_API_KEY: ${{ secrets.CYPRESS_MAILOSAUR_API_KEY }} + PULUMI_CONFIG_PASSPHRASE: ${{ secrets.PULUMI_CONFIG_PASSPHRASE }} + PULUMI_SECRETS_PROVIDER: ${{ secrets.PULUMI_SECRETS_PROVIDER }} + WEBINY_PULUMI_BACKEND: ${{ needs.e2e-wby-cms-ddb-os-constants.outputs.pulumi-backend-url }} + AWS_ELASTIC_SEARCH_DOMAIN_NAME: ${{ secrets.AWS_OPEN_SEARCH_DOMAIN_NAME }} + ELASTIC_SEARCH_ENDPOINT: ${{ secrets.OPEN_SEARCH_ENDPOINT }} + ELASTIC_SEARCH_INDEX_PREFIX: ${{ github.run_id }}_ + steps: + - uses: actions/setup-node@v4 + with: + node-version: 20 + - uses: actions/checkout@v4 + with: + path: ${{ needs.baseBranch.outputs.base-branch }} + - name: Checkout Pull Request + working-directory: ${{ needs.baseBranch.outputs.base-branch }} + run: gh pr checkout ${{ github.event.issue.number }} + env: + GITHUB_TOKEN: ${{ secrets.GH_TOKEN }} + - uses: actions/cache@v4 + with: + path: ${{ needs.baseBranch.outputs.base-branch }}/.yarn/cache + key: yarn-${{ runner.os }}-${{ hashFiles('**/yarn.lock') }} + - uses: actions/cache@v4 + with: + path: ${{ needs.baseBranch.outputs.base-branch }}/.webiny/cached-packages + key: ${{ needs.constants.outputs.run-cache-key }} + - name: Install dependencies + run: yarn --immutable + working-directory: ${{ needs.baseBranch.outputs.base-branch }} + - name: Build packages + run: yarn build:quick + working-directory: ${{ needs.baseBranch.outputs.base-branch }} + - name: Set up Cypress config + working-directory: ${{ needs.baseBranch.outputs.base-branch }} + run: >- + echo '${{ + needs.e2e-wby-cms-ddb-os-project-setup.outputs.cypress-config }}' > + cypress-tests/cypress.config.ts + - name: Cypress - run "${{ matrix.cypress-folder }}" tests + timeout-minutes: 40 + working-directory: ${{ needs.baseBranch.outputs.base-branch }} + run: yarn cy:run --browser chrome --spec "${{ matrix.cypress-folder }}" + runs-on: ubuntu-latest