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

ci: use externalNut.yml for oclif plugins #882

Merged
merged 1 commit into from
Nov 30, 2023
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
46 changes: 46 additions & 0 deletions .github/workflows/external-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
on:
workflow_call:
inputs:
os:
required: false
description: "runs-on property, ex: ubuntu-latest, windows-latest"
type: string
default: "ubuntu-latest"
repo:
required: true
description: "Repository name, ex: 'owner/repo'"
type: string
command:
required: true
description: "Command to run, ex: 'yarn test'"
type: string
other-setup:
required: false
description: "Setup command, ex: 'yarn install'"
type: string

jobs:
external-test:
name: ${{ inputs.repo }} ${{ inputs.command }}
runs-on: ${{ inputs.os }}
steps:
- uses: actions/setup-node@v4
- uses: actions/checkout@v4
- uses: salesforcecli/github-workflows/.github/actions/yarnInstallWithRetries@main
- run: yarn build
- run: yarn link
- run: ${{ inputs.other-setup }}
- uses: actions/checkout@v4
with:
repository: ${{ inputs.repo }}
ref: main
path: test
- name: Build plugin
working-directory: test
run: |
yarn install --network-timeout 600000 --ignore-scripts
yarn link @oclif/core
yarn build
- name: Run tests in plugin
working-directory: test
run: ${{ inputs.command }}
45 changes: 45 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -122,3 +122,48 @@ jobs:
TESTKIT_JWT_CLIENT_ID: ${{ secrets.TESTKIT_JWT_CLIENT_ID }}
TESTKIT_JWT_KEY: ${{ secrets.TESTKIT_JWT_KEY }}
TESTKIT_HUB_INSTANCE: ${{ secrets.TESTKIT_HUB_INSTANCE }}
external-unit-tests:
needs: linux-unit-tests
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest]
repo:
- oclif/plugin-autocomplete
- oclif/plugin-commands
- oclif/plugin-help
- oclif/plugin-not-found
- oclif/plugin-plugins
- oclif/plugin-update
- oclif/plugin-which
- oclif/plugin-warn-if-update-available
- oclif/plugin-version
uses: ./.github/workflows/external-test.yml
with:
repo: ${{ matrix.repo }}
os: ${{ matrix.os }}
command: "yarn mocha test/**/*.test.ts --timeout 1200000"
plugin-plugins-integration:
needs: linux-unit-tests
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest]
uses: ./.github/workflows/external-test.yml
with:
repo: oclif/plugin-plugins
os: ${{ matrix.os }}
command: "yarn test:integration"
# plugin-plugins integration tests depend on sf being installed globally
other-setup: npm install -g @salesforce/cli@nightly
plugin-update-integration:
needs: linux-unit-tests
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest]
uses: ./.github/workflows/external-test.yml
with:
repo: oclif/plugin-update
os: ${{ matrix.os }}
command: "yarn test:integration:sf"
277 changes: 0 additions & 277 deletions test/integration/plugins.e2e.ts

This file was deleted.

10 changes: 3 additions & 7 deletions test/integration/util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ export type SetupOptions = {
plugins?: string[]
subDir?: string
noLinkCore?: boolean
yarnInstallArgs?: string[]
}

export type ExecutorOptions = {
Expand Down Expand Up @@ -187,12 +186,9 @@ export async function setup(testFile: string, options: SetupOptions): Promise<Ex
executor.debug(`${bin}_CONFIG_DIR:`, process.env[`${bin}_CONFIG_DIR`])
executor.debug(`${bin}_CACHE_DIR:`, process.env[`${bin}_CACHE_DIR`])

const yarnInstallRes = await executor.executeInTestDir(
`yarn install --force --network-timeout 600000 ${options.yarnInstallArgs?.join(' ') ?? ''}`,
{
silent: false,
},
)
const yarnInstallRes = await executor.executeInTestDir('yarn install --force --network-timeout 600000', {
silent: false,
})
if (yarnInstallRes.code !== 0) {
console.error(yarnInstallRes?.error)
throw new Error('Failed to run `yarn install --force`')
Expand Down
Loading