fix: 去掉并行构建,gitea不支持

This commit is contained in:
2026-07-26 13:29:38 +08:00
parent 62fd8c0685
commit 0d06f797f8
+34 -70
View File
@@ -4,73 +4,7 @@ on:
branches: [main] branches: [main]
jobs: jobs:
build:
runs-on: ubuntu-builder
strategy:
fail-fast: false
matrix:
target:
- name: linux-amd64
toolchain: ""
cmake_extra: ""
build_testing: ON
- name: linux-arm64
toolchain: -DCMAKE_TOOLCHAIN_FILE=cmake/toolchain-linux-arm64.cmake
cmake_extra: ""
build_testing: OFF
- name: linux-armhf
toolchain: -DCMAKE_TOOLCHAIN_FILE=cmake/toolchain-linux-armhf.cmake
cmake_extra: ""
build_testing: OFF
- name: windows-amd64
toolchain: -DCMAKE_TOOLCHAIN_FILE=cmake/toolchain-windows-amd64.cmake
cmake_extra: -DBUILD_EXAMPLES=OFF
build_testing: OFF
- name: baremetal-arm32
toolchain: -DCMAKE_TOOLCHAIN_FILE=cmake/toolchain-baremetal-arm32.cmake
cmake_extra: -DBUILD_EXAMPLES=OFF -DBUILD_SHARED=OFF
build_testing: OFF
steps:
- uses: actions/checkout@v4
- name: Install cross-compilers
run: |
sudo apt-get update
sudo apt-get install -y \
gcc-arm-linux-gnueabihf \
gcc-aarch64-linux-gnu \
gcc-mingw-w64-x86-64 \
gcc-arm-none-eabi
- name: Configure
run: cmake -S . -B build -DBUILD_TESTING=${{ matrix.target.build_testing }} ${{ matrix.target.toolchain }} ${{ matrix.target.cmake_extra }}
- name: Build
run: cmake --build build
- name: Run tests
if: matrix.target.build_testing == 'ON'
run: ctest --test-dir build --output-on-failure
- name: Package
run: |
PKG="datarouter-${{ matrix.target.name }}"
mkdir -p "dist/$PKG"
for f in datarouter.h datarouter_config_template.h LICENSE README.md; do
if [ -f "$f" ]; then cp "$f" "dist/$PKG/"; fi
done
for f in libDataRouter.a libDataRouter.so libDataRouter.dll libDataRouter.dll.a example example.exe; do
if [ -f "build/$f" ]; then cp "build/$f" "dist/$PKG/"; fi
done
- uses: actions/upload-artifact@v4
with:
name: datarouter-${{ matrix.target.name }}
path: dist/datarouter-${{ matrix.target.name }}
release: release:
needs: build
runs-on: ubuntu-builder runs-on: ubuntu-builder
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
@@ -89,9 +23,39 @@ jobs:
[ -n "$TAG" ] || exit 78 [ -n "$TAG" ] || exit 78
echo "tag=$TAG" >> "$GITHUB_OUTPUT" echo "tag=$TAG" >> "$GITHUB_OUTPUT"
- uses: actions/download-artifact@v4 - name: Install cross-compilers
with: run: |
path: artifacts sudo apt-get update
sudo apt-get install -y \
gcc-arm-linux-gnueabihf \
gcc-aarch64-linux-gnu \
gcc-mingw-w64-x86-64 \
gcc-arm-none-eabi
- name: Build all targets
run: |
for entry in \
"linux-amd64|ON|" \
"linux-arm64|OFF|-DCMAKE_TOOLCHAIN_FILE=cmake/toolchain-linux-arm64.cmake" \
"linux-armhf|OFF|-DCMAKE_TOOLCHAIN_FILE=cmake/toolchain-linux-armhf.cmake" \
"windows-amd64|OFF|-DCMAKE_TOOLCHAIN_FILE=cmake/toolchain-windows-amd64.cmake -DBUILD_EXAMPLES=OFF" \
"baremetal-arm32|OFF|-DCMAKE_TOOLCHAIN_FILE=cmake/toolchain-baremetal-arm32.cmake -DBUILD_EXAMPLES=OFF -DBUILD_SHARED=OFF"
do
IFS='|' read -r name testing extra <<< "$entry"
echo ">>> Building $name"
cmake -S . -B "build-$name" -DBUILD_TESTING=$testing $extra
cmake --build "build-$name"
[ "$testing" = "ON" ] && ctest --test-dir "build-$name" --output-on-failure
pkg="datarouter-$name"
mkdir -p "dist/$pkg"
for f in datarouter.h datarouter_config_template.h LICENSE README.md; do
if [ -f "$f" ]; then cp "$f" "dist/$pkg/"; fi
done
for f in libDataRouter.a libDataRouter.so libDataRouter.dll libDataRouter.dll.a example example.exe; do
if [ -f "build-$name/$f" ]; then cp "build-$name/$f" "dist/$pkg/"; fi
done
done
- name: Create release & upload assets - name: Create release & upload assets
run: | run: |
@@ -107,7 +71,7 @@ jobs:
ID=$(echo "$RESP" | python3 -c "import sys,json;print(json.load(sys.stdin)['id'])") ID=$(echo "$RESP" | python3 -c "import sys,json;print(json.load(sys.stdin)['id'])")
for dir in artifacts/*/; do for dir in dist/*/; do
name="$(basename "$dir").tar.gz" name="$(basename "$dir").tar.gz"
tar czf "/tmp/$name" -C "$dir" . tar czf "/tmp/$name" -C "$dir" .
echo "Uploading $name" echo "Uploading $name"