Skip to content

Commit dae69da

Browse files
authored
Attempt to automatically validate all configurations (#1403)
1 parent 4b54afb commit dae69da

File tree

2 files changed

+78
-1
lines changed

2 files changed

+78
-1
lines changed
Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
name: Config Validation
2+
3+
on:
4+
pull_request:
5+
paths:
6+
- 'examples/**/*.yaml'
7+
- 'examples/**/*.yml'
8+
- 'lading/**'
9+
- '.github/workflows/config-validation.yml'
10+
push:
11+
branches:
12+
- main
13+
paths:
14+
- 'examples/**/*.yaml'
15+
- 'examples/**/*.yml'
16+
- 'lading/**'
17+
- '.github/workflows/config-validation.yml'
18+
19+
jobs:
20+
generate-matrix:
21+
name: Generate Config Matrix
22+
runs-on: ubuntu-latest
23+
outputs:
24+
matrix: ${{ steps.set-matrix.outputs.matrix }}
25+
steps:
26+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
27+
- id: set-matrix
28+
run: |
29+
# Find all YAML files in examples directory
30+
configs=$(find examples -name "*.yaml" -o -name "*.yml" | sort | jq -R -s -c 'split("\n")[:-1]')
31+
echo "matrix={\"config\":$configs}" >> $GITHUB_OUTPUT
32+
echo "Found configs: $configs"
33+
34+
build:
35+
name: Build lading binary
36+
runs-on: ubuntu-latest
37+
steps:
38+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
39+
- uses: actions-rust-lang/setup-rust-toolchain@1fbea72663f6d4c03efaab13560c8a24cfd2a7cc # v1.9.0
40+
with:
41+
cache: true
42+
- uses: taiki-e/install-action@7e58f89e24a544d88f7a74c6eed8a3df3fd4c658 # v2.44.60
43+
with:
44+
tool: nextest@0.9.72
45+
- name: Install Protobuf
46+
uses: ./.github/actions/install-protobuf
47+
- name: Install FUSE
48+
uses: ./.github/actions/install-fuse
49+
- name: Build lading binary
50+
run: cargo build --bin=lading --all-features
51+
- name: Upload binary artifact
52+
uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4.4.3
53+
with:
54+
name: lading-binary
55+
path: target/debug/lading
56+
57+
validate-configs:
58+
name: Validate ${{ matrix.config }}
59+
runs-on: ubuntu-latest
60+
needs: [generate-matrix, build]
61+
strategy:
62+
fail-fast: false
63+
matrix: ${{fromJson(needs.generate-matrix.outputs.matrix)}}
64+
steps:
65+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
66+
- name: Download binary artifact
67+
uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8
68+
with:
69+
name: lading-binary
70+
path: target/debug/
71+
- name: Make binary executable
72+
run: chmod +x target/debug/lading
73+
- name: Validate config
74+
run: |
75+
echo "Validating: ${{ matrix.config }}"
76+
./target/debug/lading config-check --config-path="${{ matrix.config }}"

examples/lading-logrotatefs.yaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@ generator:
88
total_rotations: 4
99
max_depth: 0
1010
variant: "ascii"
11-
bytes_per_second: 1.3MiB
11+
load_profile:
12+
constant: 1.3MiB
1213
maximum_prebuild_cache_size_bytes: 1GiB
1314
mount_point: /tmp/logrotate
1415

0 commit comments

Comments
 (0)