Skip to content
Merged
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
79 changes: 74 additions & 5 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -1,26 +1,81 @@
name: tests
on:
# One run per PR commit, fork PRs included. Fork PRs get no secrets, so they skip the NUTs.
pull_request:
# The merge queue runs everything, NUTs included, on the PR merged into main, with secrets,
# after a maintainer queues it.
merge_group:
# After each merge, main reruns everything, NUTs included.
push:
branches-ignore: [main]
branches: [main]
workflow_dispatch:

# A new push to a PR cancels that PR's previous run. Every other run gets its own group, so runs on
# main or in the merge queue never cancel each other or wait behind each other.
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.run_id }}
cancel-in-progress: true

jobs:
yarn-lockfile-check:
uses: salesforcecli/github-workflows/.github/workflows/lockFileCheck.yml@main
# Since the Windows unit tests take much longer, we run the linux unit tests first and then run the windows unit tests in parallel with NUTs
# The Linux, Windows and macOS unit tests run in parallel.
linux-unit-tests:
needs: yarn-lockfile-check
uses: salesforcecli/github-workflows/.github/workflows/unitTestsLinux.yml@main
windows-unit-tests:
needs: linux-unit-tests
needs: yarn-lockfile-check
uses: salesforcecli/github-workflows/.github/workflows/unitTestsWindows.yml@main
# The shared workflows have no macOS unit tests, so run them here on the current Node LTS.
macos-unit-tests:
needs: yarn-lockfile-check
runs-on: macos-latest
steps:
- uses: actions/checkout@v4
- uses: salesforcecli/github-workflows/.github/actions/setupNodeAndInstall@7a73e06604a17eb64a77792d30386f3357335d01 # main
with:
node-version: lts/*
package-manager: yarn
cache-dependency-path: yarn.lock
install-command: yarn install --network-timeout 600000
- name: Build
run: yarn build
- name: Test
uses: salesforcecli/github-workflows/.github/actions/retry@7a73e06604a17eb64a77792d30386f3357335d01 # main
with:
command: yarn test
env:
SF_DISABLE_TELEMETRY: true
# One check name for branch protection to require: `unit-tests`. The per-job unit-test checks
# embed the Node version, so their names change with each Node release.
unit-tests:
needs: [yarn-lockfile-check, linux-unit-tests, windows-unit-tests, macos-unit-tests]
# GitHub counts a skipped job as passing, so run even when a needed job failed or was cancelled.
if: always()
runs-on: ubuntu-latest
steps:
- name: Fail if a needed job didn't succeed
if: contains(needs.*.result, 'failure') || contains(needs.*.result, 'cancelled') || contains(needs.*.result, 'skipped')
env:
NEEDS: ${{ toJSON(needs) }}
run: |
jq -r 'to_entries[] | select(.value.result != "success") | "::error::\(.key): \(.value.result)"' <<< "$NEEDS"
exit 1
nuts:
needs: linux-unit-tests
# NUTs need org secrets, which GitHub doesn't pass to fork PRs.
if: ${{ !github.event.pull_request.head.repo.fork }}
uses: salesforcecli/github-workflows/.github/workflows/nut.yml@main
secrets: inherit
# Only the test-org secrets the NUTs use, not every secret the repo can see.
secrets:
TESTKIT_AUTH_URL: ${{ secrets.TESTKIT_AUTH_URL }}
TESTKIT_HUB_USERNAME: ${{ secrets.TESTKIT_HUB_USERNAME }}
TESTKIT_HUB_INSTANCE: ${{ secrets.TESTKIT_HUB_INSTANCE }}
TESTKIT_JWT_CLIENT_ID: ${{ secrets.TESTKIT_JWT_CLIENT_ID }}
TESTKIT_JWT_KEY: ${{ secrets.TESTKIT_JWT_KEY }}
strategy:
matrix:
os: [ubuntu-latest, windows-latest]
os: [ubuntu-latest, windows-latest, macos-latest]
# Split the NUTs across jobs so each group runs on its own runner (its own
# egress IP). The `login rate exceeded` OAuth cap is per-IP, and running the
# whole suite serially on one IP exhausts the budget before run-eval. run-eval
Expand All @@ -36,3 +91,17 @@ jobs:
with:
os: ${{ matrix.os }}
command: ${{ matrix.command }}
# One NUT check for branch protection and the merge queue to require: `nut-tests`. It's skipped
# on fork PRs, which GitHub counts as passing; the merge queue runs their NUTs before merge.
nut-tests:
needs: nuts
if: always() && !github.event.pull_request.head.repo.fork
runs-on: ubuntu-latest
steps:
- name: Fail if a needed job didn't succeed
if: contains(needs.*.result, 'failure') || contains(needs.*.result, 'cancelled') || contains(needs.*.result, 'skipped')
env:
NEEDS: ${{ toJSON(needs) }}
run: |
jq -r 'to_entries[] | select(.value.result != "success") | "::error::\(.key): \(.value.result)"' <<< "$NEEDS"
exit 1
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"@inquirer/prompts": "^7.10.1",
"@oclif/core": "^5.0.0",
"@oclif/multi-stage-output": "^1.0.0",
"@salesforce/agents": "^2.5.0",
"@salesforce/agents": "^2.5.4",
"@salesforce/core": "^9.1.9",
"@salesforce/kit": "^4.0.0",
"@salesforce/sf-plugins-core": "^13.0.0",
Expand Down
2 changes: 1 addition & 1 deletion test/commands/agent/express-context/create.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* limitations under the License.
*/

/* eslint-disable @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-unsafe-call, @typescript-eslint/no-explicit-any, @typescript-eslint/no-unsafe-return */
/* eslint-disable @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-unsafe-call, @typescript-eslint/no-explicit-any, @typescript-eslint/no-unsafe-return */

import { mkdtempSync, readFileSync, rmSync, writeFileSync } from 'node:fs';
import { tmpdir } from 'node:os';
Expand Down
9 changes: 8 additions & 1 deletion test/commands/agent/express-context/readCommands.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,14 @@ describe('agent express-context read/delete commands', () => {
destroy.rejects(new Error('in use'));
const result = await AgentExpressContextDelete.run(['--target-org', testOrg.username, '-i', LIB, '--no-prompt']);
expect(result).to.deep.equal({ libraryId: LIB, deleted: true });
expect(ux.warn.args.flat().join('\n')).to.include('FAQ_RetrieverAction').and.include('in use');
expect(
ux.warn.args
.flat()
.map((w) => (typeof w === 'string' ? w : w.message))
.join('\n')
)
.to.include('FAQ_RetrieverAction')
.and.include('in use');
});

it('still deletes the library when the lookup fails', async () => {
Expand Down
2 changes: 1 addition & 1 deletion test/commands/agent/express-context/upload.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* limitations under the License.
*/

/* eslint-disable @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-unsafe-call, @typescript-eslint/no-explicit-any, @typescript-eslint/no-unsafe-return */
/* eslint-disable @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-unsafe-call, @typescript-eslint/no-explicit-any, @typescript-eslint/no-unsafe-return */

import { mkdtempSync, rmSync, writeFileSync } from 'node:fs';
import { tmpdir } from 'node:os';
Expand Down
8 changes: 4 additions & 4 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1431,10 +1431,10 @@
"@pnpm/network.ca-file" "^1.0.1"
config-chain "^1.1.11"

"@salesforce/agents@^2.5.0":
version "2.5.0"
resolved "https://registry.yarnpkg.com/@salesforce/agents/-/agents-2.5.0.tgz#46315617feab965ac19c70c2da8b1da3e19ac755"
integrity sha512-s4fBQwavMx59qnKdN6SOMAJkwinDWq8TyQisxQFeW3jVfh4rXC8Uqt6f65+fjtOjuepmO/6YwkRacufd3jHq+w==
"@salesforce/agents@^2.5.4":
version "2.5.4"
resolved "https://registry.yarnpkg.com/@salesforce/agents/-/agents-2.5.4.tgz#a9e41880cdefa0821e58fb929afe1f4ae56f3ba7"
integrity sha512-zwSmTEXDc6prxvImJ1aycXCnyrJgxuLgp23/hyELzqLI3eyTMblyZNc0+kl8ZaChBYv5xdK47afqboFbmMulFg==
dependencies:
"@salesforce/core" "^9.0.0"
"@salesforce/kit" "^4.0.0"
Expand Down
Loading