Skip to content

Commit 6619e41

Browse files
authored
Merge pull request #2 from cppp-project/dev
Dev
2 parents 2b1fad6 + 0223b50 commit 6619e41

23 files changed

+1059
-679
lines changed

.github/workflows/build.yml

Lines changed: 306 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,306 @@
1+
name: 🛠️ Build cppp-reiconv
2+
3+
on:
4+
release:
5+
types: [published]
6+
7+
jobs:
8+
9+
build-dist:
10+
11+
runs-on: ubuntu-latest
12+
13+
steps:
14+
15+
#--------------------------------------------collect--------------------------------------------
16+
- uses: actions/checkout@v3
17+
18+
- name: 🏷️ Get infomations
19+
run: |
20+
tag="${GITHUB_REF#refs/tags/}"
21+
echo "tag=$tag" >> $GITHUB_ENV
22+
echo "pkgname=cppp-reiconv-$tag" >> $GITHUB_ENV
23+
echo "srcdir=$(pwd)" >> $GITHUB_ENV
24+
25+
- name: 📁 Collect dependencies
26+
run: |
27+
sudo apt-get update
28+
sudo apt-get install p7zip-full zip xz-utils -y
29+
sudo apt-get install gperf cmake gcc python3 -y
30+
31+
#--------------------------------------------build--------------------------------------------
32+
- name: 🧳 Prepare for source distribution building
33+
run: |
34+
mkdir -p ./dist
35+
./setup.sh
36+
37+
- name: 🛠️ Build source distribution
38+
run: |
39+
./cpppdist.py
40+
41+
- name: 📦 Make packages
42+
run: |
43+
tar cvf ${{ env.pkgname }}.tar ${{ env.pkgname }}
44+
zip -r -9 dist/${{ env.pkgname }}.zip ${{ env.pkgname }}
45+
7z a dist/${{ env.pkgname }}.7z ${{ env.pkgname }}
46+
xz -c -9 -k ${{ env.pkgname }}.tar > dist/${{ env.pkgname }}.tar.xz
47+
gzip -c -9 -k ${{ env.pkgname }}.tar > dist/${{ env.pkgname }}.tar.gz
48+
49+
cd dist
50+
for i in $(ls) ; do md5sum $i > $i.md5 ; done
51+
cd ..
52+
53+
#--------------------------------------------publish--------------------------------------------
54+
55+
- name: ⬆️ Create release and upload assets
56+
uses: softprops/action-gh-release@v1
57+
with:
58+
tag_name: ${{ env.tag }}
59+
files: ./dist/*
60+
61+
build-linux:
62+
63+
needs: build-dist
64+
65+
strategy:
66+
fail-fast: false
67+
matrix:
68+
arch: [
69+
aarch64-linux-gnu,
70+
alpha-linux-gnu,
71+
arm-linux-gnueabi,
72+
arm-linux-gnueabihf,
73+
i686-linux-gnu,
74+
mips-linux-gnu,
75+
mips64-linux-gnuabi64,
76+
mips64el-linux-gnuabi64,
77+
mipsel-linux-gnu,
78+
mipsisa32r6-linux-gnu,
79+
mipsisa32r6el-linux-gnu,
80+
mipsisa64r6-linux-gnuabi64,
81+
mipsisa64r6el-linux-gnuabi64,
82+
powerpc-linux-gnu,
83+
powerpc64-linux-gnu,
84+
powerpc64le-linux-gnu,
85+
riscv64-linux-gnu,
86+
sh4-linux-gnu,
87+
x86_64-linux-gnu
88+
]
89+
90+
runs-on: ubuntu-latest
91+
92+
steps:
93+
94+
#--------------------------------------------collect--------------------------------------------
95+
- name: 🏷️ Get infomations
96+
run: |
97+
tag="${GITHUB_REF#refs/tags/}"
98+
echo "tag=$tag" >> $GITHUB_ENV
99+
echo "pkgname=cppp-reiconv-$tag" >> $GITHUB_ENV
100+
echo "srcdir=$(pwd)" >> $GITHUB_ENV
101+
102+
- name: 📁 Collect dependencies
103+
run: |
104+
sudo apt-get update
105+
sudo apt-get install p7zip-full zip xz-utils wget -y
106+
sudo apt-get install gperf cmake -y
107+
if [ "${{ matrix.arch }}" = "x86_64-linux-gnu" ] ;
108+
then
109+
sudo apt-get install gcc g++ -y ;
110+
else
111+
sudo apt-get install gcc-${{ matrix.arch }} g++-${{ matrix.arch }} -y ;
112+
fi
113+
114+
- name: 📁 Get source distribution tarball
115+
run: |
116+
wget https://github.com/${{ github.repository }}/releases/download/${{ env.tag }}/${{ env.pkgname }}.tar.gz
117+
tar zxvf ${{ env.pkgname }}.tar.gz
118+
mv ${{ env.pkgname }}/* .
119+
120+
#--------------------------------------------build--------------------------------------------
121+
- name: 🧳 Prepare for binary distribution building
122+
run: |
123+
mkdir -p dist
124+
125+
- name: 🛠️ Build binary distribution
126+
run: |
127+
export C_COMPILER="gcc"
128+
export CXX_COMPILER="g++"
129+
export LINKER="ld"
130+
export CC="/usr/bin/${{ matrix.arch }}-$C_COMPILER"
131+
export CXX="/usr/bin/${{ matrix.arch }}-$CXX_COMPILER"
132+
export LD="/usr/bin/${{ matrix.arch }}-$LINKER"
133+
134+
mkdir build
135+
cd build
136+
cmake .. -DCMAKE_INSTALL_PREFIX=${{ env.srcdir }}/${{ env.pkgname }}-${{ matrix.arch }} -DCMAKE_C_COMPILER=$CC -DCMAKE_CXX_COMPILER=$CXX -DCMAKE_LINKER=$LD
137+
cmake --build . --config=Release
138+
cmake --install .
139+
cd ..
140+
141+
- name: 📦 Make packages
142+
run: |
143+
tar cvf ${{ env.pkgname }}-${{ matrix.arch }}.tar ${{ env.pkgname }}-${{ matrix.arch }}
144+
zip -r -9 dist/${{ env.pkgname }}-${{ matrix.arch }}.zip ${{ env.pkgname }}-${{ matrix.arch }}
145+
7z a dist/${{ env.pkgname }}-${{ matrix.arch }}.7z ${{ env.pkgname }}-${{ matrix.arch }}
146+
xz -c -9 -k ${{ env.pkgname }}-${{ matrix.arch }}.tar > dist/${{ env.pkgname }}-${{ matrix.arch }}.tar.xz
147+
gzip -c -9 -k ${{ env.pkgname }}-${{ matrix.arch }}.tar > dist/${{ env.pkgname }}-${{ matrix.arch }}.tar.gz
148+
149+
cd dist
150+
for i in $(ls) ; do md5sum $i > $i.md5 ; done
151+
cd ..
152+
153+
#--------------------------------------------publish--------------------------------------------
154+
155+
- name: ⬆️ Create release and upload assets
156+
uses: softprops/action-gh-release@v1
157+
with:
158+
tag_name: ${{ env.tag }}
159+
files: ./dist/*
160+
161+
build-macos:
162+
163+
needs: build-dist
164+
165+
strategy:
166+
fail-fast: false
167+
matrix:
168+
arch: [
169+
x86_64,
170+
arm64
171+
]
172+
173+
runs-on: macos-latest
174+
175+
steps:
176+
177+
#--------------------------------------------collect--------------------------------------------
178+
- name: 🏷️ Get infomations
179+
run: |
180+
tag="${GITHUB_REF#refs/tags/}"
181+
echo "tag=$tag" >> $GITHUB_ENV
182+
echo "pkgname=cppp-reiconv-$tag" >> $GITHUB_ENV
183+
echo "srcdir=$(pwd)" >> $GITHUB_ENV
184+
185+
- name: 📁 Collect dependencies
186+
run: |
187+
brew install p7zip zip xz wget md5sha1sum
188+
brew install gperf cmake
189+
190+
- name: 📁 Get source distribution tarball
191+
run: |
192+
wget https://github.com/${{ github.repository }}/releases/download/${{ env.tag }}/${{ env.pkgname }}.tar.gz
193+
tar zxvf ${{ env.pkgname }}.tar.gz
194+
mv ${{ env.pkgname }}/* .
195+
196+
#--------------------------------------------build--------------------------------------------
197+
- name: 🧳 Prepare for binary distribution building
198+
run: |
199+
mkdir -p dist
200+
201+
- name: 🛠️ Build binary distribution
202+
run: |
203+
export CC="clang"
204+
export CXX="clang++"
205+
206+
mkdir build
207+
cd build
208+
cmake .. -DCMAKE_INSTALL_PREFIX=${{ env.srcdir }}/${{ env.pkgname }}-${{ matrix.arch }}-darwin-apple -DCMAKE_C_COMPILER=$CC -DCMAKE_CXX_COMPILER=$CXX -DCMAKE_C_FLAGS="${CMAKE_C_FLAGS} -arch ${{ matrix.arch }}" -DCMAKE_CXX_FLAGS="${CMAKE_CXX_FLAGS} -arch ${{ matrix.arch }}"
209+
cmake --build . --config=Release
210+
cmake --install .
211+
cd ..
212+
213+
- name: 📦 Make packages
214+
run: |
215+
tar cvf ${{ env.pkgname }}-${{ matrix.arch }}-darwin-apple.tar ${{ env.pkgname }}-${{ matrix.arch }}-darwin-apple
216+
zip -r -9 dist/${{ env.pkgname }}-${{ matrix.arch }}-darwin-apple.zip ${{ env.pkgname }}-${{ matrix.arch }}-darwin-apple
217+
7z a dist/${{ env.pkgname }}-${{ matrix.arch }}-darwin-apple.7z ${{ env.pkgname }}-${{ matrix.arch }}-darwin-apple
218+
xz -c -9 -k ${{ env.pkgname }}-${{ matrix.arch }}-darwin-apple.tar > dist/${{ env.pkgname }}-${{ matrix.arch }}-darwin-apple.tar.xz
219+
gzip -c -9 -k ${{ env.pkgname }}-${{ matrix.arch }}-darwin-apple.tar > dist/${{ env.pkgname }}-${{ matrix.arch }}-darwin-apple.tar.gz
220+
221+
cd dist
222+
for i in $(ls) ; do md5sum $i > $i.md5 ; done
223+
cd ..
224+
#--------------------------------------------publish--------------------------------------------
225+
226+
- name: ⬆️ Create release and upload assets
227+
uses: softprops/action-gh-release@v1
228+
with:
229+
tag_name: ${{ env.tag }}
230+
files: ./dist/*
231+
232+
build-msvc:
233+
234+
needs: build-dist
235+
236+
strategy:
237+
fail-fast: false
238+
matrix:
239+
include:
240+
- { arch: amd64, msvc_arch: x64 }
241+
- { arch: i386, msvc_arch: Win32 }
242+
- { arch: arm64, msvc_arch: ARM64 }
243+
- { arch: arm, msvc_arch: ARM }
244+
245+
runs-on: windows-latest
246+
247+
steps:
248+
249+
#--------------------------------------------collect--------------------------------------------
250+
- name: 🧳 Set up MSVC
251+
uses: microsoft/setup-msbuild@v1
252+
253+
- name: 🏷️ Get infomations
254+
run: |
255+
$tag="$env:GITHUB_REF_NAME"
256+
echo "tag=$tag" >> $env:GITHUB_ENV
257+
echo "pkgname=cppp-reiconv-$tag" >> $env:GITHUB_ENV
258+
echo "srcdir=$($PWD.Path)" >> $env:GITHUB_ENV
259+
260+
- name: 📁 Collect dependencies
261+
run: |
262+
choco install 7zip.commandline zip gzip dos2unix wget mingw -y
263+
264+
- name: 📁 Get source distribution tarball
265+
run: |
266+
wget https://github.com/${{ github.repository }}/releases/download/${{ env.tag }}/${{ env.pkgname }}.tar.gz
267+
tar zxvf ${{ env.pkgname }}.tar.gz
268+
Move-Item -Path ${{ env.pkgname }}\* -Destination .
269+
270+
- name: 🧳 Prepare for binary distribution building
271+
run: |
272+
mkdir dist
273+
274+
- name: 🛠️ Build binary distribution
275+
run: |
276+
mkdir build
277+
cd build
278+
cmake .. -DCMAKE_INSTALL_PREFIX=${{ env.srcdir }}/${{ env.pkgname }}-${{ matrix.arch }}-windows-msvc -A ${{ matrix.msvc_arch }}
279+
cmake --build . --config=Release
280+
cmake --install .
281+
cd ..
282+
283+
- name: 📦 Make packages
284+
run: |
285+
tar cvf ${{ env.pkgname }}-${{ matrix.arch }}-windows-msvc.tar ${{ env.pkgname }}-${{ matrix.arch }}-windows-msvc
286+
zip -r -9 dist/${{ env.pkgname }}-${{ matrix.arch }}-windows-msvc.zip ${{ env.pkgname }}-${{ matrix.arch }}-windows-msvc
287+
7z a dist/${{ env.pkgname }}-${{ matrix.arch }}-windows-msvc.7z ${{ env.pkgname }}-${{ matrix.arch }}-windows-msvc
288+
xz -9 -k ${{ env.pkgname }}-${{ matrix.arch }}-windows-msvc.tar
289+
gzip -9 -k ${{ env.pkgname }}-${{ matrix.arch }}-windows-msvc.tar
290+
mv ${{ env.pkgname }}-${{ matrix.arch }}-windows-msvc.tar.xz dist
291+
mv ${{ env.pkgname }}-${{ matrix.arch }}-windows-msvc.tar.gz dist
292+
293+
cd dist
294+
Get-ChildItem | ForEach-Object {
295+
md5sum $_.Name > ($_.Name + ".md5")
296+
dos2unix ($_.Name + ".md5")
297+
}
298+
cd ..
299+
300+
#--------------------------------------------publish--------------------------------------------
301+
302+
- name: ⬆️ Create release and upload assets
303+
uses: softprops/action-gh-release@v1
304+
with:
305+
tag_name: ${{ env.tag }}
306+
files: ./dist/*

.github/workflows/test.yml

Lines changed: 27 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Test
1+
name: ✔️ Test cppp-reiconv library
22

33
on:
44
release:
@@ -16,23 +16,30 @@ jobs:
1616
#--------------------------------------------collect--------------------------------------------
1717
- uses: actions/checkout@v3
1818

19-
- name: Collect dependencies
19+
- name: 📁 Collect dependencies
2020
run: |
2121
sudo apt-get update
2222
sudo apt-get install gcc cmake -y
2323
24+
- name: 🧰 Setup build-aux
25+
run: |
26+
./setup.sh
27+
2428
#--------------------------------------------build--------------------------------------------
25-
- name: Build
29+
- name: 🛠️ Build
2630
run : |
27-
mkdir build
31+
mkdir -p build
2832
cd build
2933
cmake .. -DENABLE_EXTRA=ON -DENABLE_TEST=ON
34+
cmake --build .
35+
cd ..
3036
3137
#--------------------------------------------test--------------------------------------------
32-
- name: Test
38+
- name: ✔️ Test
3339
run : |
34-
ctest --verbose --output-on-failure
35-
40+
cd build
41+
ctest --verbose
42+
cd ..
3643
3744
test-macos:
3845

@@ -42,18 +49,26 @@ jobs:
4249
#--------------------------------------------collect--------------------------------------------
4350
- uses: actions/checkout@v3
4451

45-
- name: Collect dependencies
52+
- name: 📁 Collect dependencies
4653
run: |
47-
brew install cmake -y
54+
brew install cmake
55+
56+
- name: 🧰 Setup build-aux
57+
run : |
58+
./setup.sh
4859
4960
#--------------------------------------------build--------------------------------------------
50-
- name: Build
61+
- name: 🛠️ Build
5162
run : |
5263
mkdir build
5364
cd build
5465
cmake .. -DENABLE_EXTRA=ON -DENABLE_TEST=ON
66+
cmake --build .
67+
cd ..
5568
5669
#--------------------------------------------test--------------------------------------------
57-
- name: Test
70+
- name: ✔️ Test
5871
run : |
59-
ctest --verbose --output-on-failure
72+
cd build
73+
ctest --verbose
74+
cd ..

0 commit comments

Comments
 (0)