-
Notifications
You must be signed in to change notification settings - Fork 9
133 lines (119 loc) · 4.73 KB
/
nut.yml
File metadata and controls
133 lines (119 loc) · 4.73 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
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/v2
continue-on-error: true
- uses: actions/setup-node@v4
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') }}
- 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
- run: yarn compile
- 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 }}