just-nut #9
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
name: just-nut | |
on: | |
workflow_dispatch: | |
inputs: | |
channel-or-version: | |
description: Version or channel of the CLI to test against (nightly, latest-rc, 2.1.1) | |
type: string | |
required: true | |
repository: | |
description: 'The repo that will be cloned (format: owner/repo). This contains the NUTs you want to run. Ex: salesforcecli/plugin-user' | |
type: string | |
required: true | |
command: | |
required: false | |
type: string | |
default: yarn test:nuts | |
description: 'command to execute (ex: yarn test:nuts)' | |
os: | |
required: false | |
description: 'runs-on property, ex: ubuntu-latest, windows-latest' | |
type: string | |
default: 'ubuntu-latest' | |
jit: | |
required: false | |
description: 'install JIT plugin before running tests' | |
type: boolean | |
default: false | |
workflow_call: | |
inputs: | |
channel-or-version: | |
description: Version or channel of the CLI to test against (nightly, latest-rc, 2.1.1) | |
type: string | |
required: true | |
repository: | |
description: 'The repo that will be cloned (format: owner/repo). This contains the NUTs you want to run. Ex: salesforcecli/plugin-user' | |
type: string | |
required: true | |
command: | |
required: false | |
type: string | |
default: yarn test:nuts | |
description: 'command to execute (ex: yarn test:nuts)' | |
os: | |
required: false | |
description: 'runs-on property, ex: ubuntu-latest, windows-latest' | |
type: string | |
default: 'ubuntu-latest' | |
jit: | |
required: false | |
description: 'install JIT plugin before running tests' | |
type: boolean | |
default: false | |
jobs: | |
just-nut: | |
name: ${{inputs.repository}} | |
runs-on: ${{inputs.os}} | |
env: | |
GITHUB_TOKEN: ${{ secrets.SVC_CLI_BOT_GITHUB_TOKEN }} | |
TESTKIT_EXECUTABLE_PATH: sf | |
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 }} | |
TESTKIT_SETUP_RETRIES: 2 | |
SF_DISABLE_TELEMETRY: true | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
repository: ${{ inputs.repository }} | |
token: ${{ secrets.SVC_CLI_BOT_GITHUB_TOKEN }} | |
path: . | |
- uses: actions/setup-node@v3 | |
with: | |
node-version: lts/* | |
# cache: yarn | |
- name: Install CLI | |
uses: nick-fields/retry@943e742917ac94714d2f408a0e8320f2d1fcafcd | |
with: | |
max_attempts: 3 | |
retry_wait_seconds: 60 | |
command: npm install -g @salesforce/cli@${{ inputs.channel-or-version }} --omit=dev | |
timeout_minutes: 60 | |
- uses: salesforcecli/github-workflows/.github/actions/yarnInstallWithRetries@main | |
- name: Install JIT plugin | |
if: ${{ inputs.jit }} | |
# We set SF_DATA_DIR to ensure JIT plugins are only installed once | |
# Otherwise each TestSession reinstalls the JIT plugin in its custom HOME dir | |
# The --jit flag ensures we get the JIT plugin version set in the sf package.json | |
run: | | |
echo "SF_DATA_DIR=${{ runner.temp }}/sf-data-dir" >> "$GITHUB_ENV" | |
RAW_URL=$(gh browse package.json --repo "${{ inputs.repository }}" --no-browser | sed 's/github.com/raw.githubusercontent.com/' | sed 's/tree\/main/main/') | |
NPM_NAME=$(curl --silent "$RAW_URL" | jq -r '.name') | |
sf plugins install "$NPM_NAME" --jit | |
- name: Log SF_DATA_DIR | |
run: | | |
echo "SF_DATA_DIR=${{ env.SF_DATA_DIR }}" | |
ls -la "${{ env.SF_DATA_DIR }}" | |
cat "${{ env.SF_DATA_DIR }}/package.json" | |
- name: Run NUT (with retries) | |
uses: nick-fields/retry@943e742917ac94714d2f408a0e8320f2d1fcafcd | |
with: | |
max_attempts: 3 | |
retry_wait_seconds: 1 | |
command: ${{ inputs.command }} | |
retry_on: error | |
timeout_minutes: 60 |