Skip to content
This repository was archived by the owner on Sep 8, 2025. It is now read-only.

Commit 370e81e

Browse files
committed
dev(trdl-actions): e2e-test action setup-app manually
Signed-off-by: Alexandr Zaytsev <[email protected]>
1 parent 82d94e1 commit 370e81e

File tree

12 files changed

+77
-50
lines changed

12 files changed

+77
-50
lines changed

.github/workflows/_test_e2e_install.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Test e2e Install
1+
name: Test e2e install
22

33
on: [push]
44

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
name: Test e2e setup-app manually
2+
3+
on: [push]
4+
5+
jobs:
6+
test-e2e-setup-app-manually:
7+
runs-on: ubuntu-22.04
8+
timeout-minutes: 10
9+
10+
steps:
11+
- name: Checkout code
12+
uses: actions/checkout@v4
13+
14+
- name: Setup application
15+
uses: ./setup-app
16+
with:
17+
repo: kubedog
18+
url: https://tuf.kubedog.werf.io
19+
root-version: 12
20+
root-sha512: e1d3c7bcfdf473fe1466c5e9d9030bea0fed857d0563db1407754d2795256e4d063b099156807346cdcdc21d747326cc43f96fa2cacda5f1c67c8349fe09894d
21+
group: stable
22+
23+
- name: Use kubedog binary
24+
run: |
25+
kubedog --help

install/dist/index.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30020,7 +30020,7 @@ async function Run() {
3002030020
}
3002130021
async function Do(trdlCli, gpgCli, inputs) {
3002230022
coreExports.startGroup(`Install or self-update ${trdlCli.name}.`);
30023-
coreExports.info(format(`parsed inputs=%o`, inputs));
30023+
coreExports.info(format(`Parsed inputs=%o`, inputs));
3002430024
const defaults = trdlCli.defaults();
3002530025
coreExports.info(format(`${trdlCli.name} repository defaults=%o`, defaults));
3002630026
const options = await getOptions(inputs, defaults);

install/dist/index.mjs.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

install/src/action.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ export async function Run(): Promise<void> {
111111

112112
export async function Do(trdlCli: TrdlCli, gpgCli: GpgCli, inputs: inputs): Promise<void> {
113113
startGroup(`Install or self-update ${trdlCli.name}.`)
114-
info(format(`parsed inputs=%o`, inputs))
114+
info(format(`Parsed inputs=%o`, inputs))
115115

116116
const defaults = trdlCli.defaults()
117117
info(format(`${trdlCli.name} repository defaults=%o`, defaults))

lib/trdl-cli.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ describe('trdl-cli.ts', function () {
163163
libExec.execOutput.mockResolvedValueOnce({ stdout, stderr: [], exitCode: 0 })
164164
const result = await cli.version()
165165
expect(result).toEqual(stdout.join(''))
166-
expect(libExec.execOutput).toHaveBeenCalledWith(cliName, ['version'], { silent: false })
166+
expect(libExec.execOutput).toHaveBeenCalledWith(cliName, ['version'])
167167
})
168168
})
169169
})

setup-app/action.yml

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,23 +11,24 @@ inputs:
1111
arguments. For example: werf'
1212
required: false
1313
force:
14-
description: 'Perform operation anyway if set to true. For both "trdl add" and "trdl update"'
14+
description: 'Perform operation anyway if set to true. For both "trdl add" and "trdl update".'
1515
required: false
1616
default: 'true'
1717
repo:
18-
description: 'The certain repository name. For "trdl add", "trdl update" and "trdl bin-path"'
18+
description:
19+
'The certain repository name. Required if present not given. For "trdl add", "trdl update" and "trdl bin-path".'
1920
required: true
2021
url:
21-
description: 'The certain repository url. For "trdl add"'
22+
description: 'The certain repository url. Required if present not given. For "trdl add"'
2223
required: true
2324
root-version:
24-
description: 'The certain repository root version. For "trdl add"'
25+
description: 'The certain repository root version. Required if present not given. For "trdl add"'
2526
required: false
2627
root-sha512:
27-
description: 'The certain repository root sha512. For "trdl add"'
28+
description: 'The certain repository root sha512. Required if present not given. For "trdl add"'
2829
required: false
2930
group:
30-
description: 'The certain group. For both "trdl update" and "trdl bin-path"'
31+
description: 'The certain group. Required if present not given. For both "trdl update" and "trdl bin-path"'
3132
required: true
3233
channel:
3334
description: 'The one from allowed channels. For both "trdl update" and "trdl bin-path"'

setup-app/dist/index.mjs

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -30067,7 +30067,7 @@ async function installTrdl(binPath, toolName, toolVersion) {
3006730067
}
3006830068
async function Do$2(trdlCli, gpgCli, inputs) {
3006930069
coreExports.startGroup(`Install or self-update ${trdlCli.name}.`);
30070-
coreExports.info(format(`parsed inputs=%o`, inputs));
30070+
coreExports.info(format(`Parsed inputs=%o`, inputs));
3007130071
const defaults = trdlCli.defaults();
3007230072
coreExports.info(format(`${trdlCli.name} repository defaults=%o`, defaults));
3007330073
const options = await getOptions(inputs, defaults);
@@ -30121,32 +30121,32 @@ function mapInputsCmdArgs(inputs) {
3012130121
};
3012230122
}
3012330123
async function Do$1(trdlCli, p) {
30124-
coreExports.startGroup('Adding application via "trdl add".');
30124+
coreExports.startGroup(`Adding application via "${trdlCli.name} add".`);
3012530125
const noPreset = p === preset.unknown;
30126-
coreExports.debug(format(`using preset=%s`, !noPreset));
30126+
coreExports.info(format(`Using preset=%s.`, !noPreset));
3012730127
const inputs = parseInputs$1(noPreset);
30128-
coreExports.debug(format(`parsed inputs=%o`, inputs));
30128+
coreExports.info(format(`Parsed inputs=%o.`, inputs));
3012930129
const args = noPreset ? mapInputsCmdArgs(inputs) : getAddArgs(p);
30130-
coreExports.debug(format(`merged(preset, inputs) args=%o`, args));
30130+
coreExports.info(format(`Options for finding or adding application=%o.`, args));
3013130131
await trdlCli.mustExist();
3013230132
const list = await trdlCli.list();
3013330133
const found = list.find((item) => args.repo === item.name);
3013430134
if (!found) {
30135-
coreExports.info(format('Application not found. Adding it via "trdl add" with args=%o.', args));
30135+
coreExports.info(`Application not found. Adding application via "${trdlCli.name} add".`);
3013630136
await trdlCli.add(args);
3013730137
coreExports.endGroup();
3013830138
return;
3013930139
}
3014030140
if (!inputs.force) {
3014130141
if (found.url !== args.url) {
30142-
throw new Error(`Already added repo.url=${found.url} is not matched with given input.url=${args.url}. Use the force input to overwrite.`);
30142+
throw new Error(`Application is already added with repo.url=${found.url} which is not matched with given input.url=${args.url}. Use the force input to overwrite.`);
3014330143
}
30144-
coreExports.info(format('Adding skipped. Application is already added with inputs.url=%s.', args.url));
30144+
coreExports.info(`Application addition skipped because it is already added with inputs.url=${args.url}.`);
3014530145
coreExports.endGroup();
3014630146
return;
3014730147
}
3014830148
// force adding
30149-
coreExports.info(format('Force adding application using sequence of "trdl remove" and "trdl add" with args=%o.', args));
30149+
coreExports.info(`Force adding application using "${trdlCli.name} remove" and "${trdlCli.name} add".`);
3015030150
await trdlCli.remove(args);
3015130151
await trdlCli.add(args);
3015230152
coreExports.endGroup();
@@ -30257,28 +30257,28 @@ function formatTrdlUseEnv(args) {
3025730257
};
3025830258
}
3025930259
async function Do(trdlCli, p) {
30260-
coreExports.startGroup('Using application via "trdl update" and "trdl bin-path"');
30260+
coreExports.startGroup(`Using application via "${trdlCli.name} update" and "${trdlCli.name} bin-path".`);
3026130261
const noPreset = p === preset.unknown;
30262-
coreExports.debug(format(`using preset=%s`, !noPreset));
30262+
coreExports.info(format(`Using preset=%s`, !noPreset));
3026330263
const inputs = parseInputs(noPreset);
30264-
coreExports.debug(format(`parsed inputs=%o`, inputs));
30264+
coreExports.info(format(`Parsed inputs=%o`, inputs));
3026530265
const args = noPreset ? mapInputsToCmdArgs(inputs) : getUpdateArgs(p);
30266-
coreExports.debug(format(`merged(preset, inputs) args=%o`, args));
30266+
coreExports.info(format(`Options for using application=%o`, args));
3026730267
await trdlCli.mustExist();
3026830268
let appPath = await trdlCli.binPath(args);
30269-
coreExports.debug(format(`"trdl bin-path" application path=%s`, appPath));
30269+
coreExports.info(`Found application path=${appPath}`);
3027030270
const hasAppPath = appPath !== '';
3027130271
const opts = { inBackground: hasAppPath };
30272-
coreExports.info(format('Updating application via "trdl update" with args=%o and options=%o.', args, opts));
30272+
coreExports.info(format(`Updating application via "${trdlCli.name} update" with options=%o`, opts));
3027330273
await trdlCli.update(args, opts);
3027430274
if (!hasAppPath) {
3027530275
appPath = await trdlCli.binPath(args);
30276-
coreExports.debug(format(`"trdl bin-path" application path=%s`, appPath));
30276+
coreExports.info(`Found application path=${appPath}`);
3027730277
}
3027830278
const trdlUseEnv = formatTrdlUseEnv(args);
30279-
coreExports.info(format('Exporting $%s=%s', trdlUseEnv.key, trdlUseEnv.value));
30279+
coreExports.info(format('Exporting variable $%s=%s', trdlUseEnv.key, trdlUseEnv.value));
3028030280
coreExports.exportVariable(trdlUseEnv.key, trdlUseEnv.value);
30281-
coreExports.info(format('Extending $PATH variable with app_path=%s', appPath));
30281+
coreExports.info(`Extending $PATH variable with app_path=${appPath}`);
3028230282
coreExports.addPath(appPath);
3028330283
coreExports.endGroup();
3028430284
}

setup-app/dist/index.mjs.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

setup-app/src/add.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ describe('setup-app/src/add.ts', function () {
7878
trdlCli.list.mockResolvedValueOnce([listItem])
7979

8080
const expectedErr = new Error(
81-
`Already added repo.url=${listItem.url} is not matched with given input.url=${addArgs.url}. Use the force input to overwrite.`
81+
`Application is already added with repo.url=${listItem.url} which is not matched with given input.url=${addArgs.url}. Use the force input to overwrite.`
8282
)
8383
await expect(Do(trdlCli, preset.werf)).rejects.toThrow(expectedErr)
8484

0 commit comments

Comments
 (0)