Skip to content

Commit db27729

Browse files
bordeuxclaude
andcommitted
feat: unified filter-functions architecture and packaging improvements
Major changes: Filter-Functions Architecture: - Add unified filter_functions module supporting both function and filter syntax - Migrate 50+ functions to new architecture (hash, encoding, math, string, array, datetime, path, URL, object, Kubernetes, serialization) - Example: {{ sha256(string="hello") }} AND {{ "hello" | sha256 }} New Functions: - get_interfaces() - list network interfaces with IP addresses - now() - returns Unix timestamp, optional format parameter - get_hour(), get_minute(), get_second() - datetime component extraction Packaging: - Add Nix flake support (flake.nix) - Add Windows MSI installer (WiX) - Add macOS DMG packaging (create-dmg.sh) CI/CD Improvements: - Extract build logic into reusable workflows - Run integration tests on built binaries - Enable QEMU testing for ARM64 binaries - Add pre-commit hook for cargo make qa 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
1 parent b568d29 commit db27729

64 files changed

Lines changed: 13826 additions & 3656 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Lines changed: 176 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,176 @@
1+
# Reusable workflow for building binaries across all platforms
2+
# Called by ci.yml and release.yml
3+
4+
name: Build Binaries
5+
6+
permissions:
7+
contents: read
8+
9+
on:
10+
workflow_call:
11+
inputs:
12+
upload-artifacts:
13+
description: 'Whether to upload artifacts'
14+
required: false
15+
default: true
16+
type: boolean
17+
artifact-retention-days:
18+
description: 'Number of days to retain artifacts'
19+
required: false
20+
default: 7
21+
type: number
22+
23+
jobs:
24+
build:
25+
name: Build ${{ matrix.target }}
26+
runs-on: ${{ matrix.os }}
27+
strategy:
28+
fail-fast: false
29+
matrix:
30+
include:
31+
- target: x86_64-unknown-linux-gnu
32+
os: ubuntu-22.04
33+
artifact_name: tmpltool
34+
asset_name: tmpltool-linux-x86_64
35+
can_test: true
36+
37+
- target: x86_64-unknown-linux-musl
38+
os: ubuntu-latest
39+
artifact_name: tmpltool
40+
asset_name: tmpltool-linux-x86_64-musl
41+
can_test: true
42+
43+
- target: aarch64-unknown-linux-gnu
44+
os: ubuntu-22.04
45+
artifact_name: tmpltool
46+
asset_name: tmpltool-linux-aarch64
47+
can_test: false # Dynamically linked, needs aarch64 glibc libs
48+
49+
- target: aarch64-unknown-linux-musl
50+
os: ubuntu-latest
51+
artifact_name: tmpltool
52+
asset_name: tmpltool-linux-aarch64-musl
53+
can_test: true
54+
use_qemu: true # Statically linked, works with QEMU
55+
56+
- target: x86_64-apple-darwin
57+
os: macos-latest
58+
artifact_name: tmpltool
59+
asset_name: tmpltool-macos-x86_64
60+
can_test: true # Rosetta 2 can run x86_64 on ARM runners
61+
62+
- target: aarch64-apple-darwin
63+
os: macos-latest
64+
artifact_name: tmpltool
65+
asset_name: tmpltool-macos-aarch64
66+
can_test: true # Native on ARM runners
67+
68+
- target: x86_64-pc-windows-msvc
69+
os: windows-latest
70+
artifact_name: tmpltool.exe
71+
asset_name: tmpltool-windows-x86_64.exe
72+
can_test: true
73+
74+
steps:
75+
- name: Checkout code
76+
uses: actions/checkout@v4
77+
78+
- name: Setup Rust
79+
uses: dtolnay/rust-toolchain@stable
80+
with:
81+
targets: ${{ matrix.target }}
82+
83+
- name: Install cross (Linux ARM)
84+
if: matrix.target == 'aarch64-unknown-linux-gnu' || matrix.target == 'aarch64-unknown-linux-musl'
85+
run: cargo install cross --git https://github.com/cross-rs/cross
86+
87+
- name: Install musl tools (Linux musl x86_64)
88+
if: matrix.target == 'x86_64-unknown-linux-musl'
89+
run: |
90+
sudo apt-get update
91+
sudo apt-get install -y musl-tools
92+
93+
- name: Cache cargo registry
94+
uses: actions/cache@v4
95+
with:
96+
path: ~/.cargo/registry
97+
key: ${{ runner.os }}-${{ matrix.target }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }}
98+
99+
- name: Cache cargo index
100+
uses: actions/cache@v4
101+
with:
102+
path: ~/.cargo/git
103+
key: ${{ runner.os }}-${{ matrix.target }}-cargo-git-${{ hashFiles('**/Cargo.lock') }}
104+
105+
- name: Cache cargo build
106+
uses: actions/cache@v4
107+
with:
108+
path: target
109+
key: ${{ runner.os }}-${{ matrix.target }}-cargo-build-target-${{ hashFiles('**/Cargo.lock') }}
110+
111+
- name: Build (cross)
112+
if: matrix.target == 'aarch64-unknown-linux-gnu' || matrix.target == 'aarch64-unknown-linux-musl'
113+
run: cross build --release --target ${{ matrix.target }}
114+
115+
- name: Build (cargo)
116+
if: matrix.target != 'aarch64-unknown-linux-gnu' && matrix.target != 'aarch64-unknown-linux-musl'
117+
run: cargo build --release --target ${{ matrix.target }}
118+
119+
- name: Strip binary (Linux/macOS)
120+
if: matrix.os != 'windows-latest'
121+
run: strip target/${{ matrix.target }}/release/${{ matrix.artifact_name }} || true
122+
123+
# Install QEMU for cross-architecture testing
124+
- name: Install QEMU (for ARM64 testing)
125+
if: matrix.use_qemu
126+
run: |
127+
sudo apt-get update
128+
sudo apt-get install -y qemu-user-static binfmt-support
129+
# Register QEMU as interpreter for aarch64 binaries
130+
sudo update-binfmts --enable qemu-aarch64
131+
132+
# Run integration tests on the built binary
133+
- name: Run integration tests
134+
if: matrix.can_test
135+
shell: bash
136+
run: |
137+
BINARY_PATH="./target/${{ matrix.target }}/release/${{ matrix.artifact_name }}"
138+
echo "Testing binary: $BINARY_PATH"
139+
140+
if [ "${{ matrix.use_qemu }}" = "true" ]; then
141+
echo "Using QEMU for aarch64 emulation"
142+
# With binfmt_misc registered, we can run the binary directly
143+
# The kernel will automatically invoke qemu-aarch64-static
144+
fi
145+
146+
bash tests/integration/test_binary.sh "$BINARY_PATH"
147+
148+
- name: Create archive (Linux/macOS)
149+
if: matrix.os != 'windows-latest'
150+
run: |
151+
cd target/${{ matrix.target }}/release
152+
tar czf ${{ matrix.asset_name }}.tar.gz ${{ matrix.artifact_name }}
153+
mv ${{ matrix.asset_name }}.tar.gz ../../..
154+
155+
- name: Create archive (Windows)
156+
if: matrix.os == 'windows-latest'
157+
shell: pwsh
158+
run: |
159+
cd target/${{ matrix.target }}/release
160+
Compress-Archive -Path ${{ matrix.artifact_name }} -DestinationPath ../../../${{ matrix.asset_name }}.zip
161+
162+
- name: Upload artifact (Linux/macOS)
163+
if: inputs.upload-artifacts && matrix.os != 'windows-latest'
164+
uses: actions/upload-artifact@v4
165+
with:
166+
name: ${{ matrix.asset_name }}
167+
path: ${{ matrix.asset_name }}.tar.gz
168+
retention-days: ${{ inputs.artifact-retention-days }}
169+
170+
- name: Upload artifact (Windows)
171+
if: inputs.upload-artifacts && matrix.os == 'windows-latest'
172+
uses: actions/upload-artifact@v4
173+
with:
174+
name: ${{ matrix.asset_name }}
175+
path: ${{ matrix.asset_name }}.zip
176+
retention-days: ${{ inputs.artifact-retention-days }}

0 commit comments

Comments
 (0)