Debian Codegraph @

l10n/.github/workflows/ci.yml

raw
1 name: CI
2
3 on:
4 push:
5 branches: [ main ]
6 pull_request:
7 branches: [ main ]
8
9 jobs:
10 pre_commit:
11 name: Pre-commit hooks
12 runs-on: ubuntu-latest
13 steps:
14 - name: Checkout repository
15 uses: actions/checkout@v7
16 with:
17 persist-credentials: false
18 # pre-installed Rust and python are enough https://github.com/actions/runner-images/blob/main/images/ubuntu/Ubuntu2404-Readme.md
19 - name: Cache Rust dependencies
20 uses: Swatinem/rust-cache@v2
21
22 - name: Install pre-commit
23 run: pip install pre-commit
24
25 - name: Install cspell
26 run: npm install -g cspell
27
28 - name: Cache pre-commit environments
29 uses: actions/cache@v6
30 with:
31 path: ~/.cache/pre-commit
32 key: pre-commit-${{ runner.os }}-${{ hashFiles('.pre-commit-config.yaml') }}
33 restore-keys: |
34 pre-commit-${{ runner.os }}-
35
36 - name: Run pre-commit
37 run: pre-commit run
38
39 fluent_syntax:
40 name: Fluent Syntax Check
41 runs-on: ubuntu-latest
42 steps:
43 - uses: actions/checkout@v7
44 with:
45 persist-credentials: false
46 - name: Install Mozilla Fluent Linter
47 shell: bash
48 run: |
49 ## Install Mozilla Fluent Linter
50 pip install moz-fluent-linter
51 - name: Find and validate Fluent files
52 shell: bash
53 run: |
54
55 fluent_dirs=$(find . -name "*.ftl" -type f -exec dirname {} \; | sort | uniq 2>/dev/null || true)
56
57 if [ -n "$fluent_dirs" ]; then
58 echo "Found Fluent directories:"
59 echo "$fluent_dirs"
60
61 # Count total files for informational purposes
62 total_files=$(find . -name "*.ftl" -type f | wc -l)
63 echo "Total Fluent files: $total_files"
64 else
65 echo "::notice::No Fluent (.ftl) files found in the repository"
66 exit 0
67 fi
68
69 echo "Running Fluent Linter on directories..."
70
71 has_errors=false
72
73 while IFS= read -r dir; do
74 echo "Checking directory $dir with Fluent Linter..."
75
76 if ! moz-fluent-lint --config .github/fluent_linter_config.yml "$dir"; then
77 echo "::error::Fluent syntax errors found in $dir"
78 exit 1
79 else
80 echo "✓ Fluent syntax check passed for directory $dir"
81 fi
82
83 done <<< "$fluent_dirs"
84
85 echo "::notice::All Fluent directories passed Fluent Linter validation"