Skip to content

feat: msvc icu4c

feat: msvc icu4c #188

Workflow file for this run

name: Build
on:
workflow_dispatch:
pull_request:
push:
tags:
- "v*.*.*"
branches:
- main
jobs:
build:
name: ${{ matrix.job.target }} (${{ matrix.job.os }})
runs-on: ${{ matrix.job.os }}
# env:
# RUSTFLAGS: -Dwarnings
strategy:
fail-fast: false
matrix:
job:
- {
target: x86_64-pc-windows-gnu,
os: windows-2025,
bname: ewt.dll,
feature: icu_segmenter,
}
- {
target: x86_64-pc-windows-gnu,
os: windows-2025,
bname: ewt.dll,
feature: windows,
}
- {
target: x86_64-pc-windows-gnu,
os: windows-2025,
bname: ewt.dll,
feature: rust_icu_ubrk,
msystem: ucrt64,
hsystem: ucrt64,
}
- {
target: x86_64-pc-windows-msvc,
os: windows-11-arm,
bname: ewt.dll,
feature: icu_segmenter,
}
- {
target: x86_64-pc-windows-msvc,
os: windows-11-arm,
bname: ewt.dll,
feature: windows,
}
- {
target: x86_64-pc-windows-msvc,
os: windows-11-arm,
bname: ewt.dll,
feature: windows-icu,
}
- {
target: aarch64-pc-windows-msvc,
os: windows-11-arm,
bname: ewt.dll,
feature: icu_segmenter,
}
- {
target: aarch64-pc-windows-msvc,
os: windows-11-arm,
bname: ewt.dll,
feature: windows,
}
- {
target: aarch64-pc-windows-msvc,
os: windows-11-arm,
bname: ewt.dll,
feature: windows-icu,
}
- {
target: x86_64-pc-windows-gnullvm,
os: windows-2025,
bname: ewt.dll,
feature: icu_segmenter,
msystem: clang64,
hsystem: clang64,
}
- {
target: x86_64-pc-windows-gnullvm,
os: windows-2025,
bname: ewt.dll,
feature: windows,
msystem: clang64,
hsystem: clang64,
}
- {
target: x86_64-pc-windows-gnullvm,
os: windows-2025,
bname: ewt.dll,
feature: rust_icu_ubrk,
msystem: clang64,
hsystem: clang64,
}
- {
target: aarch64-pc-windows-gnullvm,
os: windows-2025,
bname: ewt.dll,
feature: icu_segmenter,
msystem: clangarm64,
hsystem: clang64,
}
- {
target: aarch64-pc-windows-gnullvm,
os: windows-2025,
bname: ewt.dll,
feature: windows,
msystem: clangarm64,
hsystem: clang64,
}
- {
target: aarch64-pc-windows-gnullvm,
os: windows-11-arm,
bname: ewt.dll,
feature: rust_icu_ubrk,
msystem: clangarm64,
hsystem: clangarm64,
}
- {
target: x86_64-unknown-linux-gnu,
os: ubuntu-24.04,
bname: libewt.so,
feature: icu_segmenter,
}
- {
target: aarch64-unknown-linux-gnu,
os: ubuntu-24.04-arm,
bname: libewt.so,
feature: icu_segmenter,
}
- {
target: riscv64gc-unknown-linux-gnu,
os: ubuntu-24.04-arm,
bname: libewt.so,
feature: icu_segmenter,
}
- {
target: x86_64-linux-android,
os: ubuntu-24.04,
bname: libewt.so,
feature: icu_segmenter,
}
- {
target: aarch64-linux-android,
os: ubuntu-24.04,
bname: libewt.so,
feature: icu_segmenter,
}
- {
target: x86_64-unknown-linux-gnu,
os: ubuntu-22.04,
bname: libewt.so,
feature: rust_icu_ubrk,
}
- {
target: aarch64-unknown-linux-gnu,
os: ubuntu-22.04-arm,
bname: libewt.so,
feature: rust_icu_ubrk,
}
- {
target: x86_64-unknown-linux-gnu,
os: ubuntu-24.04,
bname: libewt.so,
feature: rust_icu_ubrk,
}
- {
target: aarch64-unknown-linux-gnu,
os: ubuntu-24.04-arm,
bname: libewt.so,
feature: rust_icu_ubrk,
}
- {
target: x86_64-linux-android,
os: ubuntu-24.04,
bname: libewt.so,
feature: rust_icu_ubrk,
}
- {
target: aarch64-linux-android,
os: ubuntu-24.04,
bname: libewt.so,
feature: rust_icu_ubrk,
}
- {
target: x86_64-apple-darwin,
os: macos-26,
bname: libewt.dylib,
feature: icu_segmenter,
}
- {
target: aarch64-apple-darwin,
os: macos-26,
bname: libewt.dylib,
feature: icu_segmenter,
}
steps:
- name: Checkout source code
uses: actions/checkout@v6
- uses: actions/cache@v5
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: ${{ matrix.job.target }}-cargo-${{ hashFiles('**/Cargo.lock') }}-${{ matrix.job.feature }}-${{ matrix.job.os }}
- uses: taiki-e/install-action@v2
with:
tool: cargo-ndk
if: ${{ endsWith(matrix.job.target, 'android') }}
- name: Show version information (Rust, cargo)
run: |
rustup -V
rustup toolchain list
rustup target add ${{ matrix.job.target }}
cargo -V
rustc -V
- run: |
sudo apt-get update
sudo apt-get install crossbuild-essential-riscv64
if: ${{ matrix.job.target == 'riscv64gc-unknown-linux-gnu' }}
- uses: msys2/setup-msys2@v2
id: msys2
# Run only when having msystem variable
if: ${{ matrix.job.msystem != '' }}
with:
release: ${{ matrix.job.os == 'windows-11-arm' }}
update: true
msystem: ${{ matrix.job.msystem }}
pacboy: clang:p pkgconf:p ${{ matrix.job.os == 'windows-2025' && matrix.job.target == 'aarch64-pc-windows-gnullvm' && 'clang:c pkgconf:c' || '' }} ${{ matrix.job.feature == 'rust_icu_ubrk' && 'icu:p' || '' }}
- run: |
echo "${{ steps.msys2.outputs.msys2-location }}\${{ matrix.job.hsystem }}\bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
if: ${{ matrix.job.hsystem != '' }}
- run: |
where.exe clang
if: ${{ matrix.job.hsystem != '' }}
- run: |
where.exe icu-config
where.exe pkg-config
if: ${{ matrix.job.hsystem != '' && matrix.job.feature == 'rust_icu_ubrk' }}
# - run: |
# echo "ANDROID_NDK_LATEST_HOME = ${ANDROID_NDK_LATEST_HOME}"
# ${ANDROID_NDK_LATEST_HOME}/toolchains/llvm/prebuilt/linux-x86_64/bin/llvm-config --libdir
# echo "LIBCLANG_PATH=${ANDROID_NDK_LATEST_HOME}/toolchains/llvm/prebuilt/linux-x86_64/lib" >> "$GITHUB_ENV"
# echo "LD_LIBRARY_PATH=${ANDROID_NDK_LATEST_HOME}/toolchains/llvm/prebuilt/linux-x86_64/lib" >> "$GITHUB_ENV"
# if: ${{ endsWith(matrix.job.target, 'android') }}
- run: |
mkdir ${{ steps.msys2.outputs.msys2-location }}\clang64\lib\clang\22\lib\aarch64-w64-windows-gnu
cp ${{ steps.msys2.outputs.msys2-location }}\clangarm64\lib\clang\22\lib\windows\libclang_rt.builtins-aarch64.a ${{ steps.msys2.outputs.msys2-location }}\clang64\lib\clang\22\lib\aarch64-w64-windows-gnu\libclang_rt.builtins.a
if: ${{ matrix.job.msystem == 'clangarm64' && matrix.job.os == 'windows-2025' }}
- name: Build
env:
BINDGEN_EXTRA_CLANG_ARGS_X86_64_PC_WINDOWS_GNULLVM: -I"${{ steps.msys2.outputs.msys2-location }}\clang64\include" -I"${{ steps.msys2.outputs.msys2-location }}\clang64\lib\clang\22\include" --target=x86_64-w64-windows-gnu --sysroot=${{ steps.msys2.outputs.msys2-location }}\clang64
CARGO_TARGET_X86_64_PC_WINDOWS_GNULLVM_LINKER: ${{ steps.msys2.outputs.msys2-location }}\${{ matrix.job.hsystem }}\bin\clang.exe
CARGO_TARGET_X86_64_PC_WINDOWS_GNULLVM_RUSTFLAGS: -C link-arg=-fuse-ld=lld
BINDGEN_EXTRA_CLANG_ARGS_AARCH64_PC_WINDOWS_GNULLVM: -I"${{ steps.msys2.outputs.msys2-location }}\clangarm64\include" -I"${{ steps.msys2.outputs.msys2-location }}\clangarm64\lib\clang\22\include" --target=aarch64-w64-windows-gnu --sysroot=${{ steps.msys2.outputs.msys2-location }}\clangarm64
CARGO_TARGET_AARCH64_PC_WINDOWS_GNULLVM_LINKER: ${{ steps.msys2.outputs.msys2-location }}\${{ matrix.job.hsystem }}\bin\clang.exe
CARGO_TARGET_AARCH64_PC_WINDOWS_GNULLVM_RUSTFLAGS: -C link-arg=-fuse-ld=lld -C link-arg=--target=aarch64-w64-windows-gnu -C link-arg=--sysroot=${{ steps.msys2.outputs.msys2-location }}\clangarm64
CARGO_TARGET_RISCV64GC_UNKNOWN_LINUX_GNU_LINKER: riscv64-linux-gnu-gcc-13
# BINDGEN_EXTRA_CLANG_ARGS_X86_64_LINUX_ANDROID: -I"${{ env.ANDROID_NDK_LATEST_HOME }}/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/include" --target=x86_64-linux-android22 --sysroot=${{ env.ANDROID_NDK_LATEST_HOME }}/toolchains/llvm/prebuilt/linux-x86_64/sysroot
# CARGO_TARGET_X86_64_LINUX_ANDROID_AR: ${{ env.ANDROID_NDK_LATEST_HOME }}/toolchains/llvm/prebuilt/linux-x86_64/bin/llvm-ar
# CARGO_TARGET_X86_64_LINUX_ANDROID_LINKER: ${{ env.ANDROID_NDK_LATEST_HOME }}/toolchains/llvm/prebuilt/linux-x86_64/bin/clang
# BINDGEN_EXTRA_CLANG_ARGS_AARCH64_LINUX_ANDROID: -I"${{ env.ANDROID_NDK_LATEST_HOME }}/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/include" --target=aarch64-linux-android22 --sysroot=${{ env.ANDROID_NDK_LATEST_HOME }}/toolchains/llvm/prebuilt/linux-x86_64/sysroot
# CARGO_TARGET_AARCH64_LINUX_ANDROID_AR: ${{ env.ANDROID_NDK_LATEST_HOME }}/toolchains/llvm/prebuilt/linux-x86_64/bin/llvm-ar
# CARGO_TARGET_AARCH64_LINUX_ANDROID_LINKER: ${{ env.ANDROID_NDK_LATEST_HOME }}/toolchains/llvm/prebuilt/linux-x86_64/bin/clang
run: cargo build --locked --release --target=${{ matrix.job.target }} --no-default-features -F ${{ matrix.job.feature }}
if: ${{ !endsWith(matrix.job.target, 'android') }}
- name: Build Android
run: |
cargo ndk -P 32 -t ${{ matrix.job.target }} build --release -vv
if: ${{ endsWith(matrix.job.target, 'android') }}
- name: "Artifact upload"
uses: actions/upload-artifact@master
with:
name: libewt-${{ matrix.job.feature }}-${{ matrix.job.target }}${{ startsWith(matrix.job.os, 'ubuntu-22') && '-ubuntu-22.04' || '' }}
path: |
target/${{ matrix.job.target }}/release/${{ matrix.job.bname }}
release:
name: Release
needs: build
if: startsWith(github.ref, 'refs/tags/')
permissions:
contents: write
runs-on: ubuntu-slim
steps:
- name: Checkout source code
uses: actions/checkout@v6
- name: Download artifacts
uses: actions/download-artifact@v8
with:
path: download
- name: Create zip files
run: |
for f in download/*; do
7z a -tzip -mx=9 -r ${f}.zip ${f}/*
done
- name: Upload release
run: |
gh release create "${GITHUB_REF##*/}" download/*.zip -t "${GITHUB_REF##*/}" --generate-notes
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}