Skip to content

Commit 71a4906

Browse files
committed
Update CI workflows to install gawk and modify check command for UTF-8 support
The `make check`used to suppose that every chinese character is composed by 3 bytes when it is utf8 encoding. However, 𰻝 has 4 bytes.
1 parent cd2c344 commit 71a4906

3 files changed

Lines changed: 16 additions & 5 deletions

File tree

.github/workflows/continuous-build-data.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,19 @@ jobs:
1313
build:
1414
name: Build phrase database
1515
runs-on: ubuntu-latest
16+
env:
17+
LANG: en_US.UTF-8
18+
LC_ALL: en_US.UTF-8
1619
steps:
1720
- uses: actions/checkout@v5
1821
- uses: actions/setup-python@v6
1922
with:
2023
python-version: '3.12'
24+
- name: Install dependencies and configure locale
25+
run: |
26+
sudo apt-get update
27+
sudo apt-get install -y gawk locales
28+
sudo locale-gen en_US.UTF-8
2129
- name: Test data files
2230
run: make check
2331
working-directory: Source/Data

.github/workflows/continuous-integration-workflow-xcode-latest.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,8 @@ jobs:
8888
run: xcodebuild -scheme McBopomofo -configuration Release build
8989
- name: Build McBopomofoInstaller
9090
run: xcodebuild -scheme McBopomofoInstaller -configuration Release build
91+
- name: Install gawk
92+
run: brew install gawk
9193
- name: Test data files
9294
run: make check
9395
working-directory: Source/Data

Source/Data/Makefile

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -61,12 +61,13 @@ sort:
6161
@mv tmp exclusion.txt
6262

6363
check: SHELL:=/bin/bash
64-
check: export LC_ALL=C
64+
check: export LC_ALL=en_US.UTF-8
6565
check:
66-
@awk 'length($$1)/3!=NF-1' BPMFMappings.txt
67-
@awk '{print $$2,$$3,$$4,$$5,$$6,$$7}' BPMFMappings.txt | awk '/一/'
68-
@diff -u <(awk '{print $$1}' BPMFMappings.txt|sort -u) \
69-
<(awk 'length($$1)>4{print $$1}' phrase.occ|sort -u)
66+
# @brew install gawk
67+
@gawk 'length($$1)!=NF-1' BPMFMappings.txt
68+
@gawk '{print $$2,$$3,$$4,$$5,$$6,$$7}' BPMFMappings.txt | gawk '/一/'
69+
@diff -u <(gawk 'length($$1)>1{print $$1}' BPMFMappings.txt|sort -u) \
70+
<(gawk 'length($$1)>1{print $$1}' phrase.occ|sort -u)
7071

7172
tidy:
7273
@sed -i '' -e 's/ //g' phrase.occ

0 commit comments

Comments
 (0)