diff --git a/.github/actions/e2e-quantic-setup/action.yml b/.github/actions/e2e-quantic-setup/action.yml index cf07141e647..47376868473 100644 --- a/.github/actions/e2e-quantic-setup/action.yml +++ b/.github/actions/e2e-quantic-setup/action.yml @@ -7,13 +7,15 @@ inputs: jwtkey: description: The SFDX JWT key contents required: true + lws-status: + description: 'Set to "enabled" to deploy the LWS enabled community, and "disabled to deploy the LWS disabled community' + required: true runs: using: composite steps: - run: | echo "${{ inputs.jwtkey }}" > server.key - npx --no-install ts-node scripts/build/deploy-community.ts --ci --scratch-org-def-path=./config/lws-disabled-scratch-def.json - npx --no-install ts-node scripts/build/deploy-community.ts --ci --scratch-org-def-path=./config/lws-enabled-scratch-def.json + npx --no-install ts-node scripts/build/deploy-community.ts --ci --scratch-org-def-path=./config/lws-${{ inputs.lws-status }}-scratch-def.json rm server.key shell: bash working-directory: ./packages/quantic @@ -25,7 +27,7 @@ runs: SFDX_AUTH_JWT_INSTANCE_URL: https://login.salesforce.com - uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4 with: - name: quantic-playwright-env + name: quantic-playwright-env-lws-${{ inputs.lws-status }} path: packages/quantic/.env include-hidden-files: true retention-days: 1 diff --git a/.github/actions/playwright-quantic/action.yml b/.github/actions/playwright-quantic/action.yml index 68769f651bb..8cb1f58ebbe 100644 --- a/.github/actions/playwright-quantic/action.yml +++ b/.github/actions/playwright-quantic/action.yml @@ -12,8 +12,9 @@ runs: steps: - uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4 with: - name: quantic-playwright-env - path: packages/quantic + pattern: quantic-playwright-env-* + path: packages/quantic/.env + merge-multiple: true - name: Run Playwright Tests run: npx playwright test --shard=${{ inputs.shardIndex }}/${{ inputs.shardTotal }} shell: bash diff --git a/.github/actions/post-scratch-org-links-on-pr/action.yml b/.github/actions/post-scratch-org-links-on-pr/action.yml index 787e9ca2a8e..79e53985d8d 100644 --- a/.github/actions/post-scratch-org-links-on-pr/action.yml +++ b/.github/actions/post-scratch-org-links-on-pr/action.yml @@ -6,15 +6,16 @@ runs: steps: - uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4 with: - name: quantic-playwright-env - path: packages/quantic + pattern: quantic-playwright-env-* + path: packages/quantic/.env + merge-multiple: true - name: Read Org URLs from .env id: read-env shell: bash run: | - LWS_ENABLED_URL=$(grep 'Quantic__LWS_enabled_URL' packages/quantic/.env | cut -d '=' -f2-) - LWS_DISABLED_URL=$(grep 'Quantic__LWS_disabled_URL' packages/quantic/.env | cut -d '=' -f2-) + LWS_ENABLED_URL=$(grep 'Quantic__LWS_enabled_URL' packages/quantic/.env/Quantic__LWS_enabled.env | cut -d '=' -f2-) + LWS_DISABLED_URL=$(grep 'Quantic__LWS_disabled_URL' packages/quantic/.env/Quantic__LWS_disabled.env | cut -d '=' -f2-) echo "lws_enabled_url=$LWS_ENABLED_URL" >> $GITHUB_OUTPUT echo "lws_disabled_url=$LWS_DISABLED_URL" >> $GITHUB_OUTPUT diff --git a/.github/workflows/e2e-quantic.yml b/.github/workflows/e2e-quantic.yml index 8a1ec86ee50..36525331641 100644 --- a/.github/workflows/e2e-quantic.yml +++ b/.github/workflows/e2e-quantic.yml @@ -9,6 +9,9 @@ jobs: e2e-quantic-setup: name: 'Setup e2e tests on Quantic' runs-on: ubuntu-latest + strategy: + matrix: + lws-status: ['enabled', 'disabled'] steps: - name: Harden Runner uses: step-security/harden-runner@ec9f2d5744a09debf3a187a3f4f675c53b671911 # v2.13.0 @@ -22,6 +25,7 @@ jobs: with: clientid: ${{ secrets.SFDX_AUTH_CLIENT_ID }} jwtkey: ${{ secrets.SFDX_AUTH_JWT_KEY }} + lws-status: ${{ matrix.lws-status }} post-scratch-org-links-to-pr: name: 'Post Scratch Org Links to PR' needs: e2e-quantic-setup diff --git a/.github/workflows/setup-quantic-examples-community.yml b/.github/workflows/setup-quantic-examples-community.yml index 2e9c48d8242..f16e5e361ad 100644 --- a/.github/workflows/setup-quantic-examples-community.yml +++ b/.github/workflows/setup-quantic-examples-community.yml @@ -42,7 +42,8 @@ jobs: - name: Read .env file and print Community URL run: | - source packages/quantic/.env + source packages/quantic/.env/Quantic__LWS_enabled.env + source packages/quantic/.env/Quantic__LWS_disabled.env echo "The Quantic Examples Community URL (LWS enabled) is $Quantic__LWS_enabled_URL" echo "The Quantic Examples Community URL (LWS disabled) is $Quantic__LWS_disabled_URL" echo "### :rocket:Access Quantic Examples Community (LWS enabled) here --> $Quantic__LWS_enabled_URL" >> $GITHUB_STEP_SUMMARY diff --git a/packages/quantic/playwright.config.ts b/packages/quantic/playwright.config.ts index c1acc73ba5d..13197bc4c2b 100644 --- a/packages/quantic/playwright.config.ts +++ b/packages/quantic/playwright.config.ts @@ -6,7 +6,8 @@ import {defineConfig, devices} from '@playwright/test'; */ import dotenv from 'dotenv'; import path from 'path'; -dotenv.config({path: path.resolve(__dirname, '.env')}); +dotenv.config({path: path.resolve(__dirname, '.env/Quantic__LWS_enabled.env')}); +dotenv.config({path: path.resolve(__dirname, '.env/Quantic__LWS_disabled.env')}); /** * See https://playwright.dev/docs/test-configuration. diff --git a/packages/quantic/scripts/build/deploy-community.ts b/packages/quantic/scripts/build/deploy-community.ts index 71e5d83c71a..7e6802415de 100644 --- a/packages/quantic/scripts/build/deploy-community.ts +++ b/packages/quantic/scripts/build/deploy-community.ts @@ -37,6 +37,7 @@ interface Options { function updateEnvFile(filePath, newVariables) { try { if (!fs.existsSync(filePath)) { + fs.mkdirSync(path.dirname(filePath), {recursive: true}); fs.writeFileSync(filePath, '', 'utf8'); } @@ -289,7 +290,7 @@ async function publishCommunity( } async function setCommunityBaseUrlAsEnvVariable(log, communityUrl, orgName) { - const pathSegments = [__dirname, '..', '..', '.env']; + const pathSegments = [__dirname, '..', '..', '.env', `${orgName}.env`]; const envFilePath = path.join(...pathSegments); const newEnvVariables = { [`${orgName}_URL`]: communityUrl,