diff --git a/.github/workflows/nut.yml b/.github/workflows/nut.yml index 3a98838..929750b 100644 --- a/.github/workflows/nut.yml +++ b/.github/workflows/nut.yml @@ -1,126 +1,34 @@ on: workflow_call: - secrets: - SF_CHANGE_CASE_SFDX_AUTH_URL: - description: 'SFDX_AUTH_URL for the CTC org. Only useful for the CTC NUTs.' - required: false - SF_CHANGE_CASE_TEMPLATE_ID: - required: false - description: 'Template ID for the CTC org. Only useful for the CTC NUTs.' - SF_CHANGE_CASE_CONFIGURATION_ITEM: - required: false - description: 'Configuration Item for the CTC org. Only useful for the CTC NUTs.' - ONEGP_TESTKIT_AUTH_URL: - description: 'SFDX_AUTH_URL for the 1GP org. Only useful for the 1GP NUTs in packaging' - required: false - TESTKIT_AUTH_URL: - required: false - TESTKIT_HUB_USERNAME: - required: false - TESTKIT_JWT_CLIENT_ID: - required: false - TESTKIT_JWT_KEY: - required: false - TESTKIT_HUB_INSTANCE: - required: false - - inputs: - command: - required: false - type: string - default: yarn test:nuts - description: 'command to execute (ex: yarn test:nuts)' - nodeVersion: - required: false - description: version of node to run tests against. Use things like [lts/-1, lts/*, latest] to avoid hardcoding versions - type: string - default: lts/* - os: - required: false - description: 'runs-on property, ex: ubuntu-latest, windows-latest' - type: string - default: 'ubuntu-latest' - sfdxExecutablePath: - required: false - description: "Path to sfdx executable to be used by NUTs, defaults to ''" - type: string - useCache: - required: false - type: boolean - default: true - retries: - required: false - type: number - default: 3 - description: 'Number of times to attempt NUTs' jobs: nut: name: ${{ inputs.command }} runs-on: ${{ inputs.os }} steps: - - name: Configure git longpaths if on Windows - if: ${{ runner.os == 'Windows' }} - run: git config --system core.longpaths true - - - uses: actions/checkout@v4 - - - uses: google/wireit@setup-github-actions-caching/v1 + - name: Checkout + uses: actions/checkout@v4.1.1 - - uses: actions/setup-node@v4 + - name: Setup Node + uses: actions/setup-node@v4.0.1 with: - node-version: ${{ inputs.nodeVersion }} + node-version: 18 cache: yarn + registry-url: 'https://registry.npmjs.org' - - 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') }} + - name: Install Dependencies + run: yarn install - - 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 + - name: Build + run: yarn build - - uses: salesforcecli/github-workflows/.github/actions/yarnInstallWithRetries@main - if: ${{ steps.cache-nodemodules.outputs.cache-hit != 'true' }} + - name: Install salesforce CLI + run: npm install -g @salesforce/cli - - run: yarn compile + - name: Install plugin + run: | + sf plugins:link . + sf plugins - - 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 - if: ${{ steps.is-oclif-plugin.outputs.bool == 'true' }} - - - name: Set optional sf executable path - if: inputs.sfdxExecutablePath - run: echo "TESTKIT_EXECUTABLE_PATH=$INPUTS_SF_EXECUTABLE_PATH" >> $GITHUB_ENV - env: - INPUTS_SF_EXECUTABLE_PATH: ${{ inputs.sfdxExecutablePath }} - - - name: NUTs with ${{ inputs.retries }} attempts - uses: salesforcecli/github-workflows/.github/actions/retry@main - with: - max_attempts: ${{ inputs.retries }} - command: ${{ inputs.command }} - retry_on: error - env: - TESTKIT_AUTH_URL: ${{ secrets.TESTKIT_AUTH_URL}} - TESTKIT_HUB_USERNAME: ${{ secrets.TESTKIT_HUB_USERNAME }} - TESTKIT_JWT_CLIENT_ID: ${{ secrets.TESTKIT_JWT_CLIENT_ID }} - TESTKIT_JWT_KEY: ${{ secrets.TESTKIT_JWT_KEY }} - TESTKIT_HUB_INSTANCE: ${{ secrets.TESTKIT_HUB_INSTANCE }} - ONEGP_TESTKIT_AUTH_URL: ${{ secrets.ONEGP_TESTKIT_AUTH_URL }} - SF_CHANGE_CASE_SFDX_AUTH_URL: ${{ secrets.SF_CHANGE_CASE_SFDX_AUTH_URL }} - SF_CHANGE_CASE_TEMPLATE_ID: ${{ secrets.SF_CHANGE_CASE_TEMPLATE_ID}} - SF_CHANGE_CASE_CONFIGURATION_ITEM: ${{ secrets.SF_CHANGE_CASE_CONFIGURATION_ITEM}} - TESTKIT_SETUP_RETRIES: 2 - SF_DISABLE_TELEMETRY: true - DEBUG: ${{ vars.DEBUG }} + - name: Run NUT + run: yarn test:nuts diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index de124b6..15e2b52 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -10,11 +10,11 @@ jobs: uses: salesforcecli/github-workflows/.github/workflows/unitTest.yml@main nuts: needs: unit-tests - uses: .github/workflows/nut.yml - secrets: inherit strategy: matrix: os: [ubuntu-latest, windows-latest] fail-fast: false with: os: ${{ matrix.os }} + uses: ./.github/workflows/nut.yml + secrets: inherit diff --git a/test/commands/transformer/transform.nut.ts b/test/commands/transformer/transform.nut.ts index e65d750..5f4a6c1 100644 --- a/test/commands/transformer/transform.nut.ts +++ b/test/commands/transformer/transform.nut.ts @@ -51,21 +51,21 @@ describe('acc transformer NUTs', () => { it('runs transform on the deploy coverage file without file extensions.', async () => { const command = `acc-transformer transform --coverage-json "${deployCoverageNoExts}" --xml "${testXmlPath1}"`; - const output = execCmd(command, { ensureExitCode: 0 }).shellOutput.stdout; + const output = execCmd(command, { ensureExitCode: 0, cli: 'sf' }).shellOutput.stdout; expect(output.replace('\n', '')).to.equal(`The coverage XML has been written to ${testXmlPath1}`); }); it('runs transform on the deploy coverage file with file extensions.', async () => { const command = `acc-transformer transform --coverage-json "${deployCoverageWithExts}" --xml "${testXmlPath2}"`; - const output = execCmd(command, { ensureExitCode: 0 }).shellOutput.stdout; + const output = execCmd(command, { ensureExitCode: 0, cli: 'sf' }).shellOutput.stdout; expect(output.replace('\n', '')).to.equal(`The coverage XML has been written to ${testXmlPath2}`); }); it('runs transform on the test coverage file.', async () => { const command = `acc-transformer transform --coverage-json "${testCoverage}" --xml "${testXmlPath3}"`; - const output = execCmd(command, { ensureExitCode: 0 }).shellOutput.stdout; + const output = execCmd(command, { ensureExitCode: 0, cli: 'sf' }).shellOutput.stdout; expect(output.replace('\n', '')).to.equal(`The coverage XML has been written to ${testXmlPath3}`); });