New synchronous JS function getLogger() + deprecated async function createLogger() #859
Workflow file for this run
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
# Pipeline for Nebula Logger | |
name: Build | |
env: | |
SF_DISABLE_AUTOUPDATE: true | |
SF_LOG_LEVEL: debug | |
SF_SKIP_NEW_VERSION_CHECK: true | |
on: | |
push: | |
branches: | |
- main | |
paths: | |
- .github/workflows/** | |
- config/scratch-orgs/** | |
- nebula-logger/** | |
- sfdx-project.json | |
pull_request: | |
types: [opened, synchronize, reopened] | |
paths: | |
- .github/workflows/** | |
- config/scratch-orgs/** | |
- nebula-logger/** | |
- sfdx-project.json | |
jobs: | |
code-quality-tests: | |
name: 'Run Code Quality Tests' | |
runs-on: ubuntu-latest | |
steps: | |
- name: 'Checkout source code' | |
uses: actions/checkout@v4 | |
- name: 'Restore node_modules cache' | |
id: cache-npm | |
uses: actions/cache@v4 | |
with: | |
path: node_modules | |
key: npm-${{ hashFiles('**/package-lock.json') }} | |
restore-keys: | | |
npm-${{ env.cache-name }}- | |
npm- | |
- name: 'Install npm dependencies' | |
if: steps.cache-npm.outputs.cache-hit != 'true' | |
run: npm ci | |
- name: 'Check for changes in core directory' | |
uses: dorny/paths-filter@v3 | |
id: changes | |
with: | |
filters: | | |
core: | |
- './nebula-logger/core/**' | |
- name: 'Authorize Dev Hub' | |
if: ${{ (github.event_name == 'pull_request') && (github.event.pull_request.draft == false) && (steps.changes.outputs.core == 'true') }} | |
shell: bash | |
run: | | |
npx sf version | |
echo "${{ env.DEV_HUB_JWT_SERVER_KEY }}" > ./jwt-server.key | |
npx sf org login jwt --instance-url ${{ env.DEV_HUB_AUTH_URL }} --client-id ${{ env.DEV_HUB_CONSUMER_KEY }} --username ${{ env.DEV_HUB_BOT_USERNAME }} --jwt-key-file ./jwt-server.key --set-default-dev-hub | |
env: | |
DEV_HUB_AUTH_URL: ${{ secrets.DEV_HUB_AUTH_URL }} | |
DEV_HUB_BOT_USERNAME: ${{ secrets.DEV_HUB_BOT_USERNAME }} | |
DEV_HUB_CONSUMER_KEY: ${{ secrets.DEV_HUB_CONSUMER_KEY }} | |
DEV_HUB_JWT_SERVER_KEY: ${{ secrets.DEV_HUB_JWT_SERVER_KEY }} | |
- name: 'Verify package version number is updated' | |
if: ${{ (github.event_name == 'pull_request') && (github.event.pull_request.draft == false) && (steps.changes.outputs.core == 'true') }} | |
run: npm run package:version:number:verify | |
- name: 'Verify LWC with ESLint' | |
run: npm run scan:lwc | |
- name: 'Verify Apex with SFDX Scanner' | |
run: | | |
npm run sf:plugins:link:scanner | |
npm run scan:apex | |
# TODO - uncomment - temporarily commented-out due to an issue with apexdocs in the pipeline | |
# - name: 'Verify docs are updated' | |
# run: npm run docs:verify | |
- name: 'Verify formatting with Prettier' | |
run: npm run prettier:verify | |
lwc-jest-tests: | |
name: 'Run LWC Jest Tests' | |
needs: [code-quality-tests] | |
runs-on: ubuntu-latest | |
steps: | |
- name: 'Checkout source code' | |
uses: actions/checkout@v4 | |
- name: 'Restore node_modules cache' | |
id: cache-npm | |
uses: actions/cache@v4 | |
with: | |
path: node_modules | |
key: npm-${{ hashFiles('**/package-lock.json') }} | |
restore-keys: | | |
npm-${{ env.cache-name }}- | |
npm- | |
- name: 'Install npm dependencies' | |
if: steps.cache-npm.outputs.cache-hit != 'true' | |
run: npm ci | |
- name: 'Run LWC Tests' | |
run: npm run test:lwc | |
- name: 'Upload LWC code coverage to Codecov.io' | |
uses: codecov/codecov-action@v4 | |
with: | |
fail_ci_if_error: true | |
flags: LWC | |
token: ${{ secrets.CODECOV_TOKEN }} | |
advanced-scratch-org-tests: | |
environment: 'Advanced Scratch Org' | |
name: 'Run Advanced Scratch Org Tests' | |
needs: [code-quality-tests] | |
runs-on: ubuntu-latest | |
steps: | |
- name: 'Checkout source code' | |
uses: actions/checkout@v4 | |
- name: 'Restore node_modules cache' | |
id: cache-npm | |
uses: actions/cache@v4 | |
with: | |
path: node_modules | |
key: npm-${{ hashFiles('**/package-lock.json') }} | |
restore-keys: | | |
npm-${{ env.cache-name }}- | |
npm- | |
- name: 'Install npm dependencies' | |
if: steps.cache-npm.outputs.cache-hit != 'true' | |
run: npm ci | |
- name: 'Authorize Dev Hub' | |
shell: bash | |
run: | | |
npx sf version | |
echo "${{ env.DEV_HUB_JWT_SERVER_KEY }}" > ./jwt-server.key | |
npx sf org login jwt --instance-url ${{ env.DEV_HUB_AUTH_URL }} --client-id ${{ env.DEV_HUB_CONSUMER_KEY }} --username ${{ env.DEV_HUB_BOT_USERNAME }} --jwt-key-file ./jwt-server.key --set-default-dev-hub | |
env: | |
DEV_HUB_AUTH_URL: ${{ secrets.DEV_HUB_AUTH_URL }} | |
DEV_HUB_BOT_USERNAME: ${{ secrets.DEV_HUB_BOT_USERNAME }} | |
DEV_HUB_CONSUMER_KEY: ${{ secrets.DEV_HUB_CONSUMER_KEY }} | |
DEV_HUB_JWT_SERVER_KEY: ${{ secrets.DEV_HUB_JWT_SERVER_KEY }} | |
- name: 'Create Scratch Org' | |
run: npx sf org create scratch --no-namespace --no-track-source --duration-days 1 --definition-file ./config/scratch-orgs/advanced-scratch-def.json --wait 20 --set-default --json | |
# https://help.salesforce.com/s/articleView?id=000394906&type=1 | |
- name: 'Install OmniStudio managed package v250.7.1 (Summer ‘24 release)' | |
run: npx sf package install --package 04t4W000002Z6oC --security-type AdminsOnly --wait 30 --no-prompt | |
# To ensure that all of the Apex classes in the core directory have 75+ code coverage, | |
# deploy only the core directory & run all of its tests as part of the deployment, using `--test-level RunLocalTests` | |
- name: 'Validate Core Source in Scratch Org' | |
run: npx sf project deploy validate --source-dir ./nebula-logger/core/ --test-level RunLocalTests | |
# Now that the core directory has been deployed & tests have passed, deploy all of the metadata | |
- name: 'Deploy All Source to Scratch Org' | |
run: npx sf project deploy start --source-dir ./nebula-logger/ | |
- name: 'Deploy Test Metadata' | |
run: npx sf project deploy start --source-dir ./config/scratch-orgs/ | |
- name: 'Assign Logger Admin Permission Set' | |
run: npm run permset:assign:admin | |
- name: 'Validate Custom Metadata Records' | |
run: npx sf apex run --file ./scripts/build/validate-custom-metadata-records.apex | |
# Nebula Logger has functionality that queries the AuthSession object when the current user has an active session. | |
# The code should work with or without an active session, so the pipeline runs the tests twice - asynchronously and synchronously. | |
# This is done because, based on how you execute Apex tests, the running user may have an active session (synchrously) or not (asynchronously). | |
# Utlimately, this could/should probably be better mocked during tests, but the AuthSession is read-only in Apex, so it's a bit difficult to work with. | |
# Running the Apex tests sync & async serves as an extra level of integration testing to ensure that everything works with or without an active session. | |
- name: 'Run Apex Tests Asynchronously' | |
run: npm run test:apex:nocoverage | |
- name: 'Run Apex Tests Synchronously' | |
run: npm run test:apex -- --synchronous | |
# This is the only scratch org that's used for uploading code coverage | |
- name: 'Upload Apex test code coverage to Codecov.io' | |
uses: codecov/codecov-action@v4 | |
with: | |
fail_ci_if_error: true | |
flags: Apex | |
token: ${{ secrets.CODECOV_TOKEN }} | |
- name: 'Delete Scratch Org' | |
run: npx sf org delete scratch --no-prompt | |
if: ${{ always() }} | |
base-scratch-org-tests: | |
environment: 'Base Scratch Org' | |
name: 'Run Base Scratch Org Tests' | |
needs: [code-quality-tests] | |
runs-on: ubuntu-latest | |
steps: | |
- name: 'Checkout source code' | |
uses: actions/checkout@v4 | |
- name: 'Restore node_modules cache' | |
id: cache-npm | |
uses: actions/cache@v4 | |
with: | |
path: node_modules | |
key: npm-${{ hashFiles('**/package-lock.json') }} | |
restore-keys: | | |
npm-${{ env.cache-name }}- | |
npm- | |
- name: 'Install npm dependencies' | |
if: steps.cache-npm.outputs.cache-hit != 'true' | |
run: npm ci | |
- name: 'Authorize Dev Hub' | |
shell: bash | |
run: | | |
npx sf version | |
echo "${{ env.DEV_HUB_JWT_SERVER_KEY }}" > ./jwt-server.key | |
npx sf org login jwt --instance-url ${{ env.DEV_HUB_AUTH_URL }} --client-id ${{ env.DEV_HUB_CONSUMER_KEY }} --username ${{ env.DEV_HUB_BOT_USERNAME }} --jwt-key-file ./jwt-server.key --set-default-dev-hub | |
env: | |
DEV_HUB_AUTH_URL: ${{ secrets.DEV_HUB_AUTH_URL }} | |
DEV_HUB_BOT_USERNAME: ${{ secrets.DEV_HUB_BOT_USERNAME }} | |
DEV_HUB_CONSUMER_KEY: ${{ secrets.DEV_HUB_CONSUMER_KEY }} | |
DEV_HUB_JWT_SERVER_KEY: ${{ secrets.DEV_HUB_JWT_SERVER_KEY }} | |
- name: 'Create Scratch Org' | |
run: npx sf org create scratch --no-namespace --no-track-source --duration-days 1 --definition-file ./config/scratch-orgs/base-scratch-def.json --wait 20 --set-default --json | |
# To ensure that all of the Apex classes in the core directory have 75+ code coverage, | |
# deploy only the core directory & run all of its tests as part of the deployment, using `--test-level RunLocalTests` | |
- name: 'Validate Core Source in Scratch Org' | |
run: npx sf project deploy validate --source-dir ./nebula-logger/core/ --test-level RunLocalTests | |
# Now that the core directory has been deployed & tests have passed, deploy all of the metadata | |
- name: 'Deploy All Source to Scratch Org' | |
run: npx sf project deploy start --source-dir ./nebula-logger/ | |
- name: 'Assign Logger Admin Permission Set' | |
run: npm run permset:assign:admin | |
- name: 'Validate Custom Metadata Records' | |
run: npx sf apex run --file ./scripts/build/validate-custom-metadata-records.apex | |
# Nebula Logger has functionality that queries the AuthSession object when the current user has an active session. | |
# The code should work with or without an active session, so the pipeline runs the tests twice - asynchronously and synchronously. | |
# This is done because, based on how you execute Apex tests, the running user may have an active session (synchrously) or not (asynchronously). | |
# Utlimately, this could/should probably be better mocked during tests, but the AuthSession is read-only in Apex, so it's a bit difficult to work with. | |
# Running the Apex tests sync & async serves as an extra level of integration testing to ensure that everything works with or without an active session. | |
- name: 'Run Apex Tests Asynchronously' | |
run: npm run test:apex:nocoverage | |
- name: 'Run Apex Tests Synchronously' | |
run: npm run test:apex:nocoverage -- --synchronous | |
- name: 'Delete Scratch Org' | |
run: npx sf org delete scratch --no-prompt | |
if: ${{ always() }} | |
event-monitoring-scratch-org-tests: | |
environment: 'Event Monitoring Scratch Org' | |
name: 'Run Event Monitoring Scratch Org Tests' | |
needs: [code-quality-tests] | |
runs-on: ubuntu-latest | |
steps: | |
- name: 'Checkout source code' | |
uses: actions/checkout@v4 | |
- name: 'Restore node_modules cache' | |
id: cache-npm | |
uses: actions/cache@v4 | |
with: | |
path: node_modules | |
key: npm-${{ hashFiles('**/package-lock.json') }} | |
restore-keys: | | |
npm-${{ env.cache-name }}- | |
npm- | |
- name: 'Install npm dependencies' | |
if: steps.cache-npm.outputs.cache-hit != 'true' | |
run: npm ci | |
- name: 'Authorize Dev Hub' | |
shell: bash | |
run: | | |
npx sf version | |
echo "${{ env.DEV_HUB_JWT_SERVER_KEY }}" > ./jwt-server.key | |
npx sf org login jwt --instance-url ${{ env.DEV_HUB_AUTH_URL }} --client-id ${{ env.DEV_HUB_CONSUMER_KEY }} --username ${{ env.DEV_HUB_BOT_USERNAME }} --jwt-key-file ./jwt-server.key --set-default-dev-hub | |
env: | |
DEV_HUB_AUTH_URL: ${{ secrets.DEV_HUB_AUTH_URL }} | |
DEV_HUB_BOT_USERNAME: ${{ secrets.DEV_HUB_BOT_USERNAME }} | |
DEV_HUB_CONSUMER_KEY: ${{ secrets.DEV_HUB_CONSUMER_KEY }} | |
DEV_HUB_JWT_SERVER_KEY: ${{ secrets.DEV_HUB_JWT_SERVER_KEY }} | |
- name: 'Create Scratch Org' | |
run: npx sf org create scratch --no-namespace --no-track-source --duration-days 1 --definition-file ./config/scratch-orgs/event-monitoring-scratch-def.json --wait 20 --set-default --json | |
# To ensure that all of the Apex classes in the core directory have 75+ code coverage, | |
# deploy only the core directory & run all of its tests as part of the deployment, using `--test-level RunLocalTests` | |
- name: 'Validate Core Source in Scratch Org' | |
run: npx sf project deploy validate --source-dir ./nebula-logger/core/ --test-level RunLocalTests | |
# Now that the core directory has been deployed & tests have passed, deploy all of the metadata | |
- name: 'Deploy All Source to Scratch Org' | |
run: npx sf project deploy start --source-dir ./nebula-logger/ | |
- name: 'Assign Logger Admin Permission Set' | |
run: npm run permset:assign:admin | |
- name: 'Validate Custom Metadata Records' | |
run: npx sf apex run --file ./scripts/build/validate-custom-metadata-records.apex | |
# Nebula Logger has functionality that queries the AuthSession object when the current user has an active session. | |
# The code should work with or without an active session, so the pipeline runs the tests twice - asynchronously and synchronously. | |
# This is done because, based on how you execute Apex tests, the running user may have an active session (synchrously) or not (asynchronously). | |
# Utlimately, this could/should probably be better mocked during tests, but the AuthSession is read-only in Apex, so it's a bit difficult to work with. | |
# Running the Apex tests sync & async serves as an extra level of integration testing to ensure that everything works with or without an active session. | |
- name: 'Run Apex Tests Asynchronously' | |
run: npm run test:apex:nocoverage | |
- name: 'Run Apex Tests Synchronously' | |
run: npm run test:apex:nocoverage -- --synchronous | |
- name: 'Delete Scratch Org' | |
run: npx sf org delete scratch --no-prompt | |
if: ${{ always() }} | |
experience-cloud-scratch-org-tests: | |
environment: 'Experience Cloud Scratch Org' | |
name: 'Run Experience Cloud Scratch Org Tests' | |
needs: [code-quality-tests, advanced-scratch-org-tests] | |
runs-on: ubuntu-latest | |
steps: | |
- name: 'Checkout source code' | |
uses: actions/checkout@v4 | |
- name: 'Restore node_modules cache' | |
id: cache-npm | |
uses: actions/cache@v4 | |
with: | |
path: node_modules | |
key: npm-${{ hashFiles('**/package-lock.json') }} | |
restore-keys: | | |
npm-${{ env.cache-name }}- | |
npm- | |
- name: 'Install npm dependencies' | |
if: steps.cache-npm.outputs.cache-hit != 'true' | |
run: npm ci | |
- name: 'Authorize Dev Hub' | |
shell: bash | |
run: | | |
npx sf version | |
echo "${{ env.DEV_HUB_JWT_SERVER_KEY }}" > ./jwt-server.key | |
npx sf org login jwt --instance-url ${{ env.DEV_HUB_AUTH_URL }} --client-id ${{ env.DEV_HUB_CONSUMER_KEY }} --username ${{ env.DEV_HUB_BOT_USERNAME }} --jwt-key-file ./jwt-server.key --set-default-dev-hub | |
env: | |
DEV_HUB_AUTH_URL: ${{ secrets.DEV_HUB_AUTH_URL }} | |
DEV_HUB_BOT_USERNAME: ${{ secrets.DEV_HUB_BOT_USERNAME }} | |
DEV_HUB_CONSUMER_KEY: ${{ secrets.DEV_HUB_CONSUMER_KEY }} | |
DEV_HUB_JWT_SERVER_KEY: ${{ secrets.DEV_HUB_JWT_SERVER_KEY }} | |
- name: 'Create Scratch Org' | |
run: npx sf org create scratch --no-namespace --no-track-source --duration-days 1 --definition-file ./config/scratch-orgs/experience-cloud-scratch-def.json --wait 20 --set-default --json | |
# To ensure that all of the Apex classes in the core directory have 75+ code coverage, | |
# deploy only the core directory & run all of its tests as part of the deployment, using `--test-level RunLocalTests` | |
- name: 'Validate Core Source in Scratch Org' | |
run: npx sf project deploy validate --source-dir ./nebula-logger/core/ --test-level RunLocalTests | |
# Now that the core directory has been deployed & tests have passed, deploy all of the metadata | |
- name: 'Deploy All Source to Scratch Org' | |
run: npx sf project deploy start --source-dir ./nebula-logger/ | |
- name: 'Deploy Test Experience Sites Metadata' | |
run: npx sf project deploy start --source-dir ./config/scratch-orgs/experience-cloud/ | |
- name: 'Assign Logger Admin Permission Set' | |
run: npm run permset:assign:admin | |
- name: 'Validate Custom Metadata Records' | |
run: npx sf apex run --file ./scripts/build/validate-custom-metadata-records.apex | |
# Nebula Logger has functionality that queries the AuthSession object when the current user has an active session. | |
# The code should work with or without an active session, so the pipeline runs the tests twice - asynchronously and synchronously. | |
# This is done because, based on how you execute Apex tests, the running user may have an active session (synchrously) or not (asynchronously). | |
# Utlimately, this could/should probably be better mocked during tests, but the AuthSession is read-only in Apex, so it's a bit difficult to work with. | |
# Running the Apex tests sync & async serves as an extra level of integration testing to ensure that everything works with or without an active session. | |
- name: 'Run Apex Tests Asynchronously' | |
run: npm run test:apex:nocoverage | |
- name: 'Run Apex Tests Synchronously' | |
run: npm run test:apex:nocoverage -- --synchronous | |
- name: 'Delete Scratch Org' | |
run: npx sf org delete scratch --no-prompt | |
if: ${{ always() }} | |
omnistudio-scratch-org-tests: | |
environment: 'OmniStudio Scratch Org' | |
name: 'Run OmniStudio Scratch Org Tests' | |
needs: [code-quality-tests, base-scratch-org-tests] | |
runs-on: ubuntu-latest | |
steps: | |
- name: 'Checkout source code' | |
uses: actions/checkout@v4 | |
- name: 'Restore node_modules cache' | |
id: cache-npm | |
uses: actions/cache@v4 | |
with: | |
path: node_modules | |
key: npm-${{ hashFiles('**/package-lock.json') }} | |
restore-keys: | | |
npm-${{ env.cache-name }}- | |
npm- | |
- name: 'Install npm dependencies' | |
if: steps.cache-npm.outputs.cache-hit != 'true' | |
run: npm ci | |
- name: 'Authorize Dev Hub' | |
shell: bash | |
run: | | |
npx sf version | |
echo "${{ env.DEV_HUB_JWT_SERVER_KEY }}" > ./jwt-server.key | |
npx sf org login jwt --instance-url ${{ env.DEV_HUB_AUTH_URL }} --client-id ${{ env.DEV_HUB_CONSUMER_KEY }} --username ${{ env.DEV_HUB_BOT_USERNAME }} --jwt-key-file ./jwt-server.key --set-default-dev-hub | |
env: | |
DEV_HUB_AUTH_URL: ${{ secrets.DEV_HUB_AUTH_URL }} | |
DEV_HUB_BOT_USERNAME: ${{ secrets.DEV_HUB_BOT_USERNAME }} | |
DEV_HUB_CONSUMER_KEY: ${{ secrets.DEV_HUB_CONSUMER_KEY }} | |
DEV_HUB_JWT_SERVER_KEY: ${{ secrets.DEV_HUB_JWT_SERVER_KEY }} | |
- name: 'Create Scratch Org' | |
run: npx sf org create scratch --no-namespace --no-track-source --duration-days 1 --definition-file ./config/scratch-orgs/omnistudio-scratch-def.json --wait 20 --set-default --json | |
# https://help.salesforce.com/s/articleView?id=000394906&type=1 | |
- name: 'Install OmniStudio managed package v250.7.1 (Summer ‘24 release)' | |
run: npx sf package install --package 04t4W000002Z6oC --security-type AdminsOnly --wait 30 --no-prompt | |
# To ensure that all of the Apex classes in the core directory have 75+ code coverage, | |
# deploy only the core directory & run all of its tests as part of the deployment, using `--test-level RunLocalTests` | |
- name: 'Validate Core Source in Scratch Org' | |
run: npx sf project deploy validate --source-dir ./nebula-logger/core/ --test-level RunLocalTests | |
# Now that the core directory has been deployed & tests have passed, deploy all of the metadata | |
- name: 'Deploy All Source to Scratch Org' | |
run: npx sf project deploy start --source-dir ./nebula-logger/ | |
- name: 'Deploy Test OmniStudio Metadata' | |
run: npx sf project deploy start --source-dir ./config/scratch-orgs/omnistudio/ | |
- name: 'Assign Logger Admin Permission Set' | |
run: npm run permset:assign:admin | |
- name: 'Validate Custom Metadata Records' | |
run: npx sf apex run --file ./scripts/build/validate-custom-metadata-records.apex | |
# Nebula Logger has functionality that queries the AuthSession object when the current user has an active session. | |
# The code should work with or without an active session, so the pipeline runs the tests twice - asynchronously and synchronously. | |
# This is done because, based on how you execute Apex tests, the running user may have an active session (synchrously) or not (asynchronously). | |
# Utlimately, this could/should probably be better mocked during tests, but the AuthSession is read-only in Apex, so it's a bit difficult to work with. | |
# Running the Apex tests sync & async serves as an extra level of integration testing to ensure that everything works with or without an active session. | |
- name: 'Run Apex Tests Asynchronously' | |
run: npm run test:apex:nocoverage | |
- name: 'Run Apex Tests Synchronously' | |
run: npm run test:apex:nocoverage -- --synchronous | |
- name: 'Delete Base Scratch Org' | |
run: npx sf org delete scratch --no-prompt | |
if: ${{ always() }} | |
platform-cache-scratch-org-tests: | |
environment: 'Platform Cache Scratch Org' | |
name: 'Run Platform Cache Scratch Org Tests' | |
needs: [code-quality-tests, event-monitoring-scratch-org-tests] | |
runs-on: ubuntu-latest | |
steps: | |
- name: 'Checkout source code' | |
uses: actions/checkout@v4 | |
- name: 'Restore node_modules cache' | |
id: cache-npm | |
uses: actions/cache@v4 | |
with: | |
path: node_modules | |
key: npm-${{ hashFiles('**/package-lock.json') }} | |
restore-keys: | | |
npm-${{ env.cache-name }}- | |
npm- | |
- name: 'Install npm dependencies' | |
if: steps.cache-npm.outputs.cache-hit != 'true' | |
run: npm ci | |
- name: 'Authorize Dev Hub' | |
shell: bash | |
run: | | |
npx sf version | |
echo "${{ env.DEV_HUB_JWT_SERVER_KEY }}" > ./jwt-server.key | |
npx sf org login jwt --instance-url ${{ env.DEV_HUB_AUTH_URL }} --client-id ${{ env.DEV_HUB_CONSUMER_KEY }} --username ${{ env.DEV_HUB_BOT_USERNAME }} --jwt-key-file ./jwt-server.key --set-default-dev-hub | |
env: | |
DEV_HUB_AUTH_URL: ${{ secrets.DEV_HUB_AUTH_URL }} | |
DEV_HUB_BOT_USERNAME: ${{ secrets.DEV_HUB_BOT_USERNAME }} | |
DEV_HUB_CONSUMER_KEY: ${{ secrets.DEV_HUB_CONSUMER_KEY }} | |
DEV_HUB_JWT_SERVER_KEY: ${{ secrets.DEV_HUB_JWT_SERVER_KEY }} | |
- name: 'Create Scratch Org' | |
run: npx sf org create scratch --no-namespace --no-track-source --duration-days 1 --definition-file ./config/scratch-orgs/platform-cache-scratch-def.json --wait 20 --set-default --json | |
# To ensure that all of the Apex classes in the core directory have 75+ code coverage, | |
# deploy only the core directory & run all of its tests as part of the deployment, using `--test-level RunLocalTests` | |
- name: 'Validate Core Source in Scratch Org' | |
run: npx sf project deploy validate --source-dir ./nebula-logger/core/ --test-level RunLocalTests | |
# Now that the core directory has been deployed & tests have passed, deploy all of the metadata | |
- name: 'Deploy All Source to Scratch Org' | |
run: npx sf project deploy start --source-dir ./nebula-logger/ | |
- name: 'Assign Logger Admin Permission Set' | |
run: npm run permset:assign:admin | |
- name: 'Validate Custom Metadata Records' | |
run: npx sf apex run --file ./scripts/build/validate-custom-metadata-records.apex | |
# Nebula Logger has functionality that queries the AuthSession object when the current user has an active session. | |
# The code should work with or without an active session, so the pipeline runs the tests twice - asynchronously and synchronously. | |
# This is done because, based on how you execute Apex tests, the running user may have an active session (synchrously) or not (asynchronously). | |
# Utlimately, this could/should probably be better mocked during tests, but the AuthSession is read-only in Apex, so it's a bit difficult to work with. | |
# Running the Apex tests sync & async serves as an extra level of integration testing to ensure that everything works with or without an active session. | |
- name: 'Run Apex Tests Asynchronously' | |
run: npm run test:apex:nocoverage | |
- name: 'Run Apex Tests Synchronously' | |
run: npm run test:apex:nocoverage -- --synchronous | |
- name: 'Delete Scratch Org' | |
run: npx sf org delete scratch --no-prompt | |
if: ${{ always() }} | |
create-managed-package-beta: | |
name: 'Create Managed Package Beta' | |
needs: | |
[ | |
code-quality-tests, | |
lwc-jest-tests, | |
advanced-scratch-org-tests, | |
base-scratch-org-tests, | |
event-monitoring-scratch-org-tests, | |
experience-cloud-scratch-org-tests, | |
omnistudio-scratch-org-tests, | |
platform-cache-scratch-org-tests | |
] | |
if: ${{ github.ref != 'refs/heads/main' }} | |
runs-on: ubuntu-latest | |
environment: 'Demo Org' | |
steps: | |
- name: 'Checkout source code' | |
uses: actions/checkout@v4 | |
with: | |
ref: ${{ github.event.pull_request.head.ref }} | |
- name: 'Restore node_modules cache' | |
id: cache-npm | |
uses: actions/cache@v4 | |
with: | |
path: node_modules | |
key: npm-${{ hashFiles('**/package-lock.json') }} | |
restore-keys: | | |
npm-${{ env.cache-name }}- | |
npm- | |
- name: 'Install npm dependencies' | |
if: steps.cache-npm.outputs.cache-hit != 'true' | |
run: npm ci | |
- name: 'Authorize Dev Hub' | |
shell: bash | |
run: | | |
npx sf version | |
echo "${{ env.DEV_HUB_JWT_SERVER_KEY }}" > ./jwt-server.key | |
npx sf org login jwt --instance-url ${{ env.DEV_HUB_AUTH_URL }} --client-id ${{ env.DEV_HUB_CONSUMER_KEY }} --username ${{ env.DEV_HUB_BOT_USERNAME }} --jwt-key-file ./jwt-server.key --set-default-dev-hub | |
env: | |
DEV_HUB_AUTH_URL: ${{ secrets.DEV_HUB_AUTH_URL }} | |
DEV_HUB_BOT_USERNAME: ${{ secrets.DEV_HUB_BOT_USERNAME }} | |
DEV_HUB_CONSUMER_KEY: ${{ secrets.DEV_HUB_CONSUMER_KEY }} | |
DEV_HUB_JWT_SERVER_KEY: ${{ secrets.DEV_HUB_JWT_SERVER_KEY }} | |
- name: 'Create Beta Managed Package Version' | |
run: npm run package:version:create:managed | |
create-unlocked-package-release-candidate: | |
name: 'Create Core Package Release Candidate' | |
needs: [create-managed-package-beta] | |
if: ${{ github.ref != 'refs/heads/main' }} | |
runs-on: ubuntu-latest | |
environment: 'Demo Org' | |
steps: | |
- name: 'Checkout source code' | |
uses: actions/checkout@v4 | |
with: | |
ref: ${{ github.event.pull_request.head.ref }} | |
- name: 'Restore node_modules cache' | |
id: cache-npm | |
uses: actions/cache@v4 | |
with: | |
path: node_modules | |
key: npm-${{ hashFiles('**/package-lock.json') }} | |
restore-keys: | | |
npm-${{ env.cache-name }}- | |
npm- | |
- name: 'Install npm dependencies' | |
if: steps.cache-npm.outputs.cache-hit != 'true' | |
run: npm ci | |
- name: 'Authorize Dev Hub' | |
shell: bash | |
run: | | |
npx sf version | |
echo "${{ env.DEV_HUB_JWT_SERVER_KEY }}" > ./jwt-server.key | |
npx sf org login jwt --instance-url ${{ env.DEV_HUB_AUTH_URL }} --client-id ${{ env.DEV_HUB_CONSUMER_KEY }} --username ${{ env.DEV_HUB_BOT_USERNAME }} --jwt-key-file ./jwt-server.key --set-default-dev-hub | |
env: | |
DEV_HUB_AUTH_URL: ${{ secrets.DEV_HUB_AUTH_URL }} | |
DEV_HUB_BOT_USERNAME: ${{ secrets.DEV_HUB_BOT_USERNAME }} | |
DEV_HUB_CONSUMER_KEY: ${{ secrets.DEV_HUB_CONSUMER_KEY }} | |
DEV_HUB_JWT_SERVER_KEY: ${{ secrets.DEV_HUB_JWT_SERVER_KEY }} | |
- name: 'Authorize Demo Org' | |
shell: bash | |
run: | | |
echo ${{ env.PKG_DEMO_ORG_SFDX_URL }} > ./PKG_DEMO_ORG_SFDX_URL.txt | |
npx sf org login sfdx-url --sfdx-url-file ./PKG_DEMO_ORG_SFDX_URL.txt --alias nebula-logger-package-demo | |
env: | |
PKG_DEMO_ORG_SFDX_URL: ${{ secrets.NEBULA_PKG_DEMO_SANDBOX_SFDX_URL }} | |
- name: 'Create & Install Package Version' | |
run: npx pwsh ./scripts/build/create-and-install-package-version.ps1 -targetpackagealias '"Nebula Logger - Core"' -targetreadme ./README.md -targetusername nebula-logger-package-demo | |
# Nebula Logger has functionality that queries the AuthSession object when the current user has an active session. | |
# The code should work with or without an active session, so the pipeline runs the tests twice - asynchronously and synchronously. | |
# This is done because, based on how you execute Apex tests, the running user may have an active session (synchrously) or not (asynchronously). | |
# Utlimately, this could/should probably be better mocked during tests, but the AuthSession is read-only in Apex, so it's a bit difficult to work with. | |
# Running the Apex tests sync & async serves as an extra level of integration testing in the meantime to ensure that everything works with or without an active session. | |
- name: 'Run Apex Tests Asynchronously' | |
run: npm run test:apex:nocoverage -- --targetusername nebula-logger-package-demo | |
- name: 'Run Apex Tests Synchronously' | |
run: npm run test:apex:nocoverage -- --targetusername nebula-logger-package-demo --synchronous | |
- name: 'Commit New Package Version' | |
if: ${{ github.event_name == 'pull_request' }} | |
run: | | |
git config --local user.email "[email protected]" | |
git config --local user.name "GitHub Action Bot" | |
# npm run sf:plugins:link:bummer | |
echo y | npx sf plugins install @jongpie/sfdx-bummer-plugin --force | |
npx sf bummer:package:aliases:sort | |
npx prettier --write ./sfdx-project.json | |
git add ./sfdx-project.json | |
git commit -m "Created new core unlocked package version" | |
git push | |
promote-package-versions: | |
name: 'Promote Package Versions' | |
needs: | |
[ | |
code-quality-tests, | |
lwc-jest-tests, | |
advanced-scratch-org-tests, | |
base-scratch-org-tests, | |
event-monitoring-scratch-org-tests, | |
experience-cloud-scratch-org-tests, | |
omnistudio-scratch-org-tests, | |
platform-cache-scratch-org-tests | |
] | |
if: ${{ github.ref == 'refs/heads/main' }} | |
runs-on: ubuntu-latest | |
steps: | |
- name: 'Checkout source code' | |
uses: actions/checkout@v4 | |
- name: 'Restore node_modules cache' | |
id: cache-npm | |
uses: actions/cache@v4 | |
with: | |
path: node_modules | |
key: npm-${{ hashFiles('**/package-lock.json') }} | |
restore-keys: | | |
npm-${{ env.cache-name }}- | |
npm- | |
- name: 'Install npm dependencies' | |
if: steps.cache-npm.outputs.cache-hit != 'true' | |
run: npm ci | |
- name: 'Authorize Dev Hub' | |
shell: bash | |
run: | | |
npx sf version | |
echo "${{ env.DEV_HUB_JWT_SERVER_KEY }}" > ./jwt-server.key | |
npx sf org login jwt --instance-url ${{ env.DEV_HUB_AUTH_URL }} --client-id ${{ env.DEV_HUB_CONSUMER_KEY }} --username ${{ env.DEV_HUB_BOT_USERNAME }} --jwt-key-file ./jwt-server.key --set-default-dev-hub | |
env: | |
DEV_HUB_AUTH_URL: ${{ secrets.DEV_HUB_AUTH_URL }} | |
DEV_HUB_BOT_USERNAME: ${{ secrets.DEV_HUB_BOT_USERNAME }} | |
DEV_HUB_CONSUMER_KEY: ${{ secrets.DEV_HUB_CONSUMER_KEY }} | |
DEV_HUB_JWT_SERVER_KEY: ${{ secrets.DEV_HUB_JWT_SERVER_KEY }} | |
- name: 'Promote package versions' | |
run: npx pwsh ./scripts/build/promote-readme-packages.ps1 |