-
Notifications
You must be signed in to change notification settings - Fork 67
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1070 from forcedotcom/cristi/w-15634761
chore: automated tests for bundled core in apex-node and templates
- Loading branch information
Showing
6 changed files
with
564 additions
and
409 deletions.
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,41 @@ | ||
name: Bundle | ||
on: | ||
workflow_call: | ||
inputs: | ||
branch: | ||
description: 'Set the branch to bundle core' | ||
required: false | ||
type: string | ||
nodeVersion: | ||
description: version of node to use. It's better to specify latest, lts/* or lts/-1 than to hardode numbers | ||
type: string | ||
default: lts/* | ||
required: false | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
ref: ${{ inputs.branch }} | ||
- uses: actions/setup-node@v4 | ||
with: | ||
node-version: ${{ inputs.nodeVersion }} | ||
registry-url: 'https://registry.npmjs.org' | ||
cache: yarn | ||
- uses: salesforcecli/github-workflows/.github/actions/yarnInstallWithRetries@main | ||
- name: Install esbuild Dependencies | ||
run: | | ||
yarn add -D esbuild@^0.19.5 esbuild-plugin-pino@^2.1.0 npm-dts@^1.3.12 esbuild-plugin-tsc@^0.4.0 | ||
- uses: salesforcecli/github-workflows/.github/actions/yarnInstallWithRetries@main | ||
- name: Update for Bundling | ||
run: | | ||
node scripts/updateForBundling.js | ||
- name: Generate Bundle | ||
run: | | ||
yarn build | ||
node scripts/build.js | ||
- name: Post Bundling Update | ||
run: | | ||
node scripts/postBundlingUpdate.js |
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
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,38 @@ | ||
name: Test Core Bundling | ||
on: | ||
push: | ||
branches-ignore: [main] | ||
workflow_dispatch: | ||
inputs: | ||
branch: | ||
description: 'Set the branch to bundle core' | ||
type: string | ||
required: false | ||
default: main | ||
nodeVersion: | ||
description: version of node to use. It's better to specify latest, lts/* or lts/-1 than to hardode numbers | ||
type: string | ||
required: false | ||
default: lts/* | ||
|
||
jobs: | ||
bundle: | ||
uses: ./.github/workflows/bundle.yml | ||
with: | ||
branch: ${{ github.ref_name || inputs.branch }} | ||
nodeVersion: ${{ inputs.nodeVersion }} | ||
tests: | ||
needs: bundle | ||
uses: ./.github/workflows/testExternalProjects.yml | ||
secrets: inherit | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
os: ['ubuntu-latest', 'windows-latest'] | ||
externalProjectGit: | ||
- forcedotcom/salesforcedx-templates | ||
- forcedotcom/salesforcedx-apex | ||
with: | ||
externalProjectGit: ${{ matrix.externalProjectGit }} | ||
os: ${{ matrix.os }} | ||
bundledBranch: ${{ github.ref_name || inputs.branch }} |
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,88 @@ | ||
name: Test External Projects | ||
on: | ||
workflow_call: | ||
inputs: | ||
externalProjectGit: | ||
description: 'The url that will be cloned. This contains the tests you want to run. Ex: https://github.com/forcedotcom/templates' | ||
type: string | ||
required: true | ||
nodeVersion: | ||
required: false | ||
description: version of node to run tests against. Use things like [lts/-1, lts/*, latest] to avoid hardcoding versions | ||
type: string | ||
default: lts/* | ||
os: | ||
required: false | ||
description: 'runs-on property, ex: ubuntu-latest, windows-latest' | ||
type: string | ||
default: 'ubuntu-latest' | ||
attempts: | ||
required: false | ||
type: number | ||
default: 3 | ||
bundledBranch: | ||
required: false | ||
description: Branch with the bundled version of core" | ||
type: string | ||
default: 'main' | ||
|
||
jobs: | ||
external-test: | ||
name: run tests | ||
if: ${{ inputs.externalProjectGit == 'forcedotcom/salesforcedx-apex' || (inputs.externalProjectGit == 'forcedotcom/salesforcedx-templates' && inputs.os == 'ubuntu-latest') }} | ||
runs-on: ${{ inputs.os }} | ||
steps: | ||
- name: Configure Git to handle long file paths on Windows | ||
if: ${{ runner.os == 'Windows' }} | ||
run: git config --system core.longpaths true | ||
- name: Setup node | ||
uses: actions/setup-node@v4 | ||
with: | ||
node-version: ${{ inputs.nodeVersion }} | ||
- name: Checkout to external project | ||
uses: actions/checkout@v4 | ||
with: | ||
repository: ${{ inputs.externalProjectGit }} | ||
- name: Swap this dependency for the bundled version | ||
run: | | ||
yarn install --network-timeout 600000 | ||
yarn remove @salesforce/core | ||
yarn add forcedotcom/sfdx-core#${{ inputs.bundledBranch }} | ||
- name: Add dependencies to bundle node_modules | ||
run: | | ||
yarn install --network-timeout 600000 | ||
yarn add -D esbuild@^0.19.5 esbuild-plugin-pino@^2.1.0 npm-dts@^1.3.12 esbuild-plugin-tsc@^0.4.0 | ||
working-directory: node_modules/@salesforce/core | ||
- name: Update for bundling | ||
run: node scripts/updateForBundling.js | ||
working-directory: node_modules/@salesforce/core | ||
- name: Generate Bundle | ||
run: | | ||
yarn build | ||
node scripts/build.js | ||
working-directory: node_modules/@salesforce/core | ||
- name: Post Bundling Update | ||
run: | | ||
node scripts/postBundlingUpdate.js | ||
working-directory: node_modules/@salesforce/core | ||
- name: Yarn deduplicate | ||
run: | | ||
npx yarn-deduplicate | ||
- name: Retrieve Scripts | ||
run: | | ||
git clone https://github.com/forcedotcom/bundle-publish-scripts.git | ||
- name: Update references for core bundle | ||
run: | | ||
node bundle-publish-scripts/scripts/updateForCoreBundle.js | ||
- name: Update folder name | ||
run: | | ||
mv core core-bundle | ||
working-directory: node_modules/@salesforce | ||
- name: Build the external project (where the tests are) | ||
run: yarn build | ||
- name: Run tests with ${{ inputs.attempts }} attempts | ||
uses: salesforcecli/github-workflows/.github/actions/retry@main | ||
with: | ||
max_attempts: ${{ inputs.attempts }} | ||
command: yarn test | ||
retry_on: error |
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
Oops, something went wrong.