Skip to content

Commit dd57c45

Browse files
committed
ci: add some build output validations
There have been previous times where some things went amiss with the build output based on build config. In particular types not being exported. By adding an explicit assertion on the output export line, if something changes, this will force it to be manually verified.
1 parent 566b7ef commit dd57c45

File tree

1 file changed

+31
-1
lines changed

1 file changed

+31
-1
lines changed

.github/workflows/ci.yml

Lines changed: 31 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,9 @@ jobs:
1414
build:
1515
name: Build
1616
runs-on: ubuntu-latest
17-
17+
env:
18+
EXPECTED_EXPORT_LINE_LENGTH: 528
19+
EXPECTED_FILE_COUNT: 4
1820
steps:
1921
- name: Checkout csrf-csrf
2022
uses: actions/checkout@v4
@@ -30,6 +32,34 @@ jobs:
3032
- name: Build
3133
run: npm run build --if-present
3234

35+
- name: Check number of output files
36+
run: |
37+
output_file_count=$(ls -l ./dist | grep "^-" | wc -l)
38+
if [ "$output_file_count" -ne 4 ]; then
39+
echo "Error: Output file count is $output_file_count, expected 4"
40+
exit 1
41+
else
42+
echo "Output file count is as expected"
43+
fi
44+
45+
- name: Check export line length for index.d.ts
46+
run: |
47+
export_line=$(tail -n 2 dist/index.d.ts | head -n 2)
48+
export_line_length=${#export_line}
49+
if [ "$export_line_length" -ne $EXPECTED_EXPORT_LINE_LENGTH ]; then
50+
echo "Error: Export line length is $export_line_length, expected $EXPECTED_EXPORT_LINE_LENGTH"
51+
exit 1
52+
fi
53+
54+
- name: Check export line length for index.d.cts
55+
run: |
56+
export_line=$(tail -n 2 dist/index.d.ts | head -n 2)
57+
export_line_length=${#export_line}
58+
if [ "$export_line_length" -ne $EXPECTED_EXPORT_LINE_LENGTH ]; then
59+
echo "Error: Export line length is $export_line_length, expected $EXPECTED_EXPORT_LINE_LENGTH"
60+
exit 1
61+
fi
62+
3363
lint:
3464
name: Lint
3565
runs-on: ubuntu-latest

0 commit comments

Comments
 (0)