Skip to content

Commit fcff7b2

Browse files
authored
Add GitHub Actions workflow for build validation (#39)
* Add GitHub Actions workflow for build validation Runs HEMTT check and build on PRs and pushes to main to ensure: - Code passes linting checks - Project builds successfully Build artifacts are uploaded for 7 days for testing. * test: Add lint warning to test CI workflow * revert: Remove test lint warning * Fail CI on critical lint warnings (PW1, PW3, FNL) - Update workflow to check for critical warnings that indicate code issues - Suppress optimization suggestions (if_assign, select_parse_number) in project.toml - Critical warnings: PW1 (macro redefinition), PW3 (macro padding), FNL (missing newline) * test: Add PW3 warning to verify CI fails * revert: Remove test PW3 warning * Fail on all warnings except L-S29 L-S29 warnings are false positives for functions that are dynamically defined at runtime via missionNamespace setVariable.
1 parent aa95711 commit fcff7b2

2 files changed

Lines changed: 47 additions & 0 deletions

File tree

.github/workflows/build.yml

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
name: Build
2+
3+
on:
4+
push:
5+
branches: [main]
6+
pull_request:
7+
branches: [main]
8+
9+
jobs:
10+
build:
11+
runs-on: ubuntu-latest
12+
13+
steps:
14+
- name: Checkout repository
15+
uses: actions/checkout@v4
16+
17+
- name: Setup HEMTT
18+
uses: arma-actions/hemtt@v1
19+
20+
- name: Run HEMTT check
21+
run: |
22+
# Run hemtt check and capture output
23+
OUTPUT=$(hemtt check 2>&1) || true
24+
echo "$OUTPUT"
25+
26+
# Filter out L-S29 (false positives for dynamically defined functions)
27+
# and fail if any other warnings remain
28+
WARNINGS=$(echo "$OUTPUT" | grep -E "warning\[" | grep -v "L-S29" || true)
29+
if [ -n "$WARNINGS" ]; then
30+
echo ""
31+
echo "::error::Lint warnings found:"
32+
echo "$WARNINGS"
33+
exit 1
34+
fi
35+
36+
- name: Run HEMTT build
37+
run: hemtt build
38+
39+
- name: Upload build artifacts
40+
uses: actions/upload-artifact@v4
41+
with:
42+
name: ocap-build
43+
path: .hemttout/build/
44+
retention-days: 7

.hemtt/project.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,3 +15,6 @@ command_case = false
1515
banned_commands = false
1616
undefined = false
1717
format_args = false
18+
# Optimization suggestions - not critical
19+
if_assign = false
20+
select_parse_number = false

0 commit comments

Comments
 (0)