Skip to content

Commit 741f3b8

Browse files
committed
Refactor CI publish workflow.
1 parent 540bfc6 commit 741f3b8

File tree

1 file changed

+96
-125
lines changed

1 file changed

+96
-125
lines changed

.github/workflows/build.yml

Lines changed: 96 additions & 125 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,11 @@ jobs:
2020
with:
2121
host: x86_64-linux-gnu
2222

23+
- name: 📁 Collect subpackages
24+
run: |
25+
git clone https://github.com/cppp-project/build-aux --depth 1
26+
git clone https://github.com/cppp-project/cppp-platform --depth 1
27+
2328
- name: 📦 Build source distribution
2429
run: |
2530
rubisco dist
@@ -82,6 +87,11 @@ jobs:
8287
sudo apt-get install gcc-${{ matrix.host }} g++-${{ matrix.host }} -y ;
8388
fi
8489
90+
- name: 📁 Collect subpackages
91+
run: |
92+
git clone https://github.com/cppp-project/build-aux --depth 1
93+
git clone https://github.com/cppp-project/cppp-platform --depth 1
94+
8595
- name: 🧳 Prepare for building
8696
run: |
8797
mkdir -p ${{ steps.rubisco.outputs.pkgname }}-${{ matrix.host }}
@@ -98,7 +108,7 @@ jobs:
98108
99109
mkdir build
100110
cd build
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
111+
cmake .. -DBUILD_TESTING=OFF -DICONV_COMPAT=OFF -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
102112
cmake --build . --config=Release -j $(nproc)
103113
cmake --install . --config=Release
104114
cd ..
@@ -120,153 +130,114 @@ jobs:
120130
tag_name: ${{ steps.rubisco.outputs.tag }}
121131
files: ./dist/*
122132

123-
build-macos:
124-
125-
needs: build-dist
126-
127-
strategy:
128-
fail-fast: false
129-
matrix:
130-
arch: [
131-
x86_64,
132-
arm64
133-
]
133+
build-darwin:
134134

135135
runs-on: macos-latest
136136

137137
steps:
138-
139-
#--------------------------------------------collect--------------------------------------------
140-
- uses: maxim-lobanov/setup-xcode@v1
141-
with:
142-
xcode-version: latest-stable
138+
- name: 📁 Checkout
139+
uses: actions/checkout@v4
143140

144-
- name: 🏷️ Get infomations
145-
run: |
146-
tag="${GITHUB_REF#refs/tags/}"
147-
echo "tag=$tag" >> $GITHUB_ENV
148-
echo "pkgname=cppp-reiconv-$tag" >> $GITHUB_ENV
149-
echo "srcdir=$(pwd)" >> $GITHUB_ENV
141+
- name: 🧰 Setup Rubisco
142+
id: rubisco
143+
uses: cppp-project/rubisco@main
144+
with:
145+
host: arm64-apple-darwin
150146

151147
- name: 📁 Collect dependencies
152148
run: |
153-
brew install p7zip zip xz wget md5sha1sum
154-
brew install gperf cmake
155-
156-
- name: 📁 Get source distribution tarball
149+
brew install coreutils
150+
151+
- name: 📁 Collect subpackages
157152
run: |
158-
wget https://github.com/${{ github.repository }}/releases/download/${{ env.tag }}/${{ env.pkgname }}.tar.gz
159-
tar zxvf ${{ env.pkgname }}.tar.gz
160-
mv ${{ env.pkgname }}/* .
161-
162-
#--------------------------------------------build--------------------------------------------
163-
- name: 🧳 Prepare for binary distribution building
153+
git clone https://github.com/cppp-project/build-aux --depth 1
154+
git clone https://github.com/cppp-project/cppp-platform --depth 1
155+
156+
- name: 🧳 Prepare for building
164157
run: |
158+
mkdir -p ${{ steps.rubisco.outputs.pkgname }}-arm64-apple-darwin
165159
mkdir -p dist
166-
160+
167161
- name: 🛠️ Build binary distribution
168162
run: |
169-
export CC_CROSS="clang"
170-
export CXX_CROSS="clang++"
171-
172163
mkdir build
173164
cd build
174-
cmake .. -DCMAKE_INSTALL_PREFIX=${{ env.srcdir }}/${{ env.pkgname }}-${{ matrix.arch }}-darwin-apple -DCMAKE_C_COMPILER=$CC_CROSS -DCMAKE_CXX_COMPILER=$CXX_CROSS -DCMAKE_C_FLAGS="${CMAKE_C_FLAGS} -arch ${{ matrix.arch }}" -DCMAKE_CXX_FLAGS="${CMAKE_CXX_FLAGS} -arch ${{ matrix.arch }}"
175-
cmake --build . --config=Release
176-
cmake --install .
165+
cmake .. -DBUILD_TESTING=OFF -DICONV_COMPAT=OFF -DCMAKE_INSTALL_PREFIX="${{ steps.rubisco.outputs.srcdir }}/${{ steps.rubisco.outputs.pkgname }}-arm64-apple-darwin"
166+
cmake --build . --config=Release -j $(nproc)
167+
cmake --install . --config=Release
177168
cd ..
178-
169+
179170
- name: 📦 Make packages
180171
run: |
181-
tar cvf ${{ env.pkgname }}-${{ matrix.arch }}-darwin-apple.tar ${{ env.pkgname }}-${{ matrix.arch }}-darwin-apple
182-
zip -r -9 dist/${{ env.pkgname }}-${{ matrix.arch }}-darwin-apple.zip ${{ env.pkgname }}-${{ matrix.arch }}-darwin-apple
183-
7z a dist/${{ env.pkgname }}-${{ matrix.arch }}-darwin-apple.7z ${{ env.pkgname }}-${{ matrix.arch }}-darwin-apple
184-
xz -c -9 -k ${{ env.pkgname }}-${{ matrix.arch }}-darwin-apple.tar > dist/${{ env.pkgname }}-${{ matrix.arch }}-darwin-apple.tar.xz
185-
gzip -c -9 -k ${{ env.pkgname }}-${{ matrix.arch }}-darwin-apple.tar > dist/${{ env.pkgname }}-${{ matrix.arch }}-darwin-apple.tar.gz
172+
tar cvf dist/${{ steps.rubisco.outputs.pkgname }}-arm64-apple-darwin.tar ${{ steps.rubisco.outputs.pkgname }}-arm64-apple-darwin
173+
xz -9 dist/${{ steps.rubisco.outputs.pkgname }}-arm64-apple-darwin.tar
186174
175+
- name: 📦 Generate checksum
176+
run: |
187177
cd dist
188-
for i in $(ls) ; do md5sum $i > $i.md5 ; done
189-
cd ..
190-
#--------------------------------------------publish--------------------------------------------
178+
for i in $(ls) ; do sha256sum $i > $i.sha256 ; done
179+
cd ..
191180
192181
- name: ⬆️ Create release and upload assets
193182
uses: softprops/action-gh-release@v1
194183
with:
195-
tag_name: ${{ env.tag }}
184+
tag_name: ${{ steps.rubisco.outputs.tag }}
196185
files: ./dist/*
197186

198-
build-msvc:
199-
200-
needs: build-dist
201-
202-
strategy:
203-
fail-fast: false
204-
matrix:
205-
include:
206-
- { arch: amd64, msvc_arch: x64 }
207-
- { arch: i386, msvc_arch: Win32 }
208-
- { arch: arm64, msvc_arch: ARM64 }
209-
- { arch: arm, msvc_arch: ARM }
210-
211-
runs-on: windows-latest
212-
213-
steps:
214-
215-
#--------------------------------------------collect--------------------------------------------
216-
- name: 🧳 Set up MSVC
217-
uses: microsoft/setup-msbuild@v1
218-
219-
- name: 🏷️ Get infomations
220-
run: |
221-
$tag="$env:GITHUB_REF_NAME"
222-
echo "tag=$tag" >> $env:GITHUB_ENV
223-
echo "pkgname=cppp-reiconv-$tag" >> $env:GITHUB_ENV
224-
echo "srcdir=$($PWD.Path)" >> $env:GITHUB_ENV
225-
226-
- name: 📁 Collect dependencies
227-
run: |
228-
choco install 7zip.commandline zip gzip dos2unix wget mingw -y
229-
230-
- name: 📁 Get source distribution tarball
231-
run: |
232-
wget https://github.com/${{ github.repository }}/releases/download/${{ env.tag }}/${{ env.pkgname }}.tar.gz
233-
tar zxvf ${{ env.pkgname }}.tar.gz
234-
Move-Item -Path ${{ env.pkgname }}\* -Destination .
235-
236-
- name: 🧳 Prepare for binary distribution building
237-
run: |
238-
mkdir dist
239-
240-
- name: 🛠️ Build binary distribution
241-
run: |
242-
mkdir build
243-
cd build
244-
cmake .. -DCMAKE_INSTALL_PREFIX=${{ env.srcdir }}/${{ env.pkgname }}-${{ matrix.arch }}-windows-msvc -A ${{ matrix.msvc_arch }}
245-
cmake --build . --config=Release
246-
cmake --install .
247-
cd ..
248-
249-
- name: 📦 Make packages
250-
run: |
251-
tar cvf ${{ env.pkgname }}-${{ matrix.arch }}-windows-msvc.tar ${{ env.pkgname }}-${{ matrix.arch }}-windows-msvc
252-
zip -r -9 dist/${{ env.pkgname }}-${{ matrix.arch }}-windows-msvc.zip ${{ env.pkgname }}-${{ matrix.arch }}-windows-msvc
253-
7z a dist/${{ env.pkgname }}-${{ matrix.arch }}-windows-msvc.7z ${{ env.pkgname }}-${{ matrix.arch }}-windows-msvc
254-
xz -9 -k ${{ env.pkgname }}-${{ matrix.arch }}-windows-msvc.tar
255-
gzip -9 -k ${{ env.pkgname }}-${{ matrix.arch }}-windows-msvc.tar
256-
mv ${{ env.pkgname }}-${{ matrix.arch }}-windows-msvc.tar.xz dist
257-
mv ${{ env.pkgname }}-${{ matrix.arch }}-windows-msvc.tar.gz dist
258-
259-
cd dist
260-
Get-ChildItem | ForEach-Object {
261-
md5sum $_.Name > ($_.Name + ".md5")
262-
dos2unix ($_.Name + ".md5")
263-
}
264-
cd ..
265-
266-
#--------------------------------------------publish--------------------------------------------
267-
268-
- name: ⬆️ Create release and upload assets
269-
uses: softprops/action-gh-release@v1
270-
with:
271-
tag_name: ${{ env.tag }}
272-
files: ./dist/*
187+
# Rubisco cannot been install due to encoding problems on Windows.
188+
# build-windows:
189+
190+
# runs-on: windows-latest
191+
192+
# steps:
193+
# - name: 📁 Checkout
194+
# uses: actions/checkout@v4
195+
196+
# - name: 🧰 Setup Rubisco
197+
# id: rubisco
198+
# uses: cppp-project/rubisco@main
199+
# with:
200+
# host: x86_64-windows-msvc
201+
202+
# - name: 📁 Collect dependencies
203+
# run: |
204+
# choco install zip dos2unix mingw -y
205+
206+
# - name: 📁 Collect subpackages
207+
# run: |
208+
# git clone https://github.com/cppp-project/build-aux --depth 1
209+
# git clone https://github.com/cppp-project/cppp-platform --depth 1
210+
211+
# - name: 🧳 Prepare for building
212+
# run: |
213+
# mkdir -p ${{ steps.rubisco.outputs.pkgname }}-x86_64-windows-msvc
214+
# mkdir -p dist
215+
216+
# - name: 🛠️ Build binary distribution
217+
# run: |
218+
# mkdir build
219+
# cd build
220+
# cmake .. -DBUILD_TESTING=OFF -DICONV_COMPAT=ON -DCMAKE_INSTALL_PREFIX="${{ steps.rubisco.outputs.srcdir }}/${{ steps.rubisco.outputs.pkgname }}-x86_64-windows-msvc"
221+
# cmake --build . --config=Release -j $(nproc)
222+
# cmake --install . --config=Release
223+
# cd ..
224+
225+
# - name: 📦 Make packages
226+
# run: |
227+
# tar cvf dist/${{ steps.rubisco.outputs.pkgname }}-x86_64-windows-msvc.tar ${{ steps.rubisco.outputs.pkgname }}-x86_64-windows-msvc
228+
# xz -9 dist/${{ steps.rubisco.outputs.pkgname }}-x86_64-windows-msvc.tar
229+
230+
# - name: 📦 Generate checksum
231+
# run: |
232+
# cd dist
233+
# Get-ChildItem | ForEach-Object {
234+
# sha256sum $_.Name > ($_.Name + ".sha256")
235+
# dos2unix ($_.Name + ".sha256")
236+
# }
237+
# cd ..
238+
239+
# - name: ⬆️ Create release and upload assets
240+
# uses: softprops/action-gh-release@v1
241+
# with:
242+
# tag_name: ${{ steps.rubisco.outputs.tag }}
243+
# files: ./dist/*

0 commit comments

Comments
 (0)