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

Install jit plugins before NUTs #1145

Merged
merged 11 commits into from
Sep 18, 2023
26 changes: 25 additions & 1 deletion .github/workflows/just-nut.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,11 @@ on:
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:
Expand All @@ -40,12 +45,18 @@ on:
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}}
Expand All @@ -59,7 +70,7 @@ jobs:
steps:
- uses: actions/checkout@v3
with:
repository: ${{inputs.repository}}
repository: ${{ inputs.repository }}
token: ${{ secrets.SVC_CLI_BOT_GITHUB_TOKEN }}
path: .
- uses: actions/setup-node@v3
Expand All @@ -74,6 +85,19 @@ jobs:
command: npm install -g @salesforce/cli@${{ inputs.channel-or-version }} --omit=dev
timeout_minutes: 60
- uses: salesforcecli/github-workflows/.github/actions/yarnInstallWithRetries@main
# 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
- name: Set SF_DATA_DIR for JIT
if: ${{ inputs.jit }}
run: echo "SF_DATA_DIR=${{ runner.temp }}/sf-data-dir" >> "$GITHUB_ENV"
- name: Install JIT plugin
if: ${{ inputs.jit }}
# The --jit flag ensures we get the JIT plugin version set in the sf package.json
run: |
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
cat "${{ env.SF_DATA_DIR }}/package.json"
- name: Run NUT (with retries)
uses: nick-fields/retry@943e742917ac94714d2f408a0e8320f2d1fcafcd
with:
Expand Down
30 changes: 25 additions & 5 deletions .github/workflows/just-nuts.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,16 +24,11 @@ jobs:
os: [ubuntu-latest, windows-latest]
repository:
- salesforcecli/plugin-auth
- salesforcecli/plugin-community
- salesforcecli/plugin-custom-metadata
- salesforcecli/plugin-data
- salesforcecli/plugin-dev
- salesforcecli/plugin-env
- salesforcecli/plugin-limits
- salesforcecli/plugin-org
- salesforcecli/plugin-schema
- salesforcecli/plugin-settings
- salesforcecli/plugin-signups
- salesforcecli/plugin-sobject
- salesforcecli/plugin-templates
- salesforcecli/plugin-user
Expand All @@ -44,6 +39,30 @@ jobs:
os: ${{matrix.os}}
secrets: inherit

jit:
strategy:
fail-fast: false
max-parallel: 6
matrix:
os: [ubuntu-latest, windows-latest]
repository:
- salesforcecli/plugin-custom-metadata
- salesforcecli/plugin-community
- salesforcecli/plugin-dev
- salesforcecli/plugin-signups
# - salesforce/plugin-devops-center
# - salesforcecli/plugin-env
# - salesforce/plugin-functions
# - salesforce/sfdx-plugin-lwc-test
# - salesforce/sfdx-scanner
uses: ./.github/workflows/just-nut.yml
with:
repository: ${{matrix.repository}}
channel-or-version: ${{ inputs.channel-or-version }}
os: ${{matrix.os}}
jit: true
secrets: inherit

packaging:
strategy:
fail-fast: false
Expand All @@ -58,6 +77,7 @@ jobs:
channel-or-version: ${{ inputs.channel-or-version }}
os: ${{matrix.os}}
command: ${{matrix.command}}
jit: true
secrets: inherit

source:
Expand Down