Skip to content

Commit c7623e4

Browse files
clover2123ksh8281
authored andcommitted
Update release action
* include icu libraries for release * add build option for deployment * check the result of deployment in action Signed-off-by: HyukWoo Park <[email protected]>
1 parent 5c22c9f commit c7623e4

File tree

2 files changed

+193
-71
lines changed

2 files changed

+193
-71
lines changed

.github/workflows/release.yml

+181-59
Original file line numberDiff line numberDiff line change
@@ -7,19 +7,22 @@ on:
77

88
env:
99
RUNNER: tools/run-tests.py
10-
BUILD_OPTIONS: -DESCARGOT_MODE=release -DESCARGOT_THREADING=ON -DESCARGOT_TCO=ON -DESCARGOT_TEST=ON -DESCARGOT_OUTPUT=shell -GNinja
10+
BUILD_OPTIONS: -DESCARGOT_MODE=release -DESCARGOT_LIBICU_SUPPORT_WITH_DLOPEN=OFF -DESCARGOT_DEPLOY=ON -DESCARGOT_THREADING=ON -DESCARGOT_TCO=ON -DESCARGOT_TEST=ON -DESCARGOT_OUTPUT=shell -GNinja
1111

1212
jobs:
13-
build-mac64:
14-
runs-on: macos-13
13+
build-macOS:
14+
runs-on: ${{ matrix.os }}
15+
strategy:
16+
matrix:
17+
os: [macos-13, macos-latest]
1518
steps:
1619
- uses: actions/checkout@v4
1720
with:
1821
submodules: true
1922
- name: Install Packages
2023
run: |
2124
brew update
22-
brew install ninja icu4c
25+
brew install ninja icu4c zip
2326
- name: Build x64
2427
run: |
2528
# check cpu
@@ -33,44 +36,130 @@ jobs:
3336
run: |
3437
file out/escargot
3538
strip out/escargot
36-
$RUNNER --engine="$GITHUB_WORKSPACE/out/escargot" new-es
37-
mv out/escargot out/escargot-mac64
38-
- name: Upload
39+
40+
# set deploy directory
41+
mkdir -p deploy
42+
43+
# set escargot
44+
cp out/escargot ./deploy/.
45+
LIBS=$(otool -L ./deploy/escargot | grep "icu" | awk '{print $1}')
46+
for LIB in $LIBS; do
47+
BASENAME=$(basename "$LIB")
48+
install_name_tool -change "$LIB" "@executable_path/$BASENAME" deploy/escargot
49+
done
50+
51+
# set icu libs
52+
ICU_LIBS=("libicuuc" "libicui18n" "libicudata")
53+
ICU_SOURCE_PATH="$(brew --prefix icu4c)/lib"
54+
ICU_VERSION=$(find "$ICU_SOURCE_PATH" -name "libicuuc.*.dylib" | grep -oE '\.[0-9]+\.' | head -n 1 | tr -d '.')
55+
56+
if [ -z "$ICU_VERSION" ]; then
57+
echo "ICU version could not be detected."
58+
exit 1
59+
else
60+
echo "Detected ICU Version: $ICU_VERSION"
61+
fi
62+
63+
for LIB in "${ICU_LIBS[@]}"; do
64+
cp -a $ICU_SOURCE_PATH/$LIB.*.dylib ./deploy/.
65+
install_name_tool -id "@loader_path/$LIB.$ICU_VERSION.dylib" "./deploy/$LIB.$ICU_VERSION.dylib"
66+
done
67+
68+
# check results
69+
echo "Check results..."
70+
ls ./deploy
71+
otool -L ./deploy/escargot
72+
otool -L ./deploy/libicu*.dylib
73+
74+
# run test
75+
$RUNNER --engine="$GITHUB_WORKSPACE/deploy/escargot" new-es
76+
77+
# zip results
78+
if [ "${{ matrix.os }}" == "macos-13" ]; then
79+
zip -j escargot-mac64.zip deploy/*
80+
elif [ "${{ matrix.os }}" == "macos-latest" ]; then
81+
zip -j escargot-mac64arm.zip deploy/*
82+
fi
83+
- name: Upload mac64
84+
if: ${{ matrix.os == 'macos-13' }}
3985
uses: actions/upload-artifact@v4
4086
with:
4187
name: build-artifact-mac64
42-
path: out/escargot-mac64
88+
path: ./escargot-mac64.zip
89+
- name: Upload mac64arm
90+
if: ${{ matrix.os == 'macos-latest' }}
91+
uses: actions/upload-artifact@v4
92+
with:
93+
name: build-artifact-mac64arm
94+
path: ./escargot-mac64arm.zip
4395

44-
build-mac64arm:
45-
runs-on: macos-latest
96+
build-linux:
97+
runs-on: ubuntu-22.04
4698
steps:
4799
- uses: actions/checkout@v4
48100
with:
49101
submodules: true
50102
- name: Install Packages
51103
run: |
52-
brew update
53-
brew install ninja icu4c
54-
- name: Build arm64
104+
# for i386 ICU
105+
sudo dpkg --add-architecture i386
106+
sudo apt-get update
107+
sudo apt-get install -y ninja-build libicu-dev gcc-multilib g++-multilib zip patchelf
108+
sudo apt-get install -y libicu-dev:i386 # install i386 ICU
109+
- name: Build x86/x64
55110
run: |
56-
# check cpu
57-
sysctl -a | grep machdep.cpu
58-
# add icu path to pkg_config_path
59-
export PKG_CONFIG_PATH="$(brew --prefix icu4c)/lib/pkgconfig"
60-
echo $PKG_CONFIG_PATH
61-
cmake -H. -Bout/ $BUILD_OPTIONS
62-
ninja -Cout/
111+
cmake -H. -Bout/x86 -DCMAKE_SYSTEM_NAME=Linux -DCMAKE_SYSTEM_PROCESSOR=x86 -DESCARGOT_TEMPORAL=ON $BUILD_OPTIONS
112+
cmake -H. -Bout/x64 -DESCARGOT_TEMPORAL=ON $BUILD_OPTIONS
113+
ninja -Cout/x86
114+
ninja -Cout/x64
63115
- name: Check
64116
run: |
65-
file out/escargot
66-
strip out/escargot
67-
$RUNNER --engine="$GITHUB_WORKSPACE/out/escargot" new-es
68-
mv out/escargot out/escargot-mac64arm
117+
file out/x86/escargot
118+
file out/x64/escargot
119+
strip out/x86/escargot
120+
strip out/x64/escargot
121+
# set locale
122+
sudo locale-gen en_US.UTF-8
123+
export LANG=en_US.UTF-8
124+
locale
125+
126+
# set deploy directory and copy escargot binary
127+
mkdir -p deploy-x86
128+
mkdir -p deploy-x64
129+
cp out/x86/escargot ./deploy-x86/.
130+
cp out/x64/escargot ./deploy-x64/.
131+
132+
# set icu libs
133+
ldd deploy-x86/escargot | grep "icu" | grep "=>" | awk '{print $3}' | xargs -I '{}' cp '{}' deploy-x86/
134+
ldd deploy-x64/escargot | grep "icu" | grep "=>" | awk '{print $3}' | xargs -I '{}' cp '{}' deploy-x64/
135+
for LIB in ./deploy-x86/libicu*; do
136+
patchelf --set-rpath '$ORIGIN' "$LIB"
137+
done
138+
for LIB in ./deploy-x64/libicu*; do
139+
patchelf --set-rpath '$ORIGIN' "$LIB"
140+
done
141+
142+
# check results
143+
echo "Check results..."
144+
ls ./deploy-x86
145+
ldd deploy-x86/escargot
146+
ldd deploy-x86/libicu*
147+
ls ./deploy-x64
148+
ldd deploy-x64/escargot
149+
ldd deploy-x64/libicu*
150+
151+
# run test
152+
$RUNNER --engine="$GITHUB_WORKSPACE/deploy-x86/escargot" new-es
153+
$RUNNER --engine="$GITHUB_WORKSPACE/deploy-x64/escargot" new-es
154+
155+
# zip results
156+
zip -j escargot-linux-x86.zip deploy-x86/*
157+
zip -j escargot-linux-x64.zip deploy-x64/*
69158
- name: Upload
70159
uses: actions/upload-artifact@v4
71160
with:
72-
name: build-artifact-mac64arm
73-
path: out/escargot-mac64arm
161+
name: build-artifact-linux
162+
path: escargot-linux-*.zip
74163

75164
build-windows:
76165
runs-on: windows-2022
@@ -103,6 +192,11 @@ jobs:
103192
with:
104193
arch: ${{ matrix.arch }}
105194
sdk: "10.0.20348.0"
195+
- name: Install zip if not available
196+
run: |
197+
if (-Not (Get-Command zip -ErrorAction SilentlyContinue)) {
198+
choco install zip -y
199+
}
106200
- name: Build ${{ matrix.arch }}
107201
run: |
108202
CMake -DCMAKE_SYSTEM_NAME=Windows -DCMAKE_SYSTEM_VERSION:STRING="10.0" -DCMAKE_SYSTEM_PROCESSOR=${{ matrix.arch }} -DESCARGOT_ARCH=${{ matrix.arch }} -Bout/ -DESCARGOT_OUTPUT=shell -DESCARGOT_LIBICU_SUPPORT=ON -DESCARGOT_LIBICU_SUPPORT_WITH_DLOPEN=OFF -DESCARGOT_THREADING=ON -DESCARGOT_TCO=ON -DESCARGOT_TEST=ON -G Ninja -DCMAKE_C_COMPILER=cl -DCMAKE_CXX_COMPILER=cl -DCMAKE_BUILD_TYPE=release
@@ -111,55 +205,83 @@ jobs:
111205
run: |
112206
python tools\run-tests.py --engine=%cd%\out\escargot.exe new-es
113207
rename out\escargot.exe escargot-win-${{ matrix.arch }}.exe
208+
zip -j escargot-win-${{ matrix.arch}}.zip out\escargot-win-${{ matrix.arch }}.exe
114209
shell: cmd
115210
- name: Upload
116211
uses: actions/upload-artifact@v4
117212
with:
118213
name: build-artifact-win-${{ matrix.arch }}
119-
path: out\escargot-win-${{ matrix.arch }}.exe
214+
path: escargot-win-${{ matrix.arch }}.zip
120215

121-
build-linux:
122-
runs-on: ubuntu-22.04
216+
check-build-mac64:
217+
needs: [build-macOS]
218+
runs-on: macos-13
123219
steps:
124220
- uses: actions/checkout@v4
125221
with:
126222
submodules: true
127-
- name: Install Packages
128-
run: |
129-
# for i386 ICU
130-
sudo dpkg --add-architecture i386
131-
sudo apt-get update
132-
sudo apt-get install -y ninja-build libicu-dev gcc-multilib g++-multilib
133-
sudo apt-get install -y libicu-dev:i386 # install i386 ICU
134-
- name: Build x86/x64
223+
- name: Download build artifacts
224+
uses: actions/download-artifact@v4
225+
with:
226+
path: artifacts
227+
pattern: build-artifact-mac64
228+
merge-multiple: true
229+
- name: Check
135230
run: |
136-
cmake -H. -Bout/x86 -DCMAKE_SYSTEM_NAME=Linux -DCMAKE_SYSTEM_PROCESSOR=x86 -DESCARGOT_TEMPORAL=ON $BUILD_OPTIONS
137-
cmake -H. -Bout/x64 -DESCARGOT_TEMPORAL=ON $BUILD_OPTIONS
138-
ninja -Cout/x86
139-
ninja -Cout/x64
231+
unzip artifacts/escargot-mac64.zip -d artifacts
232+
otool -L artifacts/escargot
233+
otool -L artifacts/*.dylib
234+
$RUNNER --engine="$GITHUB_WORKSPACE/artifacts/escargot" new-es
235+
236+
check-build-mac64arm:
237+
needs: [build-macOS]
238+
runs-on: macos-latest
239+
steps:
240+
- uses: actions/checkout@v4
241+
with:
242+
submodules: true
243+
- name: Download build artifacts
244+
uses: actions/download-artifact@v4
245+
with:
246+
path: artifacts
247+
pattern: build-artifact-mac64arm
248+
merge-multiple: true
140249
- name: Check
141250
run: |
142-
file out/x86/escargot
143-
file out/x64/escargot
144-
strip out/x86/escargot
145-
strip out/x64/escargot
146-
# set locale
147-
sudo locale-gen en_US.UTF-8
148-
export LANG=en_US.UTF-8
149-
locale
150-
# run test
151-
$RUNNER --engine="$GITHUB_WORKSPACE/out/x86/escargot" new-es
152-
$RUNNER --engine="$GITHUB_WORKSPACE/out/x64/escargot" new-es
153-
mv out/x86/escargot out/escargot-linux-x86
154-
mv out/x64/escargot out/escargot-linux-x64
155-
- name: Upload
156-
uses: actions/upload-artifact@v4
251+
unzip artifacts/escargot-mac64arm.zip -d artifacts
252+
otool -L artifacts/escargot
253+
otool -L artifacts/*.dylib
254+
$RUNNER --engine="$GITHUB_WORKSPACE/artifacts/escargot" new-es
255+
256+
check-build-linux:
257+
needs: [build-linux]
258+
runs-on: ubuntu-latest
259+
steps:
260+
- uses: actions/checkout@v4
157261
with:
158-
name: build-artifact-linux
159-
path: out/escargot-linux-*
262+
submodules: true
263+
- name: Download build artifacts
264+
uses: actions/download-artifact@v4
265+
with:
266+
path: artifacts
267+
pattern: build-artifact-linux
268+
merge-multiple: true
269+
- name: Check
270+
run: |
271+
dpkg -l | grep libicu-dev
272+
mkdir -p result-x86
273+
mkdir -p result-x64
274+
unzip artifacts/escargot-linux-x86.zip -d result-x86
275+
unzip artifacts/escargot-linux-x64.zip -d result-x64
276+
ldd result-x86/escargot
277+
ldd result-x86/libicu*
278+
ldd result-x64/escargot
279+
ldd result-x64/libicu*
280+
$RUNNER --engine="$GITHUB_WORKSPACE/result-x86/escargot" new-es
281+
$RUNNER --engine="$GITHUB_WORKSPACE/result-x64/escargot" new-es
160282
161283
update-release:
162-
needs: [build-mac64, build-mac64arm, build-windows, build-linux]
284+
needs: [check-build-mac64, check-build-mac64arm, check-build-linux, build-windows]
163285
runs-on: ubuntu-latest
164286
steps:
165287
- name: Download build artifacts

build/config.cmake

+12-12
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,13 @@ ENDIF()
8484
# FLAGS FOR ADDITIONAL FUNCTION
8585
#######################################################
8686
IF (ESCARGOT_LIBICU_SUPPORT)
87+
IF (ESCARGOT_DEPLOY)
88+
# Build for deployment (include ICU library)
89+
SET (CMAKE_INSTALL_RPATH "$ORIGIN")
90+
SET (CMAKE_BUILD_WITH_INSTALL_RPATH TRUE)
91+
SET (CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
92+
ENDIF()
93+
8794
IF (ESCARGOT_LIBICU_SUPPORT_WITH_DLOPEN)
8895
SET (ESCARGOT_DEFINITIONS ${ESCARGOT_DEFINITIONS} -DENABLE_ICU -DENABLE_INTL -DENABLE_RUNTIME_ICU_BINDER)
8996
SET (ESCARGOT_DEFINITIONS ${ESCARGOT_DEFINITIONS} -DENABLE_INTL_DISPLAYNAMES -DENABLE_INTL_NUMBERFORMAT -DENABLE_INTL_PLURALRULES)
@@ -94,21 +101,14 @@ IF (ESCARGOT_LIBICU_SUPPORT)
94101
SET (ESCARGOT_DEFINITIONS ${ESCARGOT_DEFINITIONS} -DENABLE_INTL_DISPLAYNAMES -DENABLE_INTL_NUMBERFORMAT -DENABLE_INTL_PLURALRULES)
95102
SET (ESCARGOT_DEFINITIONS ${ESCARGOT_DEFINITIONS} -DENABLE_INTL_RELATIVETIMEFORMAT -DENABLE_INTL_LISTFORMAT)
96103

97-
PKG_CHECK_MODULES (ICUI18N REQUIRED icu-i18n)
98-
PKG_CHECK_MODULES (ICUUC REQUIRED icu-uc)
104+
PKG_CHECK_MODULES(ICU REQUIRED icu-uc icu-i18n)
99105
ENDIF()
100106

107+
MESSAGE(STATUS "ICU Libraries: ${ICU_LIBRARIES}")
108+
SET (ESCARGOT_LDFLAGS ${ESCARGOT_LDFLAGS} ${ICU_LDFLAGS})
101109
SET (ESCARGOT_DEFINITIONS ${ESCARGOT_DEFINITIONS} -DENABLE_ICU -DENABLE_INTL)
102-
103-
IF (${ESCARGOT_HOST} STREQUAL "darwin")
104-
FOREACH (ICU_LDFLAG ${ICUI18N_LDFLAGS} ${ICUUC_LDFLAGS})
105-
SET (ESCARGOT_LDFLAGS ${ESCARGOT_LDFLAGS} ${ICU_LDFLAG})
106-
ENDFOREACH()
107-
ELSE()
108-
SET (ESCARGOT_LIBRARIES ${ESCARGOT_LIBRARIES} ${ICUI18N_LIBRARIES} ${ICUUC_LIBRARIES})
109-
ENDIF()
110-
SET (ESCARGOT_INCDIRS ${ESCARGOT_INCDIRS} ${ICUI18N_INCLUDE_DIRS} ${ICUUC_INCLUDE_DIRS})
111-
SET (ESCARGOT_CXXFLAGS ${ESCARGOT_CXXFLAGS} ${ICUI18N_CFLAGS_OTHER} ${ICUUC_CFLAGS_OTHER})
110+
SET (ESCARGOT_INCDIRS ${ESCARGOT_INCDIRS} ${ICU_INCLUDE_DIRS})
111+
SET (ESCARGOT_LIBRARIES ${ESCARGOT_LIBRARIES} ${ICU_LIBRARIES})
112112
ENDIF()
113113
ENDIF()
114114

0 commit comments

Comments
 (0)