Skip to content
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

Try environment secrets #307

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
111 changes: 56 additions & 55 deletions .github/workflows/e2etest.yml
Original file line number Diff line number Diff line change
@@ -1,61 +1,62 @@
name: e2e-tests

on:
pull_request:
branches: [ develop ]
pull_request:
branches: [develop]

jobs:
e2e-test:
runs-on: ubuntu-latest
env:
DEVHUB_USERNAME: ${{ secrets.DEVHUB_USERNAME }}
DEVHUB_AUTH: ${{ secrets.DEVHUB_AUTH }}
PR_NUMBER: ${{ github.event.pull_request.number }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Node (v20)
uses: actions/setup-node@v3
with:
node-version: '20'
- name: Setup SF and yarn
run: |
echo 'y' | npm install @salesforce/cli --global
npm install --global yarn
sf --version
echo 'y' | sf plugins install shane-sfdx-plugins
- name: Build the plugin
run: |
yarn install && yarn build
- name: Auth Devhub
run: |
echo ${{ env.DEVHUB_AUTH }} > authFile
sf force auth sfdxurl store -f 'authFile'
- name: Cleanup The Latest Scratch Org From This Pull Request
run: |
LAST_SCRATCH_ID=`sf data query --query "SELECT Id FROM ActiveScratchOrg WHERE SignupUsername LIKE '%pr${{ env.PR_NUMBER }}%'" -o ${{ env.DEVHUB_USERNAME }} --json | jq -r '.result.records[0].Id'`
if [ "$LAST_SCRATCH_ID" != "null" ]; then sf data delete record -s ActiveScratchOrg -o ${{ env.DEVHUB_USERNAME }} -i $LAST_SCRATCH_ID; else echo 'No scratch org needs to be deleted.'; fi
- name: Create Scratch Org
id: scratch-org-step
run: |
export SCRATCH_ORG_ID=`date +%Y%m%d-%H%M%S`
export SCRATCH_ORG_ALIAS="gworkflow-pr${{ env.PR_NUMBER }}-$SCRATCH_ORG_ID"
export SCRATCH_ORG_USERNAME="[email protected]"

./bin/run commerce:scratchorg:create -u "$SCRATCH_ORG_USERNAME" -a "$SCRATCH_ORG_ALIAS" -v ${{ env.DEVHUB_USERNAME }} -d 1
echo "USERNAME=$SCRATCH_ORG_USERNAME" >> "$GITHUB_OUTPUT"
- name: Create B2C LWR Store
env:
SCRATCH_ORG_USERNAME: ${{ steps.scratch-org-step.outputs.USERNAME }}
run: ./bin/run commerce:store:create -n b2cstore01 -b [email protected] -v ${{ env.DEVHUB_USERNAME }} -u ${{ env.SCRATCH_ORG_USERNAME }} --json

- name: Create B2B LWR Store
e2e-test:
environment: e2e-test-env
runs-on: ubuntu-latest
env:
SCRATCH_ORG_USERNAME: ${{ steps.scratch-org-step.outputs.USERNAME }}
run: ./bin/run commerce:store:create -o b2b -n b2bstore01 -b [email protected] -v ${{ env.DEVHUB_USERNAME }} -u ${{ env.SCRATCH_ORG_USERNAME }} --json
- name: Create B2B Aura Store
env:
SCRATCH_ORG_USERNAME: ${{ steps.scratch-org-step.outputs.USERNAME }}
run: ./bin/run commerce:store:create -o b2b -t "B2B Commerce (Aura)" -n b2baurastore01 -b [email protected] -v ${{ env.DEVHUB_USERNAME }} -u ${{ env.SCRATCH_ORG_USERNAME }} --json
- name: Confirmation
run: echo "All stores are created!"
DEVHUB_USERNAME: ${{ secrets.DEVHUB_USERNAME }}
DEVHUB_AUTH: ${{ secrets.DEVHUB_AUTH }}
PR_NUMBER: ${{ github.event.pull_request.number }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Node (v20)
uses: actions/setup-node@v3
with:
node-version: '20'
- name: Setup SF and yarn
run: |
echo 'y' | npm install @salesforce/cli --global
npm install --global yarn
sf --version
echo 'y' | sf plugins install shane-sfdx-plugins
- name: Build the plugin
run: |
yarn install && yarn build
- name: Auth Devhub
run: |
echo ${{ env.DEVHUB_AUTH }} > authFile
sf force auth sfdxurl store -f 'authFile'
- name: Cleanup The Latest Scratch Org From This Pull Request
run: |
LAST_SCRATCH_ID=`sf data query --query "SELECT Id FROM ActiveScratchOrg WHERE SignupUsername LIKE '%pr${{ env.PR_NUMBER }}%'" -o ${{ env.DEVHUB_USERNAME }} --json | jq -r '.result.records[0].Id'`
if [ "$LAST_SCRATCH_ID" != "null" ]; then sf data delete record -s ActiveScratchOrg -o ${{ env.DEVHUB_USERNAME }} -i $LAST_SCRATCH_ID; else echo 'No scratch org needs to be deleted.'; fi
- name: Create Scratch Org
id: scratch-org-step
run: |
export SCRATCH_ORG_ID=`date +%Y%m%d-%H%M%S`
export SCRATCH_ORG_ALIAS="gworkflow-pr${{ env.PR_NUMBER }}-$SCRATCH_ORG_ID"
export SCRATCH_ORG_USERNAME="[email protected]"

./bin/run commerce:scratchorg:create -u "$SCRATCH_ORG_USERNAME" -a "$SCRATCH_ORG_ALIAS" -v ${{ env.DEVHUB_USERNAME }} -d 1
echo "USERNAME=$SCRATCH_ORG_USERNAME" >> "$GITHUB_OUTPUT"
- name: Create B2C LWR Store
env:
SCRATCH_ORG_USERNAME: ${{ steps.scratch-org-step.outputs.USERNAME }}
run: ./bin/run commerce:store:create -n b2cstore01 -b [email protected] -v ${{ env.DEVHUB_USERNAME }} -u ${{ env.SCRATCH_ORG_USERNAME }} --json

- name: Create B2B LWR Store
env:
SCRATCH_ORG_USERNAME: ${{ steps.scratch-org-step.outputs.USERNAME }}
run: ./bin/run commerce:store:create -o b2b -n b2bstore01 -b [email protected] -v ${{ env.DEVHUB_USERNAME }} -u ${{ env.SCRATCH_ORG_USERNAME }} --json
- name: Create B2B Aura Store
env:
SCRATCH_ORG_USERNAME: ${{ steps.scratch-org-step.outputs.USERNAME }}
run: ./bin/run commerce:store:create -o b2b -t "B2B Commerce (Aura)" -n b2baurastore01 -b [email protected] -v ${{ env.DEVHUB_USERNAME }} -u ${{ env.SCRATCH_ORG_USERNAME }} --json
- name: Confirmation
run: echo "All stores are created!"
Loading