-
Notifications
You must be signed in to change notification settings - Fork 9
169 lines (157 loc) · 6.08 KB
/
Copy pathnut.yml
File metadata and controls
169 lines (157 loc) · 6.08 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
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
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"
package-manager:
type: string
required: false
default: yarn
description: "Package manager to use: npm, pnpm, or yarn"
package-manager-version:
type: string
required: false
default: "10"
description: pnpm version to install when package-manager is pnpm
cache-dependency-path:
type: string
required: false
default: yarn.lock
description: Path to the package manager lockfile
install-command:
type: string
required: false
default: yarn install --network-timeout 600000
description: Command used to install repository dependencies
compile-command:
type: string
required: false
default: yarn compile
description: Command used to compile the project
oclif-manifest-command:
type: string
required: false
default: yarn oclif manifest
description: Command used to generate the oclif manifest
wireit-install-command:
type: string
required: false
default: yarn add wireit@^0.14.12
description: Command used to install the wireit workaround
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: salesforcecli/github-workflows/.github/actions/setupNodeAndInstall@main
with:
node-version: ${{ inputs.nodeVersion }}
package-manager: ${{ inputs.package-manager }}
package-manager-version: ${{ inputs.package-manager-version }}
cache-dependency-path: ${{ inputs.cache-dependency-path }}
install-command: ${{ inputs.install-command }}
- 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
# 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
shell: bash
env:
WIREIT_INSTALL_COMMAND: ${{ inputs.wireit-install-command }}
run: bash -c "$WIREIT_INSTALL_COMMAND"
- name: Compile
run: ${{ inputs.compile-command }}
- name: Check that oclif config exists
shell: bash
id: is-oclif-plugin
run: echo "bool=$(jq 'if .oclif then true else false end' package.json)" >> "$GITHUB_OUTPUT"
- name: Generate oclif manifest
shell: bash
if: ${{ steps.is-oclif-plugin.outputs.bool == 'true' }}
env:
OCLIF_MANIFEST_COMMAND: ${{ inputs.oclif-manifest-command }}
run: bash -c "$OCLIF_MANIFEST_COMMAND"
- name: Set optional sf executable path
shell: bash
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 }}