From 669d83b1a32f55c7af9aea2f58714f29181f6352 Mon Sep 17 00:00:00 2001 From: fxliang Date: Mon, 19 Feb 2024 11:35:49 +0800 Subject: [PATCH 1/2] cache librime when submodule, update release-ci.yml and commit-ci.yml bump librime to 1.10.0 bump plum to master HEAD --- .github/workflows/commit-ci.yml | 34 ++++++++++++++++++++++------ .github/workflows/release-ci.yml | 38 +++++++++++++++++++++++++++----- github.install.bat | 6 ++--- librime | 2 +- plum | 2 +- 5 files changed, 65 insertions(+), 17 deletions(-) diff --git a/.github/workflows/commit-ci.yml b/.github/workflows/commit-ci.yml index a20c380fc..991c4c0ff 100644 --- a/.github/workflows/commit-ci.yml +++ b/.github/workflows/commit-ci.yml @@ -27,10 +27,12 @@ jobs: submodules: recursive - name: Configure build environment + shell: bash run: | - copy env.vs2022.bat env.bat - $git_ref_name = git describe --always - echo "git_ref_name=$git_ref_name" >> $env:GITHUB_ENV + cp env.vs2022.bat env.bat + librime_id=$(git submodule foreach --quiet 'if [ $name == "librime" ]; then echo `git rev-parse HEAD`; fi') + echo "librime_id is $librime_id" + echo "librime_id=$librime_id" >> $GITHUB_ENV - name: Cache Boost id: cache-boost @@ -40,19 +42,28 @@ jobs: ${{ env.BOOST_ROOT }} key: ${{ runner.os }}-boost-${{ env.boost_version }} + # install boost if not cached - name: Install Boost if: steps.cache-boost.outputs.cache-hit != 'true' run: .\install_boost.bat + # add msbuild to PATH - name: Add msbuild to PATH uses: microsoft/setup-msbuild@v1.1.3 - - name: Copy Rime files - if: env.librime_build == 'stable' - run: .\github.install.bat + # cache librime + - name: Cache librime + if: env.librime_build == 'submodule' + id: cache-librime + uses: actions/cache@v3 + with: + path: | + librime + key: ${{ runner.os }}-librime-${{ env.librime_id }} + # build librime if not cached - name: Build librime - if: env.librime_build == 'submodule' + if: ${{ env.librime_build == 'submodule' && steps.cache-librime.outputs.cache-hit != 'true' }} env: RIME_PLUGINS: hchunhui/librime-lua lotem/librime-octagram rime/librime-predict shell: bash @@ -63,6 +74,15 @@ jobs: popd ./build.bat librime + # build librime if cached + - name: Copy librime built files cached + if: ${{ env.librime_build == 'submodule' && steps.cache-librime.outputs.cache-hit == 'true' }} + shell: bash + run: | + cp ./librime/dist/lib/rime* ./lib/ + cp ./librime/dist/lib/rime.dll ./output/ + cp ./librime/dist/include/*.h ./include/ + - name: Build Weasel id: build_weasel shell: bash diff --git a/.github/workflows/release-ci.yml b/.github/workflows/release-ci.yml index 63d25692e..2bfc66914 100644 --- a/.github/workflows/release-ci.yml +++ b/.github/workflows/release-ci.yml @@ -24,11 +24,14 @@ jobs: submodules: recursive - name: Configure build environment + shell: bash run: | - copy env.vs2022.bat env.bat - $git_ref_name = git describe --always - echo "git_ref_name=$git_ref_name" >> $env:GITHUB_ENV + cp env.vs2022.bat env.bat + librime_id=$(git submodule foreach --quiet 'if [ $name == "librime" ]; then echo `git rev-parse HEAD`; fi') + echo "librime_id is $librime_id" + echo "librime_id=$librime_id" >> $GITHUB_ENV + # cache boost - name: Cache Boost id: cache-boost uses: actions/cache@v3 @@ -37,20 +40,34 @@ jobs: ${{ env.BOOST_ROOT }} key: ${{ runner.os }}-boost-${{ env.boost_version }} + # install boost if not cached - name: Install Boost if: steps.cache-boost.outputs.cache-hit != 'true' run: .\install_boost.bat + # add msbuild to PATH - name: Add msbuild to PATH uses: microsoft/setup-msbuild@v1.1.3 + # use upper stream released librime files if stable release - name: Copy Rime files - if: env.librime_build == 'stable' + if: ${{ startsWith(github.ref, 'refs/tags/') || env.librime_build == 'stable' }} run: | .\github.install.bat + # cache librime for nightly build and not stable release + - name: Cache librime + if: ${{ github.ref == 'refs/heads/master' && env.librime_build == 'submodule' }} + id: cache-librime + uses: actions/cache@v3 + with: + path: | + librime + key: ${{ runner.os }}-librime-${{ env.librime_id }} + + # build librime if not cached for nightly build and not stable release - name: Build librime - if: env.librime_build == 'submodule' + if: ${{ github.ref == 'refs/heads/master' && env.librime_build == 'submodule' && steps.cache-librime.outputs.cache-hit != 'true' }} env: RIME_PLUGINS: hchunhui/librime-lua lotem/librime-octagram rime/librime-predict shell: bash @@ -61,6 +78,15 @@ jobs: popd ./build.bat librime + # build librime if cached + - name: Copy librime built files cached + if: ${{ github.ref == 'refs/heads/master' && env.librime_build == 'submodule' && steps.cache-librime.outputs.cache-hit == 'true' }} + shell: bash + run: | + cp ./librime/dist/lib/rime* ./lib/ + cp ./librime/dist/lib/rime.dll ./output/ + cp ./librime/dist/include/*.h ./include/ + - name: Build Weasel id: build_weasel shell: bash @@ -80,6 +106,7 @@ jobs: .\extract_changelog.ps1 if: startsWith(github.ref, 'refs/tags/') + # create nightly release - name: Create Nightly release if: github.ref == 'refs/heads/master' uses: 'marvinpinto/action-automatic-releases@latest' @@ -92,6 +119,7 @@ jobs: ./output/archives/weasel*.exe ./output/archives/symbols.zip + # create stable release - name: Release uses: softprops/action-gh-release@v1 if: startsWith(github.ref, 'refs/tags/') diff --git a/github.install.bat b/github.install.bat index f7256d04b..3bd54cf13 100644 --- a/github.install.bat +++ b/github.install.bat @@ -3,10 +3,10 @@ setlocal git submodule init git submodule update plum -set rime_version=1.9.0 +set rime_version=1.10.0 -set download_archive=rime-a608767-Windows-msvc.7z -set download_archive_deps=rime-deps-a608767-Windows-msvc.7z +set download_archive=rime-295cb2a-Windows-msvc.7z +set download_archive_deps=rime-deps-295cb2a-Windows-msvc.7z curl -LO https://github.com/rime/librime/releases/download/%rime_version%/%download_archive% curl -LO https://github.com/rime/librime/releases/download/%rime_version%/%download_archive_deps% diff --git a/librime b/librime index 6546689a2..295cb2ab6 160000 --- a/librime +++ b/librime @@ -1 +1 @@ -Subproject commit 6546689a2c9061860a0af5fa1209f9e8ea7d2132 +Subproject commit 295cb2ab68f89ee9d3237c7d4b8033bda3f3b635 diff --git a/plum b/plum index 9588b5af3..ff5cc1951 160000 --- a/plum +++ b/plum @@ -1 +1 @@ -Subproject commit 9588b5af3c1c0256df4f4d3b3eb508274a95dc42 +Subproject commit ff5cc1951c72192590dedc769770cc0b9926c007 From a2577c0cda9dddadda3a52fe524f2e5c196b76b2 Mon Sep 17 00:00:00 2001 From: fxliang Date: Mon, 19 Feb 2024 14:26:27 +0800 Subject: [PATCH 2/2] update actions version and setup-msbuild version --- .github/workflows/commit-ci.yml | 10 +++++----- .github/workflows/release-ci.yml | 8 ++++---- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/.github/workflows/commit-ci.yml b/.github/workflows/commit-ci.yml index 991c4c0ff..cab7a6935 100644 --- a/.github/workflows/commit-ci.yml +++ b/.github/workflows/commit-ci.yml @@ -22,7 +22,7 @@ jobs: BOOST_ROOT: ${{ github.workspace }}\deps\boost_1_83_0 steps: - name: Checkout last commit - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: submodules: recursive @@ -36,7 +36,7 @@ jobs: - name: Cache Boost id: cache-boost - uses: actions/cache@v3 + uses: actions/cache@v4 with: path: | ${{ env.BOOST_ROOT }} @@ -49,13 +49,13 @@ jobs: # add msbuild to PATH - name: Add msbuild to PATH - uses: microsoft/setup-msbuild@v1.1.3 + uses: microsoft/setup-msbuild@v2 # cache librime - name: Cache librime if: env.librime_build == 'submodule' id: cache-librime - uses: actions/cache@v3 + uses: actions/cache@v4 with: path: | librime @@ -97,7 +97,7 @@ jobs: Compress-Archive -Path output\*.pdb -CompressionLevel Optimal -DestinationPath .\output\archives\symbols.zip - name: Upload artifacts - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: if-no-files-found: error path: | diff --git a/.github/workflows/release-ci.yml b/.github/workflows/release-ci.yml index 2bfc66914..5147f5391 100644 --- a/.github/workflows/release-ci.yml +++ b/.github/workflows/release-ci.yml @@ -19,7 +19,7 @@ jobs: BOOST_ROOT: ${{ github.workspace }}\deps\boost_1_83_0 steps: - name: Checkout last commit - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: submodules: recursive @@ -34,7 +34,7 @@ jobs: # cache boost - name: Cache Boost id: cache-boost - uses: actions/cache@v3 + uses: actions/cache@v4 with: path: | ${{ env.BOOST_ROOT }} @@ -47,7 +47,7 @@ jobs: # add msbuild to PATH - name: Add msbuild to PATH - uses: microsoft/setup-msbuild@v1.1.3 + uses: microsoft/setup-msbuild@v2 # use upper stream released librime files if stable release - name: Copy Rime files @@ -59,7 +59,7 @@ jobs: - name: Cache librime if: ${{ github.ref == 'refs/heads/master' && env.librime_build == 'submodule' }} id: cache-librime - uses: actions/cache@v3 + uses: actions/cache@v4 with: path: | librime