test: remove circular dep #240
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: tests | |
on: | |
push: | |
branches-ignore: [2.0] | |
workflow_dispatch: | |
jobs: | |
test-browser: | |
needs: lint-and-typecheck | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: browser-actions/setup-chrome@v1 | |
with: | |
chrome-version: stable | |
id: setup-chrome | |
- uses: nanasess/setup-chromedriver@9cd356a368322c0154e5610c8d4a5aa5f3c146f5 | |
- run: | | |
chromedriver --url-base=/wd/hub & | |
sudo Xvfb -ac :99 -screen 0 1280x1024x24 > /dev/null 2>&1 & # optional | |
- uses: actions/setup-node@v3 | |
with: | |
node-version: lts/* | |
- uses: google/wireit@setup-github-actions-caching/v1 | |
- name: Install dependencies | |
run: npm install | |
- name: Install sf CLI | |
run: npm install --global @salesforce/cli | |
- name: Setup scratch org | |
env: | |
SF_HUB_USERNAME: ${{ secrets.SF_HUB_USERNAME }} | |
SF_OAUTH2_CLIENT_ID: ${{ secrets.SF_OAUTH2_CLIENT_ID }} | |
SF_OAUTH2_JWT_KEY: ${{ secrets.SF_OAUTH2_JWT_KEY }} | |
run: | | |
npm run test:setup:org | |
- name: Run browser tests with 3 attempts | |
uses: nick-fields/retry@943e742917ac94714d2f408a0e8320f2d1fcafcd | |
with: | |
max_attempts: 3 | |
timeout_minutes: 30 | |
retry_wait_seconds: 60 | |
command: | | |
SF_USERNAME=$(sf org display user --target-org jsforce-test-org --json | jq -r '.result.username') \ | |
SF_PASSWORD=$(sf org display user --target-org jsforce-test-org --json | jq -r '.result.password') \ | |
SF_LOGIN_URL=$(sf org display user --target-org jsforce-test-org --json | jq -r '.result.instanceUrl') \ | |
DISPLAY=:99 CHROME_BIN=$(which chrome) \ | |
npm run test:browser-ci | |
new_command_on_retry: | | |
SF_USERNAME=$(sf org display user --target-org jsforce-test-org --json | jq -r '.result.username') \ | |
SF_PASSWORD=$(sf org display user --target-org jsforce-test-org --json | jq -r '.result.password') \ | |
SF_LOGIN_URL=$(sf org display user --target-org jsforce-test-org --json | jq -r '.result.instanceUrl') \ | |
DISPLAY=:99 CHROME_BIN=$(which chrome) \ | |
npm run test:browser-ci:retry | |
retry_on: error | |
env: | |
SF_OAUTH2_CLIENT_ID: ${{ secrets.SF_OAUTH2_CLIENT_ID }} | |
SF_OAUTH2_CLIENT_SECRET: ${{ secrets.SF_OAUTH2_CLIENT_SECRET }} | |
SF_OAUTH2_REDIRECT_URI: ${{ secrets.SF_OAUTH2_REDIRECT_URI }} | |
SF_AJAX_PROXY_URL: ${{ vars.SF_AJAX_PROXY_URL }} | |
lint-and-typecheck: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-node@v3 | |
with: | |
node-version: lts/* | |
- uses: google/wireit@setup-github-actions-caching/v1 | |
- name: Lockfile lint | |
run: | | |
npm install -g lockfile-lint | |
lockfile-lint --path package-lock.json --allowed-hosts npm yarn --validate-https | |
- name: Install dependencies | |
run: npm install | |
- name: Lint and Type Check | |
run: | | |
npm run lint | |
# TODO: typecheck fails if there is no build, see if tests are importing from lib | |
npm run build:node:cjs | |
npm run typecheck | |
test-node-linux: | |
needs: lint-and-typecheck | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
node_version: [lts/-1, lts/*, latest] | |
fail-fast: false | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-node@v3 | |
with: | |
node-version: ${{ matrix.node_version }} | |
- uses: google/wireit@setup-github-actions-caching/v1 | |
- name: Install dependencies | |
run: npm install | |
- name: Install sf CLI | |
run: npm install --global @salesforce/cli | |
- name: Setup scratch org | |
env: | |
SF_HUB_USERNAME: ${{ secrets.SF_HUB_USERNAME }} | |
SF_OAUTH2_CLIENT_ID: ${{ secrets.SF_OAUTH2_CLIENT_ID }} | |
SF_OAUTH2_JWT_KEY: ${{ secrets.SF_OAUTH2_JWT_KEY }} | |
run: | | |
npm run test:setup:org | |
- name: Run Node tests | |
env: | |
SF_OAUTH2_CLIENT_ID: ${{ secrets.SF_OAUTH2_CLIENT_ID }} | |
SF_OAUTH2_CLIENT_SECRET: ${{ secrets.SF_OAUTH2_CLIENT_SECRET }} | |
SF_OAUTH2_REDIRECT_URI: ${{ secrets.SF_OAUTH2_REDIRECT_URI }} | |
run: | | |
SF_USERNAME=$(sf org display user --target-org jsforce-test-org --json | jq -r '.result.username') \ | |
SF_PASSWORD=$(sf org display user --target-org jsforce-test-org --json | jq -r '.result.password') \ | |
SF_LOGIN_URL=$(sf org display user --target-org jsforce-test-org --json | jq -r '.result.instanceUrl') \ | |
npm run test:node | |
- name: Delete scratch org | |
if: always() | |
run: sf org delete scratch --target-org jsforce-test-org --no-prompt | |
salesforce-cli-external-nuts: | |
needs: test-node-linux | |
uses: ./.github/workflows/externalNut.yml | |
strategy: | |
fail-fast: false | |
matrix: | |
os: ['ubuntu-latest', 'windows-latest'] | |
externalProjectGitUrl: | |
- https://github.com/salesforcecli/plugin-org | |
- https://github.com/salesforcecli/plugin-auth | |
- https://github.com/salesforcecli/plugin-data | |
- https://github.com/salesforcecli/plugin-user | |
- https://github.com/salesforcecli/plugin-custom-metadata | |
with: | |
externalProjectGitUrl: ${{ matrix.externalProjectGitUrl }} | |
command: 'yarn test:nuts' | |
os: ${{ matrix.os }} | |
useCache: false | |
secrets: | |
TESTKIT_AUTH_URL: ${{ secrets.SF_HUB_AUTH_URL }} | |
TESTKIT_HUB_USERNAME: ${{ secrets.SF_HUB_USERNAME }} | |
TESTKIT_JWT_CLIENT_ID: ${{ secrets.SF_OAUTH2_CLIENT_ID }} | |
TESTKIT_JWT_KEY: ${{ secrets.SF_OAUTH2_JWT_KEY }} | |
TESTKIT_HUB_INSTANCE: ${{ secrets.SF_HUB_INSTANCE }} | |
test-node-windows: | |
needs: lint-and-typecheck | |
runs-on: windows-latest | |
strategy: | |
matrix: | |
node_version: [lts/*] | |
fail-fast: false | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-node@v3 | |
with: | |
node-version: ${{ matrix.node_version }} | |
- uses: google/wireit@setup-github-actions-caching/v1 | |
- name: Install dependencies | |
run: npm install | |
- name: Install sf CLI | |
run: npm install --global @salesforce/cli@nightly | |
- name: Setup scratch org | |
env: | |
SF_HUB_USERNAME: ${{ secrets.SF_HUB_USERNAME }} | |
SF_OAUTH2_CLIENT_ID: ${{ secrets.SF_OAUTH2_CLIENT_ID }} | |
SF_OAUTH2_JWT_KEY: ${{ secrets.SF_OAUTH2_JWT_KEY }} | |
run: | | |
npm run test:setup:org | |
- name: Run Node tests | |
env: | |
SF_OAUTH2_CLIENT_ID: ${{ secrets.SF_OAUTH2_CLIENT_ID }} | |
SF_OAUTH2_CLIENT_SECRET: ${{ secrets.SF_OAUTH2_CLIENT_SECRET }} | |
SF_OAUTH2_REDIRECT_URI: ${{ secrets.SF_OAUTH2_REDIRECT_URI }} | |
run: | | |
$env:SF_USERNAME=$(sf org display user --target-org jsforce-test-org --json | jq -r '.result.username') | |
$env:SF_PASSWORD=$(sf org display user --target-org jsforce-test-org --json | jq -r '.result.password') | |
$env:SF_LOGIN_URL=$(sf org display user --target-org jsforce-test-org --json | jq -r '.result.instanceUrl') | |
npm run test:node | |
- name: Delete scratch org | |
if: always() | |
run: sf org delete scratch --target-org jsforce-test-org --no-prompt |