Skip to content

Commit 61e02bf

Browse files
committed
Update CI configs.
1 parent 985b974 commit 61e02bf

File tree

6 files changed

+181
-244
lines changed

6 files changed

+181
-244
lines changed

.github/workflows/build.yml

Lines changed: 43 additions & 81 deletions
Original file line numberDiff line numberDiff line change
@@ -11,61 +11,38 @@ jobs:
1111
runs-on: ubuntu-latest
1212

1313
steps:
14+
- name: 📁 Checkout
15+
uses: actions/checkout@v4
1416

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
17+
- name: 🧰 Setup Rubisco
18+
id: rubisco
19+
uses: cppp-project/rubisco@main
20+
with:
21+
host: x86_64-linux-gnu
2422

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
23+
- name: 📦 Build source distribution
3824
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
25+
rubisco dist
4826
27+
# Rubisco will support it later.
28+
- name: 📦 Generate checksum
29+
run: |
4930
cd dist
50-
for i in $(ls) ; do md5sum $i > $i.md5 ; done
31+
for i in $(ls) ; do sha256sum $i > $i.sha256 ; done
5132
cd ..
52-
53-
#--------------------------------------------publish--------------------------------------------
5433
5534
- name: ⬆️ Create release and upload assets
5635
uses: softprops/action-gh-release@v1
5736
with:
58-
tag_name: ${{ env.tag }}
37+
tag_name: ${{ steps.rubisco.outputs.tag }}
5938
files: ./dist/*
6039

6140
build-linux:
62-
63-
needs: build-dist
6441

6542
strategy:
6643
fail-fast: false
6744
matrix:
68-
arch: [
45+
host: [
6946
aarch64-linux-gnu,
7047
alpha-linux-gnu,
7148
arm-linux-gnueabi,
@@ -75,87 +52,72 @@ jobs:
7552
mips64-linux-gnuabi64,
7653
mips64el-linux-gnuabi64,
7754
mipsel-linux-gnu,
78-
mipsisa32r6-linux-gnu,
79-
mipsisa32r6el-linux-gnu,
80-
mipsisa64r6-linux-gnuabi64,
81-
mipsisa64r6el-linux-gnuabi64,
8255
powerpc-linux-gnu,
8356
powerpc64-linux-gnu,
84-
powerpc64le-linux-gnu,
8557
riscv64-linux-gnu,
8658
sh4-linux-gnu,
8759
x86_64-linux-gnu
8860
]
89-
61+
9062
runs-on: ubuntu-latest
91-
63+
9264
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
65+
- name: 📁 Checkout
66+
uses: actions/checkout@v4
67+
68+
- name: 🧰 Setup Rubisco
69+
id: rubisco
70+
uses: cppp-project/rubisco@main
71+
with:
72+
host: ${{ matrix.host }}
10173

74+
# Rubisco don't support setup cross-compiler now.
10275
- name: 📁 Collect dependencies
10376
run: |
10477
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" ] ;
78+
if [ "${{ matrix.host }}" = "x86_64-linux-gnu" ] ;
10879
then
10980
sudo apt-get install gcc g++ -y ;
11081
else
111-
sudo apt-get install gcc-${{ matrix.arch }} g++-${{ matrix.arch }} -y ;
82+
sudo apt-get install gcc-${{ matrix.host }} g++-${{ matrix.host }} -y ;
11283
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
84+
85+
- name: 🧳 Prepare for building
12286
run: |
87+
mkdir -p ${{ steps.rubisco.outputs.pkgname }}-${{ matrix.host }}
12388
mkdir -p dist
12489
12590
- name: 🛠️ Build binary distribution
12691
run: |
12792
export C_COMPILER="gcc"
12893
export CXX_COMPILER="g++"
12994
export LINKER="ld"
130-
export CC_CROSS="/usr/bin/${{ matrix.arch }}-$C_COMPILER"
131-
export CXX_CROSS="/usr/bin/${{ matrix.arch }}-$CXX_COMPILER"
132-
export LD="/usr/bin/${{ matrix.arch }}-$LINKER"
95+
export CC_CROSS="/usr/bin/${{ matrix.host }}-$C_COMPILER"
96+
export CXX_CROSS="/usr/bin/${{ matrix.host }}-$CXX_COMPILER"
97+
export LD="/usr/bin/${{ matrix.host }}-$LINKER"
13398
13499
mkdir build
135100
cd build
136-
cmake .. -DCMAKE_INSTALL_PREFIX=${{ env.srcdir }}/${{ env.pkgname }}-${{ matrix.arch }} -DCMAKE_C_COMPILER=$CC_CROSS -DCMAKE_CXX_COMPILER=$CXX_CROSS -DCMAKE_LINKER=$LD
137-
cmake --build . --config=Release
138-
cmake --install .
101+
cmake .. -DCMAKE_INSTALL_PREFIX="${{ steps.rubisco.outputs.srcdir }}/${{ steps.rubisco.outputs.pkgname }}-${{ matrix.host }}" -DCMAKE_C_COMPILER=$CC_CROSS -DCMAKE_CXX_COMPILER=$CXX_CROSS -DCMAKE_LINKER=$LD
102+
cmake --build . --config=Release -j $(nproc)
103+
cmake --install . --config=Release
139104
cd ..
140105
141106
- name: 📦 Make packages
142107
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
108+
tar cvf dist/${{ steps.rubisco.outputs.pkgname }}-${{ matrix.host }}.tar ${{ steps.rubisco.outputs.pkgname }}-${{ matrix.host }}
109+
xz -9 dist/${{ steps.rubisco.outputs.pkgname }}-${{ matrix.host }}.tar
148110
111+
- name: 📦 Generate checksum
112+
run: |
149113
cd dist
150-
for i in $(ls) ; do md5sum $i > $i.md5 ; done
114+
for i in $(ls) ; do sha256sum $i > $i.sha256 ; done
151115
cd ..
152-
153-
#--------------------------------------------publish--------------------------------------------
154116
155117
- name: ⬆️ Create release and upload assets
156118
uses: softprops/action-gh-release@v1
157119
with:
158-
tag_name: ${{ env.tag }}
120+
tag_name: ${{ steps.rubisco.outputs.tag }}
159121
files: ./dist/*
160122

161123
build-macos:

.github/workflows/test.yml

Lines changed: 24 additions & 63 deletions
Original file line numberDiff line numberDiff line change
@@ -1,77 +1,38 @@
1-
name: ✔️ Test cppp-reiconv library
1+
name: ✔️ Test cppp-reiconv
22

33
on:
44
release:
55
types: [published]
66
push:
77
branches: [ "main" ]
8-
workflow_dispatch:
8+
pull_request:
9+
branches: [ "main" ]
910

1011
jobs:
11-
test-linux:
12+
build:
13+
runs-on: ${{ matrix.os }}
1214

13-
runs-on: ubuntu-latest
15+
strategy:
16+
fail-fast: false
1417

15-
steps:
16-
#--------------------------------------------collect--------------------------------------------
17-
- uses: actions/checkout@v3
18+
matrix:
19+
include:
20+
- { os: macos-latest, host: aarch64-apple-darwin }
21+
- { os: ubuntu-latest, host: x86_64-linux-gnu }
1822

19-
- name: 🧰 Setup Python
20-
uses: actions/setup-python@v4
21-
22-
- name: 📁 Collect dependencies
23-
run: |
24-
sudo apt-get update
25-
sudo apt-get install gcc cmake -y
26-
27-
- name: 🧰 Setup build-aux
28-
run: |
29-
./setup.sh
30-
31-
#--------------------------------------------build--------------------------------------------
32-
- name: 🛠️ Build
33-
run : |
34-
mkdir -p build
35-
cd build
36-
cmake .. -DENABLE_EXTRA=ON -DENABLE_TEST=ON
37-
cmake --build . --config=Release
38-
cd ..
39-
40-
#--------------------------------------------test--------------------------------------------
41-
- name: ✔️ Test
42-
run : |
43-
cd build
44-
ctest --verbose -C Release
45-
cd ..
46-
47-
test-macos:
23+
steps:
24+
- name: 📁 Checkout
25+
uses: actions/checkout@v4
4826

49-
runs-on: macos-latest
27+
- name: 🧰 Setup Rubisco
28+
uses: cppp-project/rubisco@main
29+
with:
30+
host: ${{ matrix.host }}
5031

51-
steps:
52-
#--------------------------------------------collect--------------------------------------------
53-
- uses: actions/checkout@v3
54-
55-
- name: 📁 Collect dependencies
32+
- name: 📁 Setup subpackages
5633
run: |
57-
brew install cmake
58-
59-
- name: 🧰 Setup build-aux
60-
run : |
61-
./setup.sh
62-
63-
#--------------------------------------------build--------------------------------------------
64-
- name: 🛠️ Build
65-
run : |
66-
mkdir build
67-
cd build
68-
cmake .. -DENABLE_EXTRA=ON -DENABLE_TEST=ON
69-
cmake --build . --config=Release
70-
cd ..
71-
72-
#--------------------------------------------test--------------------------------------------
73-
- name: ✔️ Test
74-
run : |
75-
cd build
76-
ctest --verbose -C Release
77-
cd ..
34+
git clone https://github.com/cppp-project/build-aux --depth 1
35+
git clone https://github.com/cppp-project/cppp-platform --depth 1
36+
37+
- name: 🧪 Test
38+
run: rubisco test

0 commit comments

Comments
 (0)