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

Commit 3036738

Browse files
committed
dev(trdl-actions): e2e-test install action
Signed-off-by: Alexandr Zaytsev <[email protected]>
1 parent 171bed0 commit 3036738

File tree

10 files changed

+52
-23
lines changed

10 files changed

+52
-23
lines changed

.github/workflows/_lint.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ name: Lint
33
on: [push]
44

55
jobs:
6-
_:
6+
lint:
77
runs-on: ubuntu-22.04
88
timeout-minutes: 10
99

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
name: Test e2e Install
2+
3+
on: [push]
4+
5+
jobs:
6+
test-e2e-install:
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: Install trdl
15+
uses: ./install
16+
17+
- name: Use trdl binary
18+
run: |
19+
trdl version
20+
trdl --help

.github/workflows/_test_unit.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ name: Test Unit
33
on: [push]
44

55
jobs:
6-
_:
6+
test-unit:
77
runs-on: ubuntu-22.04
88
timeout-minutes: 10
99

install/dist/index.mjs

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -30007,18 +30007,19 @@ async function installTrdl(toolName, toolVersion, binPath) {
3000730007
coreExports.addPath(installedPath);
3000830008
}
3000930009
async function Run() {
30010+
coreExports.setCommandEcho(coreExports.isDebug());
3001030011
const trdlCli = new TrdlCli();
3001130012
const gpgCli = new GpgCli();
3001230013
const inputs = parseInputs();
3001330014
await Do(trdlCli, gpgCli, inputs);
3001430015
}
3001530016
async function Do(trdlCli, gpgCli, inputs) {
3001630017
coreExports.startGroup('Install or self-update trdl.');
30017-
coreExports.debug(format(`parsed inputs=%o`, inputs));
30018+
coreExports.info(format(`parsed inputs=%o`, inputs));
3001830019
const defaults = trdlCli.defaults();
30019-
coreExports.debug(format(`trdl defaults=%o`, defaults));
30020+
coreExports.info(format(`trdl defaults=%o`, defaults));
3002030021
const options = await getOptions(inputs, defaults);
30021-
coreExports.debug(format(`installation options=%o`, options));
30022+
coreExports.info(format(`installation options=%o`, options));
3002230023
const toolCache = findTrdlCache(defaults.repo, options.version);
3002330024
if (toolCache) {
3002430025
coreExports.info(`Installation skipped. trdl@v${options.version} is found at path ${toolCache}.`);
@@ -30030,9 +30031,9 @@ async function Do(trdlCli, gpgCli, inputs) {
3003030031
}
3003130032
await gpgCli.mustGnuGP();
3003230033
const [binUrl, sigUrl, ascUrl] = formatDownloadUrls(options.version);
30033-
coreExports.debug(format('%s bin_url=%s', defaults.repo, binUrl));
30034-
coreExports.debug(format('%s sig_url=%s', defaults.repo, sigUrl));
30035-
coreExports.debug(format('%s asc_url=%s', defaults.repo, ascUrl));
30034+
coreExports.info(format('%s bin_url=%s', defaults.repo, binUrl));
30035+
coreExports.info(format('%s sig_url=%s', defaults.repo, sigUrl));
30036+
coreExports.info(format('%s asc_url=%s', defaults.repo, ascUrl));
3003630037
coreExports.info('Downloading signatures.');
3003730038
const [binPath, sigPath, ascPath] = await downloadParallel(binUrl, sigUrl, ascUrl);
3003830039
coreExports.info('Importing and verifying gpg keys.');

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: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { getInput, platform, addPath, info, startGroup, endGroup, debug } from '@actions/core'
1+
import { getInput, platform, addPath, info, startGroup, endGroup, setCommandEcho, isDebug } from '@actions/core'
22
import { HttpClient } from '@actions/http-client'
33
import { downloadTool, find, cacheFile } from '@actions/tool-cache'
44
import { chmodSync } from 'node:fs'
@@ -100,6 +100,8 @@ async function installTrdl(toolName: string, toolVersion: string, binPath: strin
100100
}
101101

102102
export async function Run(): Promise<void> {
103+
setCommandEcho(isDebug())
104+
103105
const trdlCli = new TrdlCli()
104106
const gpgCli = new GpgCli()
105107
const inputs = parseInputs()
@@ -109,13 +111,13 @@ export async function Run(): Promise<void> {
109111

110112
export async function Do(trdlCli: TrdlCli, gpgCli: GpgCli, inputs: inputs): Promise<void> {
111113
startGroup('Install or self-update trdl.')
112-
debug(format(`parsed inputs=%o`, inputs))
114+
info(format(`parsed inputs=%o`, inputs))
113115

114116
const defaults = trdlCli.defaults()
115-
debug(format(`trdl defaults=%o`, defaults))
117+
info(format(`trdl defaults=%o`, defaults))
116118

117119
const options = await getOptions(inputs, defaults)
118-
debug(format(`installation options=%o`, options))
120+
info(format(`installation options=%o`, options))
119121

120122
const toolCache = findTrdlCache(defaults.repo, options.version)
121123

@@ -133,9 +135,9 @@ export async function Do(trdlCli: TrdlCli, gpgCli: GpgCli, inputs: inputs): Prom
133135
await gpgCli.mustGnuGP()
134136

135137
const [binUrl, sigUrl, ascUrl] = formatDownloadUrls(options.version)
136-
debug(format('%s bin_url=%s', defaults.repo, binUrl))
137-
debug(format('%s sig_url=%s', defaults.repo, sigUrl))
138-
debug(format('%s asc_url=%s', defaults.repo, ascUrl))
138+
info(format('%s bin_url=%s', defaults.repo, binUrl))
139+
info(format('%s sig_url=%s', defaults.repo, sigUrl))
140+
info(format('%s asc_url=%s', defaults.repo, ascUrl))
139141

140142
info('Downloading signatures.')
141143
const [binPath, sigPath, ascPath] = await downloadParallel(binUrl, sigUrl, ascUrl)

setup-app/dist/index.mjs

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -30061,11 +30061,11 @@ async function installTrdl(toolName, toolVersion, binPath) {
3006130061
}
3006230062
async function Do$2(trdlCli, gpgCli, inputs) {
3006330063
coreExports.startGroup('Install or self-update trdl.');
30064-
coreExports.debug(format(`parsed inputs=%o`, inputs));
30064+
coreExports.info(format(`parsed inputs=%o`, inputs));
3006530065
const defaults = trdlCli.defaults();
30066-
coreExports.debug(format(`trdl defaults=%o`, defaults));
30066+
coreExports.info(format(`trdl defaults=%o`, defaults));
3006730067
const options = await getOptions(inputs, defaults);
30068-
coreExports.debug(format(`installation options=%o`, options));
30068+
coreExports.info(format(`installation options=%o`, options));
3006930069
const toolCache = findTrdlCache(defaults.repo, options.version);
3007030070
if (toolCache) {
3007130071
coreExports.info(`Installation skipped. trdl@v${options.version} is found at path ${toolCache}.`);
@@ -30077,9 +30077,9 @@ async function Do$2(trdlCli, gpgCli, inputs) {
3007730077
}
3007830078
await gpgCli.mustGnuGP();
3007930079
const [binUrl, sigUrl, ascUrl] = formatDownloadUrls(options.version);
30080-
coreExports.debug(format('%s bin_url=%s', defaults.repo, binUrl));
30081-
coreExports.debug(format('%s sig_url=%s', defaults.repo, sigUrl));
30082-
coreExports.debug(format('%s asc_url=%s', defaults.repo, ascUrl));
30080+
coreExports.info(format('%s bin_url=%s', defaults.repo, binUrl));
30081+
coreExports.info(format('%s sig_url=%s', defaults.repo, sigUrl));
30082+
coreExports.info(format('%s asc_url=%s', defaults.repo, ascUrl));
3008330083
coreExports.info('Downloading signatures.');
3008430084
const [binPath, sigPath, ascPath] = await downloadParallel(binUrl, sigUrl, ascUrl);
3008530085
coreExports.info('Importing and verifying gpg keys.');
@@ -30272,6 +30272,7 @@ async function Do(trdlCli, p) {
3027230272
}
3027330273

3027430274
async function Run() {
30275+
coreExports.setCommandEcho(coreExports.isDebug());
3027530276
const p = parsePresetInput();
3027630277
const trdlCli = new TrdlCli();
3027730278
const gpgCli = new GpgCli();

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/action.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,11 @@ import { GpgCli } from '../../lib/gpg-cli'
44
import { Do as DoInstall } from '../../install/src/action'
55
import { Do as DoAdd } from './add'
66
import { Do as DoUse } from './use'
7+
import { isDebug, setCommandEcho } from '@actions/core'
78

89
export async function Run(): Promise<void> {
10+
setCommandEcho(isDebug())
11+
912
const p = parsePresetInput()
1013
const trdlCli = new TrdlCli()
1114
const gpgCli = new GpgCli()

test/mocks/core.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ export const addPath = jest.fn<typeof core.addPath>()
1212
export const startGroup = jest.fn<typeof core.startGroup>()
1313
export const endGroup = jest.fn<typeof core.endGroup>()
1414
export const exportVariable = jest.fn<typeof core.exportVariable>()
15+
export const isDebug = jest.fn<typeof core.isDebug>()
16+
export const setCommandEcho = jest.fn<typeof core.setCommandEcho>()
1517

1618
export const platform = Object.create(
1719
{},

0 commit comments

Comments
 (0)