Skip to content

[fst] Reduce number of WeightConvert specializations via partial specializations #1470

[fst] Reduce number of WeightConvert specializations via partial specializations

[fst] Reduce number of WeightConvert specializations via partial specializations #1470

# Copyright 2026 The OpenFst Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# See https://github.com/actions/runner-images.
name: "Bazel (x64 Windows)"
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
concurrency:
group: ${{github.workflow }}-${{github.head_ref || github.ref}}
cancel-in-progress: ${{github.ref != 'main'}}
# This gives read-only access to the token.
permissions: read-all
jobs:
build-and-test-x64-windows-bazel:
runs-on: windows-latest
timeout-minutes: 45
defaults:
run:
# PowerShell misparses flags like --flag=-value as parameter
# binding, so use bash where arguments are passed through as-is.
shell: bash
env:
USE_BAZEL_VERSION: 9.1.1
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- name: Setup Bazel
uses: bazel-contrib/setup-bazel@c5acdfb288317d0b5c0bbd7a396a3dc868bb0f86 # 0.19.0
with:
# Avoid downloading Bazel every time.
bazelisk-cache: true
# Store build cache per workflow. In addition to default files
# (MODULE.bazel, WORKSPACE, BUILD.bazel) hashed by setup-bazel,
# explicitly include .bazelrc and .bzl files in the cache key.
disk-cache: ${{github.workflow}}-${{hashFiles('.bazelrc', '**/*.bzl')}}
# Share repository cache between workflows.
repository-cache: true
- name: Check Bazelisk
run: bazelisk --version
- name: Build
# fastbuild uses /Z7 like dbg, which enables full debug info.
# https://github.com/bazelbuild/rules_cc/blob/538d89f8/cc/private/toolchain/windows_cc_toolchain_config.bzl#L550
# Full debug info takes ~1.8GB of cache space, so use opt, but with /O1
# (optimize for size) instead of /O2 (speed), which takes 300MB.
# /O1 is half the compilation speed of optimizations disabled, but
# runtime is 5x better. We take the run time under the assumption
# that most runs will be cached.
# TODO: This can be changed to fastbuild with rules_cc 0.2.19.
# https://github.com/bazelbuild/rules_cc/commit/06cda56
run: |
bazelisk build -c opt --copt=-O1 //...
- name: Test
run: >-
bazelisk test -c opt --copt=-O1
--test_size_filters=-enormous
--test_output=errors
--test_tag_filters=-no_windows_msvc
//...
- name: Disk cache size
if: always()
run: |
du -sh D:/_bazel-disk
echo "File count: $(find D:/_bazel-disk -type f | wc -l)"