forked from MBilalShafi/no-response-add-label
-
Notifications
You must be signed in to change notification settings - Fork 0
80 lines (69 loc) · 2.48 KB
/
test.yaml
File metadata and controls
80 lines (69 loc) · 2.48 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
name: Test
on:
pull_request:
push:
branches:
- main
jobs:
unitTest:
runs-on: ubuntu-latest
steps:
- name: Checkout
id: checkout
uses: actions/checkout@v6
- name: Setup Bun
id: setup_bun
uses: oven-sh/setup-bun@v2
- name: Regenerate lockfile (Dependabot only)
if: startsWith(github.head_ref, 'dependabot/')
shell: bash
run: bun install --lockfile-only
- name: Upload regenerated bun.lock
id: upload_regenerated-bun-lock
if: startsWith(github.head_ref, 'dependabot/')
uses: actions/upload-artifact@v7
with:
archive: false
overwrite: true
name: regenerated-bun-lock
path: bun.lock
- name: Ensure bun.lock exists
shell: bash
run: |
# Ensure a lockfile exists for the frozen install
test -s bun.lock || bun install --lockfile-only
- name: Install dependencies
shell: bash
run: |
# Install all dependencies (including dev) for CI/Tests
bun install --frozen-lockfile
- name: Test & Build Binary
shell: bash
run: |
# Run lint, format check, and bun test via your 'ci' script
bun run ci
# Verify compilation works
mkdir -p bin
bun build --compile --outfile bin/no-response-bin ./src/main.ts
chmod a+rx bin/no-response-bin
# Report the embedded Bun version using the Bun CLI mode
BUN_VERSION=$(BUN_BE_BUN=1 ./bin/no-response-bin --version)
echo "Binary successfully executed. Embedded Bun Version: $BUN_VERSION"
# Operational Validation
# Provide standard default inputs to trigger the internal logic.
# The binary should reach the 'token' requirement check and exit
# with code 1, confirming the TS bundle is intact and executable.
export INPUT_DAYSUNTILCLOSE="14"
export INPUT_RESPONSEREQUIREDLABEL="more-information-needed"
if OUTPUT="$(INPUT_TOKEN= ./bin/no-response-bin 2>&1)"; then
echo "Error: Binary exited with 0 but should have failed on missing token."
exit 1
else
RC=$?
case "${RC}|${OUTPUT}" in
(1|*token*)
echo "Operational test passed: Binary correctly reached internal config logic."
;;
(*) INPUT_TOKEN= ./bin/no-response-bin ;;
esac
fi