name: mingw-w64
on:
push:
branches: [master]
pull_request:
branches: [master]
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
build:
permissions:
contents: read
runs-on: windows-latest
defaults:
run:
shell: msys2 {0}
steps:
- uses: msys2/setup-msys2@v2
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Compute version
id: version
run: |
VERSION=$(bash scripts/compute-version.sh)
echo "VERSION=$VERSION" >> "$GITHUB_ENV"
echo "version=$VERSION" >> "$GITHUB_OUTPUT"
echo "Computed version: $VERSION"
- name: Install dependencies
run: pacman -S --noconfirm base-devel mingw-w64-x86_64-toolchain cmake ninja python
- name: Build with mingw-w64
run: |
CC=/mingw64/bin/cc CXX=/mingw64/bin/c++ cmake \
-B build -G Ninja \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_PREFIX=$PWD/install \
-DENABLE_GTEST=ON \
-DBUILD_OPENCC_JIEBA_PLUGIN=ON \
-DBUILD_SHARED_LIBS=OFF
cmake --build build
cmake --install build
- name: Run test
run: |
cd build
ctest
- name: Test standalone plugin build
run: |
CC=/mingw64/bin/cc CXX=/mingw64/bin/c++ cmake \
-S plugins/jieba -B build-standalone -G Ninja \
-DCMAKE_BUILD_TYPE=Release \
-DOpenCC_DIR=$PWD/install/lib/cmake/opencc
cmake --build build-standalone
- name: list installed files
if: ${{ always() }}
run: |
echo "=== Contents of install/bin ==="
if [ -d install/bin ]; then ls -lh install/bin/; fi
echo -e "\n=== Contents of install/share/opencc ==="
if [ -d install/share/opencc ]; then ls -lh install/share/opencc/; fi
echo -e "\n=== All installed files ==="
if [ -d install ]; then find install -type f; fi
- name: upload artifacts
if: ${{ always() }}
uses: actions/upload-artifact@v4
with:
name: opencc-${{ env.VERSION }}-mingw
path: |
install/**
build/src/tools/*.exe
build/Testing/**
build/ctest.log