-
Notifications
You must be signed in to change notification settings - Fork 38
/
action.yaml
93 lines (85 loc) · 3.01 KB
/
action.yaml
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
name: Tool Tests
description: Run tests against plugin tools
inputs:
cli-version:
description: Trunk cli version to run test against. Mutually exclusive with `cli-path`
required: false
cli-path:
description: Trunk cli path to run test against. Overrides `cli-version` if set.
required: false
path:
description: The cwd from which to run plugin commands
required: false
default: .
append-args:
description: Additional args to append to the test invocation
required: false
default: tools --
trunk-token:
description: CI debugger api token (org token)
required: true
ref-type:
description: release or main
required: false
default: main
runs:
# TODO(Tyler): See if this can be converted to a js action
using: composite
steps:
- name: Setup node
uses: actions/setup-node@v3
with:
node-version: 18
- name: Specify defaults
run: |
echo "CLI_PATH=${{ inputs.cli-path }}" >> "$GITHUB_ENV"
case "$RUNNER_OS" in
Windows)
echo "PLATFORM_APPEND_ARGS=--maxWorkers=5" >> "$GITHUB_ENV"
if [[ "${{ inputs.cli-path }}" == "" ]]; then
echo "CLI_PATH=${{ github.workspace }}\trunk.ps1" >> "$GITHUB_ENV"
fi
;;
esac
shell: bash
- name: Install dependencies
run: npm ci
shell: bash
working-directory: ${{ inputs.path }}
- name: Run plugin tests
if: runner.os == 'Windows'
run: npm test ${{ inputs.append-args }} ${{ env.PLATFORM_APPEND_ARGS }} --ci
shell: bash
working-directory: ${{ inputs.path }}
env:
PLUGINS_TEST_CLI_VERSION: ${{ inputs.cli-version }}
PLUGINS_TEST_CLI_PATH: ${{ env.CLI_PATH }}
JEST_SUITE_NAME: Tool Tests
JEST_JUNIT_SUITE_NAME: "{title} ${{ runner.os }} ${{ inputs.ref-type }}"
- name: Run plugin tests
if: runner.os != 'Windows'
# trunk-ignore(semgrep/yaml.github-actions.security.third-party-action-not-pinned-to-commit-sha.third-party-action-not-pinned-to-commit-sha)
uses: trunk-io/breakpoint@v1.3.0
with:
breakpoint-id: trunk-plugins-tool-tests
shell: bash
working-directory: ${{ inputs.path }}
trunk-token: ${{ inputs.trunk-token }}
org: trunk-staging-org
run: npm test ${{ inputs.append-args }} ${{ env.PLATFORM_APPEND_ARGS }} --ci
env:
PLUGINS_TEST_CLI_VERSION: ${{ inputs.cli-version }}
PLUGINS_TEST_CLI_PATH: ${{ env.CLI_PATH }}
JEST_SUITE_NAME: Tool Tests
JEST_JUNIT_SUITE_NAME: "{title} ${{ runner.os }} ${{ inputs.ref-type }}"
- name: Upload results
# TODO(Tyler): Add upload on MacOS/Windows once the action supports it.
if: "!cancelled() && runner.os == 'Linux'"
uses: trunk-io/analytics-uploader@main
with:
junit-paths: junit.xml
org-slug: trunk-staging-org
token: ${{ inputs.trunk-token }}
continue-on-error: true
env:
TRUNK_PUBLIC_API_ADDRESS: https://api.trunk-staging.io