-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test: link plugin to sf cli before running nut
- Loading branch information
Matt Carvin
committed
Oct 8, 2024
1 parent
d070cc3
commit 43225fc
Showing
3 changed files
with
23 additions
and
115 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 |
---|---|---|
@@ -1,126 +1,34 @@ | ||
on: | ||
workflow_call: | ||
secrets: | ||
SF_CHANGE_CASE_SFDX_AUTH_URL: | ||
description: 'SFDX_AUTH_URL for the CTC org. Only useful for the CTC NUTs.' | ||
required: false | ||
SF_CHANGE_CASE_TEMPLATE_ID: | ||
required: false | ||
description: 'Template ID for the CTC org. Only useful for the CTC NUTs.' | ||
SF_CHANGE_CASE_CONFIGURATION_ITEM: | ||
required: false | ||
description: 'Configuration Item for the CTC org. Only useful for the CTC NUTs.' | ||
ONEGP_TESTKIT_AUTH_URL: | ||
description: 'SFDX_AUTH_URL for the 1GP org. Only useful for the 1GP NUTs in packaging' | ||
required: false | ||
TESTKIT_AUTH_URL: | ||
required: false | ||
TESTKIT_HUB_USERNAME: | ||
required: false | ||
TESTKIT_JWT_CLIENT_ID: | ||
required: false | ||
TESTKIT_JWT_KEY: | ||
required: false | ||
TESTKIT_HUB_INSTANCE: | ||
required: false | ||
|
||
inputs: | ||
command: | ||
required: false | ||
type: string | ||
default: yarn test:nuts | ||
description: 'command to execute (ex: yarn test:nuts)' | ||
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' | ||
sfdxExecutablePath: | ||
required: false | ||
description: "Path to sfdx executable to be used by NUTs, defaults to ''" | ||
type: string | ||
useCache: | ||
required: false | ||
type: boolean | ||
default: true | ||
retries: | ||
required: false | ||
type: number | ||
default: 3 | ||
description: 'Number of times to attempt NUTs' | ||
|
||
jobs: | ||
nut: | ||
name: ${{ inputs.command }} | ||
runs-on: ${{ inputs.os }} | ||
steps: | ||
- name: Configure git longpaths if on Windows | ||
if: ${{ runner.os == 'Windows' }} | ||
run: git config --system core.longpaths true | ||
|
||
- uses: actions/checkout@v4 | ||
|
||
- uses: google/wireit@setup-github-actions-caching/v1 | ||
- name: Checkout | ||
uses: actions/checkout@v4.1.1 | ||
|
||
- uses: actions/setup-node@v4 | ||
- name: Setup Node | ||
uses: actions/setup-node@v4.0.1 | ||
with: | ||
node-version: ${{ inputs.nodeVersion }} | ||
node-version: 18 | ||
cache: yarn | ||
registry-url: 'https://registry.npmjs.org' | ||
|
||
- name: Cache node modules | ||
id: cache-nodemodules | ||
uses: actions/cache@v4 | ||
env: | ||
cache-name: cache-node-modules | ||
with: | ||
path: '**/node_modules' | ||
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/yarn.lock') }} | ||
- name: Install Dependencies | ||
run: yarn install | ||
|
||
- name: add CLI as global dependency | ||
uses: salesforcecli/github-workflows/.github/actions/retry@main | ||
with: | ||
max_attempts: ${{ inputs.retries }} | ||
command: npm install @salesforce/cli@nightly -g | ||
- name: Build | ||
run: yarn build | ||
|
||
- uses: salesforcecli/github-workflows/.github/actions/yarnInstallWithRetries@main | ||
if: ${{ steps.cache-nodemodules.outputs.cache-hit != 'true' }} | ||
- name: Install salesforce CLI | ||
run: npm install -g @salesforce/cli | ||
|
||
- run: yarn compile | ||
- name: Install plugin | ||
run: | | ||
sf plugins:link . | ||
sf plugins | ||
- name: Check that oclif config exists | ||
id: is-oclif-plugin | ||
run: echo "bool=$(jq 'if .oclif then true else false end' package.json)" >> "$GITHUB_OUTPUT" | ||
|
||
- run: yarn oclif manifest | ||
if: ${{ steps.is-oclif-plugin.outputs.bool == 'true' }} | ||
|
||
- name: Set optional sf executable path | ||
if: inputs.sfdxExecutablePath | ||
run: echo "TESTKIT_EXECUTABLE_PATH=$INPUTS_SF_EXECUTABLE_PATH" >> $GITHUB_ENV | ||
env: | ||
INPUTS_SF_EXECUTABLE_PATH: ${{ inputs.sfdxExecutablePath }} | ||
|
||
- name: NUTs with ${{ inputs.retries }} attempts | ||
uses: salesforcecli/github-workflows/.github/actions/retry@main | ||
with: | ||
max_attempts: ${{ inputs.retries }} | ||
command: ${{ inputs.command }} | ||
retry_on: error | ||
env: | ||
TESTKIT_AUTH_URL: ${{ secrets.TESTKIT_AUTH_URL}} | ||
TESTKIT_HUB_USERNAME: ${{ secrets.TESTKIT_HUB_USERNAME }} | ||
TESTKIT_JWT_CLIENT_ID: ${{ secrets.TESTKIT_JWT_CLIENT_ID }} | ||
TESTKIT_JWT_KEY: ${{ secrets.TESTKIT_JWT_KEY }} | ||
TESTKIT_HUB_INSTANCE: ${{ secrets.TESTKIT_HUB_INSTANCE }} | ||
ONEGP_TESTKIT_AUTH_URL: ${{ secrets.ONEGP_TESTKIT_AUTH_URL }} | ||
SF_CHANGE_CASE_SFDX_AUTH_URL: ${{ secrets.SF_CHANGE_CASE_SFDX_AUTH_URL }} | ||
SF_CHANGE_CASE_TEMPLATE_ID: ${{ secrets.SF_CHANGE_CASE_TEMPLATE_ID}} | ||
SF_CHANGE_CASE_CONFIGURATION_ITEM: ${{ secrets.SF_CHANGE_CASE_CONFIGURATION_ITEM}} | ||
TESTKIT_SETUP_RETRIES: 2 | ||
SF_DISABLE_TELEMETRY: true | ||
DEBUG: ${{ vars.DEBUG }} | ||
- name: Run NUT | ||
run: yarn test:nuts |
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