Repository navigation
127 lines (110 loc) · 3.87 KB
/
Copy pathci.yml
File metadata and controls
127 lines (110 loc) · 3.87 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
name: CI
on:
workflow_call:
inputs:
revision:
description: Exact commit to verify when called by release checks
required: false
type: string
default: ""
push:
branches: [main]
pull_request:
branches: [main]
permissions:
contents: read
jobs:
lint-workflows:
name: Lint Workflows
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4
with:
ref: ${{ inputs.revision || github.sha }}
persist-credentials: false
- name: Run actionlint
env:
ACTIONLINT_VERSION: 1.7.12
ACTIONLINT_SHA256: 8aca8db96f1b94770f1b0d72b6dddcb1ebb8123cb3712530b08cc387b349a3d8
run: |
curl --fail --location --silent --show-error \
"https://github.com/rhysd/actionlint/releases/download/v$ACTIONLINT_VERSION/actionlint_${ACTIONLINT_VERSION}_linux_amd64.tar.gz" \
--output actionlint.tar.gz
printf '%s actionlint.tar.gz\n' "$ACTIONLINT_SHA256" | sha256sum --check
tar --extract --gzip --file actionlint.tar.gz actionlint
./actionlint
test-action:
name: Test Action
runs-on: ubuntu-latest
needs: lint-workflows
timeout-minutes: 15
steps:
- name: Checkout
uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4
with:
ref: ${{ inputs.revision || github.sha }}
persist-credentials: false
- name: Setup pnpm
uses: pnpm/action-setup@b906affcce14559ad1aafd4ab0e942779e9f58b1 # v4
- name: Setup maintenance Node
uses: actions/setup-node@249970729cb0ef3589644e2896645e5dc5ba9c38 # v6
with:
node-version: 26
cache: pnpm
- name: Install checker dependencies
run: pnpm install --frozen-lockfile
- name: Check fixture and verification types
run: pnpm typecheck
- name: Test release helpers against local bare remotes
run: pnpm test:release
- name: Test default export and JSON result
id: default
uses: ./
with:
ts-file: .github/fixtures/default.ts
args: '{"message":"Hello from test! $(touch .github-script-args-executed)"}'
- name: Test named export, leading-dash literal entry and string result
id: named
uses: ./
with:
working-directory: .github/fixtures
ts-file: -literal $(touch .github-script-input-executed).ts
args: '{"message":"literal string result"}'
result-encoding: string
- name: Reject a missing entry
id: build-failure
continue-on-error: true
uses: ./
with:
ts-file: .github/fixtures/does-not-exist.ts
- name: Reject a missing callable export
id: export-failure
continue-on-error: true
uses: ./
with:
ts-file: .github/fixtures/missing-export.ts
- name: Reject invalid JSON arguments
id: args-failure
continue-on-error: true
uses: ./
with:
ts-file: .github/fixtures/default.ts
args: '{'
- name: Propagate a script error
id: script-failure
continue-on-error: true
uses: ./
with:
ts-file: .github/fixtures/throws.ts
- name: Verify results and failures
env:
DEFAULT_RESULT: ${{ steps.default.outputs.result }}
NAMED_RESULT: ${{ steps.named.outputs.result }}
EXPECTED_EVENT: ${{ github.event_name }}
EXPECTED_REPOSITORY: ${{ github.repository }}
BUILD_OUTCOME: ${{ steps.build-failure.outcome }}
EXPORT_OUTCOME: ${{ steps.export-failure.outcome }}
ARGS_OUTCOME: ${{ steps.args-failure.outcome }}
SCRIPT_OUTCOME: ${{ steps.script-failure.outcome }}
run: node .github/scripts/verify-action-result.ts