From 580b79e9e38ce99d77df792e63ce48bdf3022873 Mon Sep 17 00:00:00 2001 From: Wenhao Jiang Date: Tue, 21 Jan 2025 23:13:41 +0800 Subject: [PATCH 1/4] build: update workflow and change to the new ARM64 runner --- .github/workflows/main.yml | 74 +------------------------------------- 1 file changed, 1 insertion(+), 73 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 54d516f..6ba84ef 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -126,79 +126,6 @@ jobs: env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - # copy from https://github.com/Cyan4973/xxHash/blob/dev/.github/workflows/ci.yml - # Linux ARM64 - # All tests are using QEMU and gcc cross compiler. - - qemu-consistency: - name: QEMU ${{ matrix.name }} - needs: Linux - runs-on: ${{ matrix.os }} - strategy: - fail-fast: true # 'false' means Don't stop matrix workflows even if some matrix failed. - matrix: - include: [ - { name: 'ARM64', xcc_pkg: gcc-aarch64-linux-gnu, xcc: aarch64-linux-gnu-gcc, xemu_pkg: qemu-system-arm, xemu: qemu-aarch64-static, os: ubuntu-latest, }, - - { name: 'ARM64, gcc-9', xcc_pkg: gcc-9-aarch64-linux-gnu, xcc: aarch64-linux-gnu-gcc-9, xemu_pkg: qemu-system-arm, xemu: qemu-aarch64-static, os: ubuntu-20.04, }, - ] - env: # Set environment variables - CC: ${{ matrix.xcc }} - XEMU: ${{ matrix.xemu }} - # LDFLAGS: -static - steps: - - uses: actions/checkout@v2 # https://github.com/actions/checkout - - name: apt update & install (1) - run: | - sudo apt-get update - sudo apt-get install gcc-multilib g++-multilib qemu-utils qemu-user-static - - name: Environment info (1) - run: | - echo && apt-cache search "^gcc-" | grep "linux" | sort - - name: apt update & install (2) - run: | - sudo apt-get install ${{ matrix.xcc_pkg }} ${{ matrix.xemu_pkg }} - - name: Environment info (2) - run: | - echo && which $CC - echo && $CC --version - echo && $CC -v # Show built-in specs - echo && which $XEMU - echo && $XEMU --version - - name: ARM64 - uses: lukka/run-cmake@v3 - with: - cmakeListsOrSettingsJson: CMakeListsTxtAdvanced - cmakeListsTxtPath: '${{ github.workspace }}/CMakeLists.txt' - cmakeBuildType: 'Release' - buildDirectory: "${{ github.workspace }}/build" - buildWithCMake: true - buildWithCMakeArgs: --config Release - # cmakeAppendedArgs: " -DCODE_COVERAGE=OFF -DBUILD_SHELL=OFF -DBUILD_TEST_EXAMPLE=OFF -DBUILD_STATIC" - cmakeAppendedArgs: " -DCODE_COVERAGE=OFF -DBUILD_SHELL=OFF -DBUILD_TEST_EXAMPLE=OFF" - - name: "Check file existence" - uses: andstor/file-existence-action@v1 - with: - allow_failure: true - # files: "${{ github.workspace }}/build/src/libsimple.a, ${{ github.workspace }}/build/src/libPINYIN_TEXT.a, ${{ github.workspace }}/build/test/dict/jieba.dict.utf8" - files: "${{ github.workspace }}/build/src/libsimple.so, ${{ github.workspace }}/build/test/dict/jieba.dict.utf8" - - name: Package - if: startsWith(github.ref, 'refs/tags/') - run: | - mkdir libsimple-${{ matrix.xcc }} - # cp -r src/libsimple.a src/libPINYIN_TEXT.a test/dict/ libsimple-linux-${{ matrix.xcc }}/ - cp -r src/libsimple.so test/dict/ libsimple-${{ matrix.xcc }}/ - zip -r libsimple-${{ matrix.xcc }}.zip libsimple-${{ matrix.xcc }} - working-directory: "${{ github.workspace }}/build" - - name: Release - if: startsWith(github.ref, 'refs/tags/') - uses: softprops/action-gh-release@v1 - with: - draft: true - files: ${{ github.workspace }}/build/libsimple-${{ matrix.xcc }}.zip - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - Linux: runs-on: ${{ matrix.os }} strategy: @@ -206,6 +133,7 @@ jobs: matrix: include: - os: ubuntu-20.04 + - os: ubuntu-22.04-arm - os: ubuntu-latest steps: - name: "Release Build Type" From 36ca4a942a545942113ca9fb72a0fd68159c3f62 Mon Sep 17 00:00:00 2001 From: wangfenjin Date: Wed, 22 Jan 2025 14:28:37 +0800 Subject: [PATCH 2/4] ignore lcov error --- .github/workflows/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 6ba84ef..7ecff86 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -189,7 +189,7 @@ jobs: # CODE COVERAGE - name: Code coverage - Capture coverage info if: ${{ startsWith(github.ref, 'refs/tags/') != true && matrix.os == 'ubuntu-latest' }} - run: lcov --directory . --capture --output-file coverage.info + run: lcov --directory . --capture --ignore-errors mismatch --output-file coverage.info - name: Code coverage - Filter out system, external, and unit test source files if: ${{ startsWith(github.ref, 'refs/tags/') != true && matrix.os == 'ubuntu-latest' }} run: lcov --remove coverage.info --output-file coverage_filter.info '/Library/*' '/usr/*' '*/test/*' '*/cmrc/*' '*/entry.cc' '*/simple_highlight.*' From c28bd6d88fa3c0a012f97a3c8d21880994b6019b Mon Sep 17 00:00:00 2001 From: wangfenjin Date: Wed, 22 Jan 2025 14:51:40 +0800 Subject: [PATCH 3/4] Revert "ignore lcov error" This reverts commit 36ca4a942a545942113ca9fb72a0fd68159c3f62. --- .github/workflows/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 7ecff86..6ba84ef 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -189,7 +189,7 @@ jobs: # CODE COVERAGE - name: Code coverage - Capture coverage info if: ${{ startsWith(github.ref, 'refs/tags/') != true && matrix.os == 'ubuntu-latest' }} - run: lcov --directory . --capture --ignore-errors mismatch --output-file coverage.info + run: lcov --directory . --capture --output-file coverage.info - name: Code coverage - Filter out system, external, and unit test source files if: ${{ startsWith(github.ref, 'refs/tags/') != true && matrix.os == 'ubuntu-latest' }} run: lcov --remove coverage.info --output-file coverage_filter.info '/Library/*' '/usr/*' '*/test/*' '*/cmrc/*' '*/entry.cc' '*/simple_highlight.*' From c869f67002a88159a006997990a881b0db15a5f3 Mon Sep 17 00:00:00 2001 From: Wenhao Jiang Date: Wed, 22 Jan 2025 21:30:56 +0800 Subject: [PATCH 4/4] fix: add the --ignore-errors option to fix error handling in the code coverage collection --- .github/workflows/main.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 6ba84ef..2d3b77b 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -189,10 +189,10 @@ jobs: # CODE COVERAGE - name: Code coverage - Capture coverage info if: ${{ startsWith(github.ref, 'refs/tags/') != true && matrix.os == 'ubuntu-latest' }} - run: lcov --directory . --capture --output-file coverage.info + run: lcov --directory . --capture --output-file coverage.info --ignore-errors mismatch - name: Code coverage - Filter out system, external, and unit test source files if: ${{ startsWith(github.ref, 'refs/tags/') != true && matrix.os == 'ubuntu-latest' }} - run: lcov --remove coverage.info --output-file coverage_filter.info '/Library/*' '/usr/*' '*/test/*' '*/cmrc/*' '*/entry.cc' '*/simple_highlight.*' + run: lcov --remove coverage.info --output-file coverage_filter.info '/Library/*' '/usr/*' '*/test/*' '*/cmrc/*' '*/entry.cc' '*/simple_highlight.*' --ignore-errors unused - name: Code coverage - Output coverage data for debugging if: ${{ startsWith(github.ref, 'refs/tags/') != true && matrix.os == 'ubuntu-latest' }} run: lcov --list coverage_filter.info