remove i18n as feature #4
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: L10n (Localization) | |
| # spell-checker:ignore (people) reactivecircus Swatinem dtolnay | |
| # spell-checker:ignore (misc) noaudio pkill swiftshader esac sccache pcoreutils shopt subshell dequote | |
| on: | |
| pull_request: | |
| push: | |
| branches: | |
| - '*' | |
| env: | |
| # * style job configuration | |
| STYLE_FAIL_ON_FAULT: true ## (bool) fail the build if a style job contains a fault (error or warning); may be overridden on a per-job basis | |
| permissions: | |
| contents: read # to fetch code (actions/checkout) | |
| # End the current execution if there is a new changeset in the PR. | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.ref }} | |
| cancel-in-progress: ${{ github.ref != 'refs/heads/main' }} | |
| jobs: | |
| l10n_build_test: | |
| name: L10n/Build and Test | |
| runs-on: ${{ matrix.job.os }} | |
| env: | |
| SCCACHE_GHA_ENABLED: "true" | |
| RUSTC_WRAPPER: "sccache" | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| job: | |
| - { os: ubuntu-latest , features: "feat_os_unix" } | |
| - { os: macos-latest , features: "feat_os_macos" } | |
| - { os: windows-latest , features: "feat_os_windows" } | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| persist-credentials: false | |
| - uses: dtolnay/rust-toolchain@stable | |
| - uses: taiki-e/install-action@nextest | |
| - uses: Swatinem/rust-cache@v2 | |
| - name: Run sccache-cache | |
| uses: mozilla-actions/sccache-action@v0.0.9 | |
| - name: Install/setup prerequisites | |
| shell: bash | |
| run: | | |
| ## Install/setup prerequisites | |
| case '${{ matrix.job.os }}' in | |
| ubuntu-*) | |
| # selinux headers needed for testing | |
| sudo apt-get -y update ; sudo apt-get -y install libselinux1-dev | |
| ;; | |
| macos-*) | |
| # needed for testing | |
| brew install coreutils | |
| ;; | |
| esac | |
| - name: Build with l10n features | |
| shell: bash | |
| run: | | |
| ## Build with l10n features | |
| cargo build --features ${{ matrix.job.features }} | |
| - name: Test l10n functionality | |
| shell: bash | |
| run: | | |
| ## Test l10n functionality | |
| cargo test -p uucore locale | |
| cargo test | |
| env: | |
| RUST_BACKTRACE: "1" | |
| l10n_disable_test: | |
| name: L10n/Disabled Build Test | |
| runs-on: ${{ matrix.job.os }} | |
| env: | |
| SCCACHE_GHA_ENABLED: "true" | |
| RUSTC_WRAPPER: "sccache" | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| job: | |
| - { os: ubuntu-latest , features: "feat_os_unix,disable_i18n" } | |
| - { os: macos-latest , features: "feat_os_macos,disable_i18n" } | |
| - { os: windows-latest , features: "feat_os_windows,disable_i18n" } | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| persist-credentials: false | |
| - uses: dtolnay/rust-toolchain@stable | |
| - uses: taiki-e/install-action@nextest | |
| - uses: Swatinem/rust-cache@v2 | |
| - name: Run sccache-cache | |
| uses: mozilla-actions/sccache-action@v0.0.9 | |
| - name: Install/setup prerequisites | |
| shell: bash | |
| run: | | |
| ## Install/setup prerequisites | |
| case '${{ matrix.job.os }}' in | |
| ubuntu-*) | |
| # selinux headers needed for testing | |
| sudo apt-get -y update ; sudo apt-get -y install libselinux1-dev | |
| ;; | |
| macos-*) | |
| # needed for testing | |
| brew install coreutils | |
| ;; | |
| esac | |
| - name: Build without l10n features | |
| shell: bash | |
| run: | | |
| ## Build without l10n features | |
| cargo build --features ${{ matrix.job.features }} -p uucore | |
| - name: Test l10n disabled functionality | |
| shell: bash | |
| run: | | |
| ## Test l10n disabled functionality | |
| cargo test --features disable_i18n -p uucore locale | |
| cargo test --features disable_i18n | |
| env: | |
| RUST_BACKTRACE: "1" | |
| l10n_fluent_syntax: | |
| name: L10n/Fluent Syntax Check | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| persist-credentials: false | |
| - name: Setup Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: '3.x' | |
| - name: Install Mozilla Fluent Linter | |
| shell: bash | |
| run: | | |
| ## Install Mozilla Fluent Linter | |
| pip install moz-fluent-linter | |
| - name: Find and validate Fluent files | |
| shell: bash | |
| run: | | |
| ## Find and validate Fluent files with Mozilla Fluent Linter | |
| # Check if any .ftl files exist | |
| fluent_files=$(find . -name "*.ftl" -type f 2>/dev/null || true) | |
| if [ -z "$fluent_files" ]; then | |
| echo "::notice::No Fluent (.ftl) files found in the repository" | |
| exit 0 | |
| fi | |
| echo "Found Fluent files:" | |
| echo "$fluent_files" | |
| # Use Mozilla Fluent Linter for comprehensive validation | |
| echo "Running Mozilla Fluent Linter..." | |
| has_errors=false | |
| while IFS= read -r file; do | |
| echo "Checking $file with Mozilla Fluent Linter..." | |
| # Run fluent-linter on each file | |
| if ! python3 -m moz_fluent_linter "$file"; then | |
| echo "::error file=$file::Fluent syntax errors found in $file" | |
| has_errors=true | |
| else | |
| echo "✓ Fluent syntax check passed for $file" | |
| fi | |
| done <<< "$fluent_files" | |
| if [ "$has_errors" = true ]; then | |
| echo "::error::Fluent linting failed - please fix syntax errors" | |
| exit 1 | |
| fi | |
| echo "::notice::All Fluent files passed Mozilla Fluent Linter validation" | |
| l10n_feature_combinations: | |
| name: L10n/Feature Combinations | |
| runs-on: ubuntu-latest | |
| env: | |
| SCCACHE_GHA_ENABLED: "true" | |
| RUSTC_WRAPPER: "sccache" | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| persist-credentials: false | |
| - uses: dtolnay/rust-toolchain@stable | |
| - uses: Swatinem/rust-cache@v2 | |
| - name: Run sccache-cache | |
| uses: mozilla-actions/sccache-action@v0.0.9 | |
| - name: Install/setup prerequisites | |
| shell: bash | |
| run: | | |
| sudo apt-get -y update ; sudo apt-get -y install libselinux1-dev | |
| - name: Test feature combinations | |
| shell: bash | |
| run: | | |
| ## Test different l10n feature combinations | |
| echo "Testing with i18n enabled by default..." | |
| cargo check -p uucore | |
| echo "Testing with disable_i18n feature..." | |
| cargo check --features "disable_i18n" -p uucore | |
| echo "All feature combinations compiled successfully" | |
| env: | |
| RUST_BACKTRACE: "1" |