Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
68 changes: 51 additions & 17 deletions .github/workflows/nut.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,41 @@ on:
type: number
default: 3
description: "Number of times to attempt NUTs"
package-manager:
type: string
required: false
default: yarn
description: "Package manager to use: npm, pnpm, or yarn"
package-manager-version:
type: string
required: false
default: "10"
description: pnpm version to install when package-manager is pnpm
cache-dependency-path:
type: string
required: false
default: yarn.lock
description: Path to the package manager lockfile
install-command:
type: string
required: false
default: yarn install --network-timeout 600000
description: Command used to install repository dependencies
compile-command:
type: string
required: false
default: yarn compile
description: Command used to compile the project
oclif-manifest-command:
type: string
required: false
default: yarn oclif manifest
description: Command used to generate the oclif manifest
wireit-install-command:
type: string
required: false
default: yarn add wireit@^0.14.12
description: Command used to install the wireit workaround

jobs:
nut:
Expand All @@ -68,43 +103,42 @@ jobs:
- uses: google/wireit@setup-github-actions-caching/v2
continue-on-error: true

- uses: actions/setup-node@v4
- uses: salesforcecli/github-workflows/.github/actions/setupNodeAndInstall@main
with:
node-version: ${{ inputs.nodeVersion }}
cache: yarn

- 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') }}
package-manager: ${{ inputs.package-manager }}
package-manager-version: ${{ inputs.package-manager-version }}
cache-dependency-path: ${{ inputs.cache-dependency-path }}
install-command: ${{ inputs.install-command }}

- 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

- uses: salesforcecli/github-workflows/.github/actions/yarnInstallWithRetries@main
if: ${{ steps.cache-nodemodules.outputs.cache-hit != 'true' }}

# This is a temporary workaround to ensure wireit is >= 0.14.12
# Once all plugins/libs that use this workflow are updated, this can be removed
# See: https://github.com/google/wireit/issues/1297#issuecomment-2794737569
- name: Install wireit
run: yarn add wireit@^0.14.12
env:
WIREIT_INSTALL_COMMAND: ${{ inputs.wireit-install-command }}
run: bash -c "$WIREIT_INSTALL_COMMAND"

- run: yarn compile
- name: Compile
env:
COMPILE_COMMAND: ${{ inputs.compile-command }}
run: bash -c "$COMPILE_COMMAND"

- 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
- name: Generate oclif manifest
if: ${{ steps.is-oclif-plugin.outputs.bool == 'true' }}
env:
OCLIF_MANIFEST_COMMAND: ${{ inputs.oclif-manifest-command }}
run: bash -c "$OCLIF_MANIFEST_COMMAND"

- name: Set optional sf executable path
if: inputs.sfdxExecutablePath
Expand Down
52 changes: 52 additions & 0 deletions .github/workflows/unitTest.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,60 @@
on:
workflow_call:
inputs:
package-manager:
type: string
required: false
default: yarn
description: "Package manager to use: npm, pnpm, or yarn"
package-manager-version:
type: string
required: false
default: "10"
description: pnpm version to install when package-manager is pnpm
cache-dependency-path:
type: string
required: false
default: yarn.lock
description: Path to the package manager lockfile
install-command:
type: string
required: false
default: yarn install --network-timeout 600000
description: Command used to install repository dependencies
build-command:
type: string
required: false
default: yarn build
description: Command used to build the project
test-command:
type: string
required: false
default: yarn test
description: Command used to run unit tests
wireit-install-command:
type: string
required: false
default: yarn add wireit@^0.14.12
description: Command used to install the wireit workaround

jobs:
linux-unit-tests:
uses: salesforcecli/github-workflows/.github/workflows/unitTestsLinux.yml@main
with:
package-manager: ${{ inputs.package-manager }}
package-manager-version: ${{ inputs.package-manager-version }}
cache-dependency-path: ${{ inputs.cache-dependency-path }}
install-command: ${{ inputs.install-command }}
build-command: ${{ inputs.build-command }}
test-command: ${{ inputs.test-command }}
wireit-install-command: ${{ inputs.wireit-install-command }}
windows-unit-tests:
uses: salesforcecli/github-workflows/.github/workflows/unitTestsWindows.yml@main
with:
package-manager: ${{ inputs.package-manager }}
package-manager-version: ${{ inputs.package-manager-version }}
cache-dependency-path: ${{ inputs.cache-dependency-path }}
install-command: ${{ inputs.install-command }}
build-command: ${{ inputs.build-command }}
test-command: ${{ inputs.test-command }}
wireit-install-command: ${{ inputs.wireit-install-command }}
69 changes: 50 additions & 19 deletions .github/workflows/unitTestsLinux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,41 @@ on:
required: false
default: false
description: skip `prevent-typescript-dependency`. Use it for devDeps that ship TS
package-manager:
type: string
required: false
default: yarn
description: "Package manager to use: npm, pnpm, or yarn"
package-manager-version:
type: string
required: false
default: "10"
description: pnpm version to install when package-manager is pnpm
cache-dependency-path:
type: string
required: false
default: yarn.lock
description: Path to the package manager lockfile
install-command:
type: string
required: false
default: yarn install --network-timeout 600000
description: Command used to install repository dependencies
build-command:
type: string
required: false
default: yarn build
description: Command used to build the project
test-command:
type: string
required: false
default: yarn test
description: Command used to run unit tests
wireit-install-command:
type: string
required: false
default: yarn add wireit@^0.14.12
description: Command used to install the wireit workaround

jobs:
determine-node-versions:
Expand Down Expand Up @@ -33,37 +68,33 @@ jobs:
steps:
- uses: actions/checkout@v4

- uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node_version }}
cache: yarn

- uses: google/wireit@setup-github-actions-caching/v2
continue-on-error: true

- name: Cache node modules
id: cache-nodemodules
uses: actions/cache@v4
env:
cache-name: cache-node-modules
- uses: salesforcecli/github-workflows/.github/actions/setupNodeAndInstall@main
with:
path: "**/node_modules"
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/yarn.lock') }}

- uses: salesforcecli/github-workflows/.github/actions/yarnInstallWithRetries@main
if: ${{ steps.cache-nodemodules.outputs.cache-hit != 'true' }}
node-version: ${{ matrix.node_version }}
package-manager: ${{ inputs.package-manager }}
package-manager-version: ${{ inputs.package-manager-version }}
cache-dependency-path: ${{ inputs.cache-dependency-path }}
install-command: ${{ inputs.install-command }}

# This is a temporary workaround to ensure wireit is >= 0.14.12
# Once all plugins/libraries that use this workflow are updated, this can be removed
# See: https://github.com/google/wireit/issues/1297#issuecomment-2794737569
- name: Install wireit
run: yarn add wireit@^0.14.12
env:
WIREIT_INSTALL_COMMAND: ${{ inputs.wireit-install-command }}
run: bash -c "$WIREIT_INSTALL_COMMAND"

- run: yarn build
- name: Build
env:
BUILD_COMMAND: ${{ inputs.build-command }}
run: bash -c "$BUILD_COMMAND"

- name: yarn test
- name: Test
uses: salesforcecli/github-workflows/.github/actions/retry@main
with:
command: yarn test
command: ${{ inputs.test-command }}
env:
SF_DISABLE_TELEMETRY: true
68 changes: 50 additions & 18 deletions .github/workflows/unitTestsWindows.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,41 @@
on:
workflow_call:
inputs:
package-manager:
type: string
required: false
default: yarn
description: "Package manager to use: npm, pnpm, or yarn"
package-manager-version:
type: string
required: false
default: "10"
description: pnpm version to install when package-manager is pnpm
cache-dependency-path:
type: string
required: false
default: yarn.lock
description: Path to the package manager lockfile
install-command:
type: string
required: false
default: yarn install --network-timeout 600000
description: Command used to install repository dependencies
build-command:
type: string
required: false
default: yarn build
description: Command used to build the project
test-command:
type: string
required: false
default: yarn test
description: Command used to run unit tests
wireit-install-command:
type: string
required: false
default: yarn add wireit@^0.14.12
description: Command used to install the wireit workaround

jobs:
determine-node-versions:
Expand Down Expand Up @@ -28,34 +64,30 @@ jobs:
- uses: google/wireit@setup-github-actions-caching/v2
continue-on-error: true

- uses: actions/setup-node@v4
- uses: salesforcecli/github-workflows/.github/actions/setupNodeAndInstall@main
with:
node-version: ${{ matrix.node_version }}
cache: yarn

- 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') }}

- uses: salesforcecli/github-workflows/.github/actions/yarnInstallWithRetries@main
if: ${{ steps.cache-nodemodules.outputs.cache-hit != 'true' }}
package-manager: ${{ inputs.package-manager }}
package-manager-version: ${{ inputs.package-manager-version }}
cache-dependency-path: ${{ inputs.cache-dependency-path }}
install-command: ${{ inputs.install-command }}

# This is a temporary workaround to ensure wireit is >= 0.14.12
# Once all plugins/libraries that use this workflow are updated, this can be removed
# See: https://github.com/google/wireit/issues/1297#issuecomment-2794737569
- name: Install wireit
run: yarn add wireit@^0.14.12
env:
WIREIT_INSTALL_COMMAND: ${{ inputs.wireit-install-command }}
run: bash -c "$WIREIT_INSTALL_COMMAND"

- run: yarn build
- name: Build
env:
BUILD_COMMAND: ${{ inputs.build-command }}
run: bash -c "$BUILD_COMMAND"

- name: yarn test
- name: Test
uses: salesforcecli/github-workflows/.github/actions/retry@main
with:
command: yarn test
command: ${{ inputs.test-command }}
env:
SF_DISABLE_TELEMETRY: true
Loading