Replace boost filesystem with std filesystem #1
Workflow file for this run
This file contains 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: Windows build | |
on: | |
workflow_call: | |
inputs: | |
repository: | |
default: ${{ github.repository }} | |
required: false | |
type: string | |
rime_plugins: | |
required: false | |
type: string | |
jobs: | |
build: | |
runs-on: windows-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
compiler: [msvc, clang] | |
env: | |
boost_version: 1.83.0 | |
BOOST_ROOT: ${{ github.workspace }}\deps\boost_1_83_0 | |
build_script: ${{ matrix.compiler == 'msvc' && './build.bat' || './build-clang.bat' }} | |
RIME_PLUGINS: ${{ inputs.rime_plugins }} | |
steps: | |
- name: Checkout last commit | |
uses: actions/checkout@v4 | |
with: | |
repository: ${{ inputs.repository }} | |
submodules: recursive | |
- name: Create env.bat | |
if: ${{ matrix.compiler == 'msvc' }} | |
run: | | |
$envfile = ".\env.bat" | |
$envcontent = @" | |
set RIME_ROOT=%CD% | |
if not defined BOOST_ROOT set BOOST_ROOT=%RIME_ROOT%\deps\boost_1_83_0 | |
set CXX=cl | |
set CC=cl | |
set CMAKE_GENERATOR=Ninja | |
"@ | |
Set-Content -Path $envfile -Value $envcontent | |
cat $envfile | |
- name: Configure MSVC | |
if: ${{ matrix.compiler == 'msvc' }} | |
uses: ilammy/msvc-dev-cmd@v1 | |
with: | |
arch: x86 | |
- name: Configure Ninja | |
run: pip install ninja | |
- name: Configure clang | |
if: ${{ matrix.compiler == 'clang' }} | |
run: choco upgrade -y llvm | |
- name: Configure build environment | |
run: | | |
$git_ref_name = git describe --always | |
echo "git_ref_name=$git_ref_name" >> $env:GITHUB_ENV | |
git submodule > submodule-status | |
- name: Cache Boost source | |
id: cache-boost-src | |
uses: actions/cache@v3 | |
with: | |
path: | | |
${{ env.BOOST_ROOT }}.7z | |
key: ${{ runner.os }}-boost-${{ env.boost_version }}-${{ matrix.compiler }}-src | |
- name: Download Boost source | |
if: steps.cache-boost-src.outputs.cache-hit != 'true' | |
run: | | |
aria2c https://boostorg.jfrog.io/artifactory/main/release/1.83.0/source/boost_1_83_0.7z -d deps | |
- name: Extract Boost source tarball | |
run: | | |
pushd deps | |
7z x ${{ env.BOOST_ROOT }}.7z | |
popd | |
- name: Cache Boost lib | |
id: cache-boost-lib | |
uses: actions/cache@v3 | |
with: | |
path: | | |
${{ env.BOOST_ROOT }}\stage | |
key: ${{ runner.os }}-boost-${{ env.boost_version }}-${{ matrix.compiler }}-lib | |
- name: Install Boost | |
if: steps.cache-boost-lib.outputs.cache-hit != 'true' | |
run: ${{ env.build_script }} boost | |
- name: Cache dependencies | |
id: cache-deps | |
uses: actions/cache@v3 | |
with: | |
path: | | |
bin | |
include | |
lib | |
share | |
key: ${{ runner.os }}-${{ matrix.compiler }}-${{ hashFiles('submodule-status') }} | |
- name: Build dependencies | |
if: steps.cache-deps.outputs.cache-hit != 'true' | |
run: ${{ env.build_script }} deps | |
- name: Install Rime plugins | |
run: .\action-install-plugins-windows.bat | |
- name: Build and test | |
run: ${{ env.build_script }} test | |
- name: Create distributable | |
run: | | |
7z a rime-${{ env.git_ref_name }}-${{ runner.os }}-${{ matrix.compiler }}.7z ` | |
dist version-info.txt | |
7z a -x'!*/.placeholder' rime-deps-${{ env.git_ref_name }}-${{ runner.os }}-${{ matrix.compiler }}.7z ` | |
bin include lib share | |
- name: Upload artifacts | |
uses: actions/upload-artifact@v3 | |
with: | |
path: | | |
rime-${{ env.git_ref_name }}-${{ runner.os }}-${{ matrix.compiler }}.7z | |
rime-deps-${{ env.git_ref_name }}-${{ runner.os }}-${{ matrix.compiler }}.7z | |
build-mingw: | |
runs-on: windows-latest | |
env: | |
RIME_PLUGINS: ${{ inputs.rime_plugins }} | |
defaults: | |
run: | |
shell: msys2 {0} | |
steps: | |
- name: Install dependencies with MSYS2 | |
uses: msys2/setup-msys2@v2 | |
with: | |
release: false | |
update: true | |
msystem: UCRT64 | |
install: >- | |
git | |
base-devel | |
mingw-w64-ucrt-x86_64-boost | |
mingw-w64-ucrt-x86_64-glog | |
mingw-w64-ucrt-x86_64-gtest | |
mingw-w64-ucrt-x86_64-yaml-cpp | |
mingw-w64-ucrt-x86_64-leveldb | |
mingw-w64-ucrt-x86_64-marisa | |
mingw-w64-ucrt-x86_64-opencc | |
pacboy: >- | |
toolchain:p | |
cmake:p | |
ninja:p | |
- name: Checkout last commit | |
run: git config --global core.autocrlf input | |
uses: actions/checkout@v4 | |
with: | |
repository: ${{ inputs.repository }} | |
- name: Configure build environment | |
run: | | |
echo git_ref_name="$(git describe --always)" >> $GITHUB_ENV | |
- name: Install Rime plugins | |
run: ./action-install-plugins-macos.sh | |
- name: Build with mingw-w64 | |
run: | | |
cmake -B build -G Ninja \ | |
-DCMAKE_INSTALL_PREFIX:PATH=`pwd`/dist \ | |
-DCMAKE_BUILD_TYPE:STRING=Release \ | |
-DENABLE_LOGGING:BOOL=ON \ | |
-DBUILD_TEST:BOOL=ON \ | |
-DBUILD_STATIC:BOOL=ON \ | |
-DBUILD_SHARED_LIBS:BOOL=ON | |
cmake --build build | |
cmake --install build | |
cd build/test && cp ../lib/librime.dll . && ./rime_test | |
- name: Create distributable | |
run: | | |
tar -cjvf rime-${{ env.git_ref_name }}-${{ runner.os }}-mingw.tar.bz2 \ | |
dist version-info.txt | |
tar -cjvf rime-deps-${{ env.git_ref_name }}-${{ runner.os }}-mingw.tar.bz2 \ | |
--exclude '*/.placeholder' \ | |
bin include lib share | |
- name: Upload artifacts | |
uses: actions/upload-artifact@v3 | |
with: | |
path: | | |
rime-${{ env.git_ref_name }}-${{ runner.os }}-mingw.tar.bz2 |